Skip to content

Commit 97f632a

Browse files
RomanBapstsfuhrer
authored andcommitted
vtol_takeoff: reset reposition triplet before handing over to loiter mode
Signed-off-by: RomanBapst <bapstroman@gmail.com>
1 parent d6488fa commit 97f632a

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/modules/navigator/vtol_takeoff.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,13 @@ VtolTakeoff::on_active()
142142

143143
case vtol_takeoff_state::CLIMB: {
144144

145+
// reset any potentially valid reposition triplet which was not handled
146+
// we do this to avoid random loiter locations after switching to loiter mode after this
147+
position_setpoint_triplet_s *reposition_triplet = _navigator->get_reposition_triplet();
148+
_navigator->reset_position_setpoint(reposition_triplet->previous);
149+
_navigator->reset_position_setpoint(reposition_triplet->current);
150+
_navigator->reset_position_setpoint(reposition_triplet->next);
151+
145152
// the VTOL takeoff is done, proceed loitering and upate the navigation state to LOITER
146153
_navigator->get_mission_result()->finished = true;
147154
_navigator->set_mission_result_updated();

0 commit comments

Comments
 (0)