From 646b5bb57817c663f6d7a1903f19546193357310 Mon Sep 17 00:00:00 2001 From: Silvan Fuhrer Date: Wed, 7 Oct 2020 10:57:49 +0200 Subject: [PATCH] L1: Do only check for wrong tangent_vel if in circle_mode Signed-off-by: Silvan Fuhrer --- src/lib/l1/ECL_L1_Pos_Controller.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/lib/l1/ECL_L1_Pos_Controller.cpp b/src/lib/l1/ECL_L1_Pos_Controller.cpp index fe3bf308a9..e46c7bac62 100644 --- a/src/lib/l1/ECL_L1_Pos_Controller.cpp +++ b/src/lib/l1/ECL_L1_Pos_Controller.cpp @@ -264,8 +264,8 @@ ECL_L1_Pos_Controller::navigate_loiter(const Vector2f &vector_A, const Vector2f /* calculate velocity on circle / along tangent */ float tangent_vel = xtrack_vel_center * loiter_direction; - /* prevent PD output from turning the wrong way */ - if (tangent_vel < 0.0f) { + /* prevent PD output from turning the wrong way when in circle mode */ + if (tangent_vel < 0.0f && _circle_mode) { lateral_accel_sp_circle_pd = math::max(lateral_accel_sp_circle_pd, 0.0f); }