FW Rate Controller: allow to enable/disable yaw axis in Acro (#21566)

* RateControl: rename setGains to setPidGains to be more precise

Signed-off-by: Silvan Fuhrer <silvan@auterion.com>

* FW Rate controller: only allow to disable Yaw in Acro, not roll and pitch

Signed-off-by: Silvan Fuhrer <silvan@auterion.com>

---------

Signed-off-by: Silvan Fuhrer <silvan@auterion.com>
This commit is contained in:
Silvan Fuhrer
2023-05-26 15:09:29 +02:00
committed by GitHub
parent ee96d209d7
commit ad769db8d6
6 changed files with 53 additions and 18 deletions
+2 -2
View File
@@ -1,6 +1,6 @@
/****************************************************************************
*
* Copyright (c) 2019 PX4 Development Team. All rights reserved.
* Copyright (c) 2019-2023 PX4 Development Team. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -40,7 +40,7 @@
using namespace matrix;
void RateControl::setGains(const Vector3f &P, const Vector3f &I, const Vector3f &D)
void RateControl::setPidGains(const Vector3f &P, const Vector3f &I, const Vector3f &D)
{
_gain_p = P;
_gain_i = I;
+15 -3
View File
@@ -1,6 +1,6 @@
/****************************************************************************
*
* Copyright (c) 2019 PX4 Development Team. All rights reserved.
* Copyright (c) 2019-2023 PX4 Development Team. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -51,12 +51,12 @@ public:
~RateControl() = default;
/**
* Set the rate control gains
* Set the rate control PID gains
* @param P 3D vector of proportional gains for body x,y,z axis
* @param I 3D vector of integral gains
* @param D 3D vector of derivative gains
*/
void setGains(const matrix::Vector3f &P, const matrix::Vector3f &I, const matrix::Vector3f &D);
void setPidGains(const matrix::Vector3f &P, const matrix::Vector3f &I, const matrix::Vector3f &D);
/**
* Set the mximum absolute value of the integrator for all axes
@@ -94,6 +94,18 @@ public:
*/
void resetIntegral() { _rate_int.zero(); }
/**
* Set the integral term to 0 for specific axes
* @param axis roll 0 / pitch 1 / yaw 2
* @see _rate_int
*/
void resetIntegral(size_t axis)
{
if (axis < 3) {
_rate_int(axis) = 0.f;
}
}
/**
* Get status message of controller for logging/debugging
* @param rate_ctrl_status status message to fill with internal states