Optionally reset yaw rate integral in acromode for fixedwings

This commit adds a parameter to optionally disable the yaw rate integral for the fixedwing rate controller
This commit is contained in:
Jaeyoung Lim 2023-03-14 13:13:47 +01:00
parent 7be3279675
commit 749f645bd6
4 changed files with 27 additions and 0 deletions

View File

@ -94,6 +94,18 @@ public:
*/
void resetIntegral() { _rate_int.zero(); }
/**
* Set the integral term to 0 to prevent windup for each axis
* @param axis axis: roll 0 / pitch 1 / yaw 2
* @see _rate_int
*/
void resetIntegral(size_t axis)
{
if (axis < 3) {
_rate_int(axis) = 0.0f;
}
}
/**
* Get status message of controller for logging/debugging
* @param rate_ctrl_status status message to fill with internal states

View File

@ -118,6 +118,10 @@ FixedwingRateControl::vehicle_manual_poll()
_rate_sp_pub.publish(_rates_sp);
if (_param_fw_acro_yaw_int_reset.get()) {
_rate_control.resetIntegral(2);
}
} else {
/* manual/direct control */

View File

@ -152,6 +152,7 @@ private:
(ParamFloat<px4::params::FW_ACRO_X_MAX>) _param_fw_acro_x_max,
(ParamFloat<px4::params::FW_ACRO_Y_MAX>) _param_fw_acro_y_max,
(ParamFloat<px4::params::FW_ACRO_Z_MAX>) _param_fw_acro_z_max,
(ParamInt<px4::params::FW_ACRO_Z_IRESET>) _param_fw_acro_yaw_int_reset,
(ParamFloat<px4::params::FW_AIRSPD_MAX>) _param_fw_airspd_max,
(ParamFloat<px4::params::FW_AIRSPD_MIN>) _param_fw_airspd_min,

View File

@ -365,6 +365,16 @@ PARAM_DEFINE_FLOAT(FW_ACRO_Y_MAX, 90);
*/
PARAM_DEFINE_FLOAT(FW_ACRO_Z_MAX, 45);
/**
* Reset for integral of the z axis while rate controller in acro mode.
*
* This configures the integral of each axis of the rate controller in acro mode
*
* @boolean
* @group FW Rate Control
*/
PARAM_DEFINE_INT32(FW_ACRO_Z_IRESET, 1);
/**
* Enable throttle scale by battery level
*