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:
Lorenz Meier
2017-10-31 09:10:32 +01:00
parent 330eed2bd6
commit a1a002f9b6
6 changed files with 195 additions and 7 deletions
+10 -2
View File
@@ -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;
}