From 4a14a8bc7fb6f47c8e7be72d3de502d35a61a40e Mon Sep 17 00:00:00 2001 From: bresch Date: Wed, 10 Nov 2021 13:40:28 +0100 Subject: [PATCH] AutoLineSV: Always publish a valid yaw setpoint In MPC_YAW_MODE 3 (along trajectory), the flight task is asked to produce a yaw setpoint. If the previous yaw value was NAN (e.g.: during early takeoff), the setpoint should then be reset to the current estimate. --- src/modules/flight_mode_manager/tasks/Auto/FlightTaskAuto.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/modules/flight_mode_manager/tasks/Auto/FlightTaskAuto.cpp b/src/modules/flight_mode_manager/tasks/Auto/FlightTaskAuto.cpp index a71f4f334ee..5bda170d783 100644 --- a/src/modules/flight_mode_manager/tasks/Auto/FlightTaskAuto.cpp +++ b/src/modules/flight_mode_manager/tasks/Auto/FlightTaskAuto.cpp @@ -688,7 +688,7 @@ void FlightTaskAuto::_generateHeading() { // Generate heading along trajectory if possible, otherwise hold the previous yaw setpoint if (!_generateHeadingAlongTraj()) { - _yaw_setpoint = _yaw_sp_prev; + _yaw_setpoint = PX4_ISFINITE(_yaw_sp_prev) ? _yaw_sp_prev : _yaw; } }