From 836c7c65755ab8f0fd3b0fd42fb06bdb903721b4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beat=20K=C3=BCng?= Date: Fri, 5 Feb 2021 10:11:55 +0100 Subject: [PATCH] StickAccelerationXY: brake a bit faster The drag is based on max_acc/max_vel, which means that increasing the maximum velocity leads to slower braking (at the same starting speed). Especially a combination of small max_acc (slow responsiveness) with high max_vel led to an exceedingly high braking distance. This improves that while still being smooth. --- .../flight_mode_manager/tasks/Utility/StickAccelerationXY.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/modules/flight_mode_manager/tasks/Utility/StickAccelerationXY.cpp b/src/modules/flight_mode_manager/tasks/Utility/StickAccelerationXY.cpp index 6f79d1d1a8..332a194f5d 100644 --- a/src/modules/flight_mode_manager/tasks/Utility/StickAccelerationXY.cpp +++ b/src/modules/flight_mode_manager/tasks/Utility/StickAccelerationXY.cpp @@ -123,7 +123,7 @@ Vector2f StickAccelerationXY::calculateDrag(Vector2f drag_coefficient, const flo _brake_boost_filter.setParameters(dt, .8f); if (stick_xy.norm_squared() < FLT_EPSILON) { - _brake_boost_filter.update(2.f); + _brake_boost_filter.update(math::max(2.f, sqrtf(_param_mpc_vel_manual.get()))); } else { _brake_boost_filter.update(1.f);