Navigator: clean up get_rtl_type()

Signed-off-by: Silvan Fuhrer <silvan@auterion.com>
This commit is contained in:
Silvan Fuhrer
2021-10-22 16:35:32 +02:00
committed by Roman Bapst
parent 8dc6d5f208
commit a012f01dbc
4 changed files with 7 additions and 8 deletions
+1 -2
View File
@@ -286,8 +286,7 @@ public:
float get_mission_landing_alt() { return _mission.get_landing_alt(); }
// RTL
bool mission_landing_required() { return _rtl.rtl_type() == RTL::RTL_LAND; }
int rtl_type() { return _rtl.rtl_type(); }
bool mission_landing_required() { return _rtl.get_rtl_type() == RTL::RTL_LAND; }
bool in_rtl_state() const { return _vstatus.nav_state == vehicle_status_s::NAVIGATION_STATE_AUTO_RTL; }
bool abort_landing();
+2 -2
View File
@@ -573,11 +573,11 @@ Navigator::run()
const bool rtl_activated = _previous_nav_state != vehicle_status_s::NAVIGATION_STATE_AUTO_RTL;
switch (rtl_type()) {
switch (_rtl.get_rtl_type()) {
case RTL::RTL_LAND: // use mission landing
case RTL::RTL_CLOSEST:
if (rtl_activated) {
if (rtl_type() == RTL::RTL_LAND) {
if (_rtl.get_rtl_type() == RTL::RTL_LAND) {
mavlink_log_info(get_mavlink_log_pub(), "RTL LAND activated\t");
events::send(events::ID("navigator_rtl_landing_activated"), events::Log::Info, "RTL activated");
+3 -3
View File
@@ -116,7 +116,7 @@ void RTL::find_RTL_destination()
// consider the mission landing if not RTL_HOME type set
if (rtl_type() != RTL_HOME && _navigator->get_mission_start_land_available()) {
if (_param_rtl_type.get() != RTL_HOME && _navigator->get_mission_start_land_available()) {
double mission_landing_lat;
double mission_landing_lon;
float mission_landing_alt;
@@ -138,7 +138,7 @@ void RTL::find_RTL_destination()
double dist_squared = coord_dist_sq(dlat, dlon);
// set destination to mission landing if closest or in RTL_LAND or RTL_MISSION (so not in RTL_CLOSEST)
if (dist_squared < min_dist_squared || rtl_type() != RTL_CLOSEST) {
if (dist_squared < min_dist_squared || _param_rtl_type.get() != RTL_CLOSEST) {
min_dist_squared = dist_squared;
_destination.lat = mission_landing_lat;
_destination.lon = mission_landing_lon;
@@ -148,7 +148,7 @@ void RTL::find_RTL_destination()
}
// do not consider rally point if RTL type is set to RTL_MISSION, so exit function and use either home or mission landing
if (rtl_type() == RTL_MISSION) {
if (_param_rtl_type.get() == RTL_MISSION) {
return;
}
+1 -1
View File
@@ -91,7 +91,7 @@ public:
void set_return_alt_min(bool min) { _rtl_alt_min = min; }
int rtl_type() const { return _param_rtl_type.get(); }
int get_rtl_type() const { return _param_rtl_type.get(); }
int rtl_destination();