mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-18 06:23:34 +08:00
constrain integrator part in control output until startup detection is available for safety reasons
This commit is contained in:
@@ -161,9 +161,10 @@ float ECL_PitchController::control_bodyrate(float roll, float pitch,
|
||||
}
|
||||
|
||||
/* integrator limit */
|
||||
_integrator = math::constrain(_integrator, -_integrator_max, _integrator_max);
|
||||
//xxx: until start detection is available: integral part in control signal is limited here
|
||||
float integrator_constrained = math::constrain(_integrator * k_i_rate, -_integrator_max, _integrator_max);
|
||||
/* store non-limited output */
|
||||
_last_output = ((_rate_error * _k_d * scaler) + _integrator * k_i_rate * scaler + (_rate_setpoint * k_roll_ff)) * scaler;
|
||||
_last_output = ((_rate_error * _k_d * scaler) + integrator_constrained * scaler + (_rate_setpoint * k_roll_ff)) * scaler;
|
||||
|
||||
return math::constrain(_last_output, -_max_deflection_rad, _max_deflection_rad);
|
||||
}
|
||||
|
||||
@@ -133,11 +133,12 @@ float ECL_RollController::control_bodyrate(float pitch,
|
||||
}
|
||||
|
||||
/* integrator limit */
|
||||
_integrator = math::constrain(_integrator, -_integrator_max, _integrator_max);
|
||||
//xxx: until start detection is available: integral part in control signal is limited here
|
||||
float integrator_constrained = math::constrain(_integrator * k_i_rate, -_integrator_max, _integrator_max);
|
||||
//warnx("roll: _integrator: %.4f, _integrator_max: %.4f", (double)_integrator, (double)_integrator_max);
|
||||
|
||||
/* store non-limited output */
|
||||
_last_output = ((_rate_error * _k_d * scaler) + _integrator * k_i_rate * scaler + (_rate_setpoint * k_ff)) * scaler;
|
||||
_last_output = ((_rate_error * _k_d * scaler) + integrator_constrained * scaler + (_rate_setpoint * k_ff)) * scaler;
|
||||
|
||||
return math::constrain(_last_output, -_max_deflection_rad, _max_deflection_rad);
|
||||
}
|
||||
|
||||
@@ -147,9 +147,10 @@ float ECL_YawController::control_bodyrate(float roll, float pitch,
|
||||
}
|
||||
|
||||
/* integrator limit */
|
||||
_integrator = math::constrain(_integrator, -_integrator_max, _integrator_max);
|
||||
//xxx: until start detection is available: integral part in control signal is limited here
|
||||
float integrator_constrained = math::constrain(_integrator * k_i_rate, -_integrator_max, _integrator_max);
|
||||
/* store non-limited output */
|
||||
_last_output = ((_rate_error * _k_d * scaler) + _integrator * k_i_rate * scaler + (_rate_setpoint * k_ff)) * scaler;
|
||||
_last_output = ((_rate_error * _k_d * scaler) + integrator_constrained * scaler + (_rate_setpoint * k_ff)) * scaler;
|
||||
|
||||
return math::constrain(_last_output, -_max_deflection_rad, _max_deflection_rad);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user