mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-06-07 09:13:32 +08:00
MC position control: Smoother takeoff
This patch ramps up the throttle to hover throttle instead of a fixed value and limits the vertical takeoff speed to the value set in the parameter. This should ensure smoother, slower takeoffs, in particular in autonomous flight modes.
This commit is contained in:
@@ -1229,7 +1229,9 @@ MulticopterPositionControl::control_non_manual(float dt)
|
||||
if (!_takeoff_jumped) {
|
||||
// ramp thrust setpoint up
|
||||
if (_vel(2) > -(_params.tko_speed / 2.0f)) {
|
||||
_takeoff_thrust_sp += 0.5f * dt;
|
||||
|
||||
// ramp up to hover throttle in one second
|
||||
_takeoff_thrust_sp += _params.thr_hover * dt;
|
||||
_vel_sp.zero();
|
||||
_vel_prev.zero();
|
||||
|
||||
@@ -1244,10 +1246,6 @@ MulticopterPositionControl::control_non_manual(float dt)
|
||||
}
|
||||
}
|
||||
|
||||
if (_takeoff_jumped) {
|
||||
_vel_sp(2) = -_params.tko_speed;
|
||||
}
|
||||
|
||||
} else {
|
||||
_takeoff_jumped = false;
|
||||
_takeoff_thrust_sp = 0.0f;
|
||||
@@ -1781,8 +1779,17 @@ MulticopterPositionControl::control_position(float dt)
|
||||
}
|
||||
|
||||
/* make sure velocity setpoint is saturated in z*/
|
||||
if (_vel_sp(2) < -1.0f * _params.vel_max_up) {
|
||||
if (_pos_sp_triplet.current.valid
|
||||
&& _pos_sp_triplet.current.type == position_setpoint_s::SETPOINT_TYPE_TAKEOFF
|
||||
&& _control_mode.flag_armed
|
||||
&& _takeoff_jumped
|
||||
&& (_vel_sp(2) < -_params.tko_speed)) {
|
||||
|
||||
_vel_sp(2) = -_params.tko_speed;
|
||||
|
||||
} else if (_vel_sp(2) < -1.0f * _params.vel_max_up) {
|
||||
_vel_sp(2) = -1.0f * _params.vel_max_up;
|
||||
|
||||
}
|
||||
|
||||
_slow_land_gradual_velocity_limit();
|
||||
|
||||
Reference in New Issue
Block a user