mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-05-21 04:33:10 +08:00
mc_pos_control: save previous velocity setpoint after constraining, fix smooth takeoff to be still excluded from slewrate
This commit is contained in:
@@ -2453,13 +2453,10 @@ MulticopterPositionControl::calculate_velocity_setpoint(float dt)
|
||||
_vel_sp(2) = math::min(_vel_sp(2), vel_limit);
|
||||
|
||||
/* apply slewrate (aka acceleration limit) for smooth flying */
|
||||
|
||||
if (!_control_mode.flag_control_auto_enabled) {
|
||||
if (!_control_mode.flag_control_auto_enabled && !_in_smooth_takeoff) {
|
||||
vel_sp_slewrate(dt);
|
||||
}
|
||||
|
||||
_vel_sp_prev = _vel_sp;
|
||||
|
||||
/* special velocity setpoint limitation for smooth takeoff (after slewrate!) */
|
||||
if (_in_smooth_takeoff) {
|
||||
_in_smooth_takeoff = _takeoff_vel_limit < -_vel_sp(2);
|
||||
@@ -2478,6 +2475,8 @@ MulticopterPositionControl::calculate_velocity_setpoint(float dt)
|
||||
}
|
||||
|
||||
_vel_sp(2) = math::constrain(_vel_sp(2), -_params.vel_max_up, _params.vel_max_down);
|
||||
|
||||
_vel_sp_prev = _vel_sp;
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
Reference in New Issue
Block a user