mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-22 14:53:35 +08:00
Navigator: Add the ability to do a low-altitude RTL to avoid traffic
This is a first baseline implementation for collision avoidance with aircraft equipped with transponders. Since the drone-to-drone and drone-to-airplane system will be regulated by a standard, we do carefully avoid to do anything too fancy. This implementation allows to reduce altitude to get close to ground and land immediately or RTL. This is similar to what a human pilot would do and allows to get out of manned airspace which is at higher altitudes.
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
/****************************************************************************
|
||||
*
|
||||
* Copyright (c) 2013-2016 PX4 Development Team. All rights reserved.
|
||||
* Copyright (c) 2013-2017 PX4 Development Team. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
@@ -92,7 +92,8 @@ RTL::on_activation()
|
||||
if (_navigator->get_land_detected()->landed) {
|
||||
_rtl_state = RTL_STATE_LANDED;
|
||||
|
||||
} else if (_navigator->get_global_position()->alt < (_navigator->get_home_position()->alt + get_rtl_altitude())) {
|
||||
} else if ((_rtl_alt_min
|
||||
|| _navigator->get_global_position()->alt < (_navigator->get_home_position()->alt + get_rtl_altitude()))) {
|
||||
|
||||
/* if lower than return altitude, climb up first */
|
||||
_rtl_state = RTL_STATE_CLIMB;
|
||||
@@ -118,6 +119,12 @@ RTL::on_active()
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
RTL::set_return_alt_min(bool min)
|
||||
{
|
||||
_rtl_alt_min = min;
|
||||
}
|
||||
|
||||
void
|
||||
RTL::set_rtl_item()
|
||||
{
|
||||
@@ -276,6 +283,7 @@ RTL::set_rtl_item()
|
||||
|
||||
case RTL_STATE_LANDED: {
|
||||
set_idle_item(&_mission_item);
|
||||
set_return_alt_min(false);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user