From 9ad39fec67c684ed09f26348768a494c53098ff8 Mon Sep 17 00:00:00 2001 From: sander Date: Sat, 6 Feb 2016 23:24:20 +0100 Subject: [PATCH] If VTOL then transition to RW before landing in RTL --- src/modules/navigator/mission_block.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/modules/navigator/mission_block.cpp b/src/modules/navigator/mission_block.cpp index 789945e4ac..be4dcad5f7 100644 --- a/src/modules/navigator/mission_block.cpp +++ b/src/modules/navigator/mission_block.cpp @@ -36,6 +36,7 @@ * Helper class to use mission items * * @author Julian Oes + * @author Sander Smeets */ #include @@ -374,6 +375,20 @@ MissionBlock::set_takeoff_item(struct mission_item_s *item, float min_clearance, void MissionBlock::set_land_item(struct mission_item_s *item, bool at_current_location) { + + /* VTOL transition to RW before landing */ + if(_navigator->get_vstatus()->is_vtol){ + struct vehicle_command_s cmd = {}; + cmd.command = NAV_CMD_DO_VTOL_TRANSITION; + cmd.param1 = 3; + if (_cmd_pub != nullptr) { + orb_publish(ORB_ID(vehicle_command), _cmd_pub, &cmd); + } else { + _cmd_pub = orb_advertise(ORB_ID(vehicle_command), &cmd); + } + } + + /* set the land item */ item->nav_cmd = NAV_CMD_LAND; /* use current position */