FlightTask Auto: use yaw setpoint from Navigator if disable_weather_vane is true

When disable_weather_vane is true, the vehicle is aligning for the transition waypoint
(VTOL) and thus the yaw setpoint from Navigator should be used.

Signed-off-by: Silvan Fuhrer <silvan@auterion.com>
This commit is contained in:
Silvan Fuhrer 2020-08-03 18:07:47 +02:00 committed by Mathieu Bresciani
parent a93052f9b2
commit 7a71cbb9bf

View File

@ -277,10 +277,12 @@ bool FlightTaskAuto::_evaluateTriplets()
_yaw_setpoint = NAN;
} else {
if (_type != WaypointType::takeoff
if ((_type != WaypointType::takeoff || _sub_triplet_setpoint.get().current.disable_weather_vane)
&& _sub_triplet_setpoint.get().current.yaw_valid) {
// Use the yaw computed in Navigator except during takeoff because
// Navigator is not handling the yaw reset properly
// Navigator is not handling the yaw reset properly.
// But: use if from Navigator during takeoff if disable_weather_vane is true,
// because we're then aligning to the transition waypoint.
// TODO: fix in navigator
_yaw_setpoint = _sub_triplet_setpoint.get().current.yaw;