From 8ca76feaba9169e0d46316abaf5f6bcb08b8b7aa Mon Sep 17 00:00:00 2001 From: Matthias Grob Date: Thu, 4 Mar 2021 11:15:33 +0100 Subject: [PATCH] Takeoff: remove updateRamp() early return --- src/modules/mc_pos_control/Takeoff/Takeoff.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/modules/mc_pos_control/Takeoff/Takeoff.cpp b/src/modules/mc_pos_control/Takeoff/Takeoff.cpp index 4fb98948e8..68ee76a48b 100644 --- a/src/modules/mc_pos_control/Takeoff/Takeoff.cpp +++ b/src/modules/mc_pos_control/Takeoff/Takeoff.cpp @@ -111,8 +111,10 @@ void Takeoff::updateTakeoffState(const bool armed, const bool landed, const bool float Takeoff::updateRamp(const float dt, const float takeoff_desired_vz) { + float upwards_velocity_limit = takeoff_desired_vz; + if (_takeoff_state < TakeoffState::rampup) { - return _takeoff_ramp_vz_init; + upwards_velocity_limit = _takeoff_ramp_vz_init; } if (_takeoff_state == TakeoffState::rampup) { @@ -124,9 +126,9 @@ float Takeoff::updateRamp(const float dt, const float takeoff_desired_vz) } if (_takeoff_ramp_vz < takeoff_desired_vz) { - return _takeoff_ramp_vz; + upwards_velocity_limit = _takeoff_ramp_vz; } } - return takeoff_desired_vz; + return upwards_velocity_limit; }