|
|
|
@ -242,6 +242,13 @@ void RTL::find_RTL_destination()
@@ -242,6 +242,13 @@ void RTL::find_RTL_destination()
|
|
|
|
|
|
|
|
|
|
void RTL::on_activation() |
|
|
|
|
{ |
|
|
|
|
setClimbAndReturnDone(false); |
|
|
|
|
|
|
|
|
|
// if a mission landing is desired we should only execute mission navigation mode if we currently are in fw mode
|
|
|
|
|
// In multirotor mode no landing pattern is required so we can just navigate to the land point directly and don't need to run mission
|
|
|
|
|
_should_engange_mission_for_landing = (_destination.type == RTL_DESTINATION_MISSION_LANDING) |
|
|
|
|
&& _navigator->get_vstatus()->vehicle_type == vehicle_status_s::VEHICLE_TYPE_FIXED_WING; |
|
|
|
|
|
|
|
|
|
// output the correct message, depending on where the RTL destination is
|
|
|
|
|
switch (_destination.type) { |
|
|
|
|
case RTL_DESTINATION_HOME: |
|
|
|
@ -318,25 +325,6 @@ void RTL::on_active()
@@ -318,25 +325,6 @@ void RTL::on_active()
|
|
|
|
|
|
|
|
|
|
void RTL::set_rtl_item() |
|
|
|
|
{ |
|
|
|
|
// RTL_TYPE: mission landing.
|
|
|
|
|
// Landing using planned mission landing, fly to DO_LAND_START instead of returning _destination.
|
|
|
|
|
// After reaching DO_LAND_START, do nothing, let navigator takeover with mission landing.
|
|
|
|
|
if (_destination.type == RTL_DESTINATION_MISSION_LANDING) { |
|
|
|
|
if (_rtl_state > RTL_STATE_RETURN) { |
|
|
|
|
if (_navigator->start_mission_landing()) { |
|
|
|
|
mavlink_log_info(_navigator->get_mavlink_log_pub(), "RTL: using mission landing\t"); |
|
|
|
|
events::send(events::ID("rtl_using_mission_landing"), events::Log::Info, "RTL: using mission landing"); |
|
|
|
|
return; |
|
|
|
|
|
|
|
|
|
} else { |
|
|
|
|
// Otherwise use regular RTL.
|
|
|
|
|
mavlink_log_critical(_navigator->get_mavlink_log_pub(), "RTL: unable to use mission landing\t"); |
|
|
|
|
events::send(events::ID("rtl_not_using_mission_landing"), events::Log::Error, |
|
|
|
|
"RTL: unable to use mission landing, doing regular RTL"); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
_navigator->set_can_loiter_at_sp(false); |
|
|
|
|
|
|
|
|
|
const vehicle_global_position_s &gpos = *_navigator->get_global_position(); |
|
|
|
|