mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-15 06:33:34 +08:00
multirotor mixer slew rate limiting: naming and fixes
- avoid dividing by zero when calculating max delta output - better comments when calculating max delta output - better naming of functions and variables Signed-off-by: Roman <bapstroman@gmail.com>
This commit is contained in:
@@ -1075,8 +1075,12 @@ PX4FMU::cycle()
|
||||
dt = 0.02f;
|
||||
}
|
||||
|
||||
float slew_max = 2.0f * 1000.0f * dt / (_max_pwm[0] - _min_pwm[0]) / _mot_t_max;
|
||||
_mixers->update_slew_rate(slew_max);
|
||||
if (_mot_t_max > FLT_EPSILON) {
|
||||
// maximum value the ouputs of the multirotor mixer are allowed to change in this cycle
|
||||
// factor 2 is needed because actuator ouputs are in the range [-1,1]
|
||||
float delta_out_max = 2.0f * 1000.0f * dt / (_max_pwm[0] - _min_pwm[0]) / _mot_t_max;
|
||||
_mixers->set_max_delta_out_once(delta_out_max);
|
||||
}
|
||||
|
||||
/* do mixing */
|
||||
float outputs[_max_actuators];
|
||||
|
||||
Reference in New Issue
Block a user