added a check to ensure the current position setpoint is valid

This commit is contained in:
Jake Dahl
2018-07-26 07:46:24 +02:00
committed by Lorenz Meier
parent a1ff4a8a67
commit 4144a53cd6
+2 -1
View File
@@ -69,7 +69,8 @@ RTL::on_activation()
// For safety reasons don't go into RTL if landed.
_rtl_state = RTL_STATE_LANDED;
} else if (_navigator->get_position_setpoint_triplet()->current.type == position_setpoint_s::SETPOINT_TYPE_LAND) {
} else if (_navigator->get_position_setpoint_triplet()->current.valid
&& _navigator->get_position_setpoint_triplet()->current.type == position_setpoint_s::SETPOINT_TYPE_LAND) {
// Skip straight to land if already performing a land.
_rtl_state = RTL_STATE_LAND;