mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-05-27 10:17:45 +08:00
Integral fixes, last parts
This commit is contained in:
@@ -62,8 +62,7 @@ float ECL_PitchController::control(float pitch_setpoint, float pitch, float pitc
|
|||||||
/* get the usual dt estimate */
|
/* get the usual dt estimate */
|
||||||
uint64_t dt_micros = ecl_elapsed_time(&_last_run);
|
uint64_t dt_micros = ecl_elapsed_time(&_last_run);
|
||||||
_last_run = ecl_absolute_time();
|
_last_run = ecl_absolute_time();
|
||||||
|
float dt = (float)dt_micros * 1e-6f;
|
||||||
float dt = dt_micros / 1000000;
|
|
||||||
|
|
||||||
/* lock integral for long intervals */
|
/* lock integral for long intervals */
|
||||||
if (dt_micros > 500000)
|
if (dt_micros > 500000)
|
||||||
@@ -115,7 +114,7 @@ float ECL_PitchController::control(float pitch_setpoint, float pitch, float pitc
|
|||||||
|
|
||||||
_rate_error = _rate_setpoint - pitch_rate;
|
_rate_error = _rate_setpoint - pitch_rate;
|
||||||
|
|
||||||
float ilimit_scaled = 0.0f;
|
float ilimit_scaled = _integrator_max * scaler;
|
||||||
|
|
||||||
if (!lock_integrator && k_i_rate > 0.0f && airspeed > 0.5f * airspeed_min) {
|
if (!lock_integrator && k_i_rate > 0.0f && airspeed > 0.5f * airspeed_min) {
|
||||||
|
|
||||||
|
|||||||
@@ -64,8 +64,11 @@ float ECL_RollController::control(float roll_setpoint, float roll, float roll_ra
|
|||||||
/* get the usual dt estimate */
|
/* get the usual dt estimate */
|
||||||
uint64_t dt_micros = ecl_elapsed_time(&_last_run);
|
uint64_t dt_micros = ecl_elapsed_time(&_last_run);
|
||||||
_last_run = ecl_absolute_time();
|
_last_run = ecl_absolute_time();
|
||||||
|
float dt = (float)dt_micros * 1e-6f;
|
||||||
|
|
||||||
float dt = (dt_micros > 500000) ? 0.0f : dt_micros / 1000000;
|
/* lock integral for long intervals */
|
||||||
|
if (dt_micros > 500000)
|
||||||
|
lock_integrator = true;
|
||||||
|
|
||||||
float k_ff = math::max((_k_p - _k_i * _tc) * _tc - _k_d, 0.0f);
|
float k_ff = math::max((_k_p - _k_i * _tc) * _tc - _k_d, 0.0f);
|
||||||
float k_i_rate = _k_i * _tc;
|
float k_i_rate = _k_i * _tc;
|
||||||
@@ -90,7 +93,7 @@ float ECL_RollController::control(float roll_setpoint, float roll, float roll_ra
|
|||||||
_rate_error = _rate_setpoint - roll_rate;
|
_rate_error = _rate_setpoint - roll_rate;
|
||||||
|
|
||||||
|
|
||||||
float ilimit_scaled = 0.0f;
|
float ilimit_scaled = _integrator_max * scaler;
|
||||||
|
|
||||||
if (!lock_integrator && k_i_rate > 0.0f && airspeed > 0.5f * airspeed_min) {
|
if (!lock_integrator && k_i_rate > 0.0f && airspeed > 0.5f * airspeed_min) {
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user