From cdc717be53125ebf0c2995d2d71c7268b3ddaa2a Mon Sep 17 00:00:00 2001 From: Andrew Wilkins <wilkinsaf@gmail.com> Date: Thu, 27 Apr 2023 08:32:43 -0700 Subject: [PATCH] Speed reset when switching flight modes (#21414) * speed reset between flight modes * no whitespace --- src/modules/navigator/land.cpp | 3 +++ src/modules/navigator/loiter.cpp | 3 +++ src/modules/navigator/mission.cpp | 3 +++ src/modules/navigator/rtl.cpp | 2 +- src/modules/navigator/takeoff.cpp | 3 +++ 5 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/modules/navigator/land.cpp b/src/modules/navigator/land.cpp index 28ffd36d070a..d280c942c65a 100644 --- a/src/modules/navigator/land.cpp +++ b/src/modules/navigator/land.cpp @@ -65,6 +65,9 @@ Land::on_activation() _navigator->set_can_loiter_at_sp(false); _navigator->set_position_setpoint_triplet_updated(); + + // reset cruising speed to default + _navigator->reset_cruising_speed(); } void diff --git a/src/modules/navigator/loiter.cpp b/src/modules/navigator/loiter.cpp index 07dfc5f3f707..655db702fa2c 100644 --- a/src/modules/navigator/loiter.cpp +++ b/src/modules/navigator/loiter.cpp @@ -63,6 +63,9 @@ Loiter::on_activation() } else { set_loiter_position(); } + + // reset cruising speed to default + _navigator->reset_cruising_speed(); } void diff --git a/src/modules/navigator/mission.cpp b/src/modules/navigator/mission.cpp index e83d04a30db1..b7611dcd192d 100644 --- a/src/modules/navigator/mission.cpp +++ b/src/modules/navigator/mission.cpp @@ -204,6 +204,9 @@ Mission::on_activation() cmd.param1 = -1.0f; cmd.param3 = 0.0f; _navigator->publish_vehicle_cmd(&cmd); + + // reset cruise speed + _navigator->reset_cruising_speed(); } void diff --git a/src/modules/navigator/rtl.cpp b/src/modules/navigator/rtl.cpp index 34ddf90591e5..919ff71e41ce 100644 --- a/src/modules/navigator/rtl.cpp +++ b/src/modules/navigator/rtl.cpp @@ -289,7 +289,7 @@ void RTL::on_activation() } // reset cruising speed and throttle to default for RTL - _navigator->set_cruising_speed(); + _navigator->reset_cruising_speed(); _navigator->set_cruising_throttle(); set_rtl_item(); diff --git a/src/modules/navigator/takeoff.cpp b/src/modules/navigator/takeoff.cpp index 8c39a2eeccd5..f998b9c1d93a 100644 --- a/src/modules/navigator/takeoff.cpp +++ b/src/modules/navigator/takeoff.cpp @@ -51,6 +51,9 @@ void Takeoff::on_activation() { set_takeoff_position(); + + // reset cruising speed to default + _navigator->reset_cruising_speed(); } void