Browse Source

RTL: rename enum names for RTLType

Signed-off-by: Silvan Fuhrer <silvan@auterion.com>
master
Silvan Fuhrer 3 years ago committed by Roman Bapst
parent
commit
dd987c08a5
  1. 2
      src/modules/navigator/navigator.h
  2. 8
      src/modules/navigator/navigator_main.cpp
  3. 12
      src/modules/navigator/rtl.cpp
  4. 8
      src/modules/navigator/rtl.h

2
src/modules/navigator/navigator.h

@ -286,7 +286,7 @@ public: @@ -286,7 +286,7 @@ public:
float get_mission_landing_alt() { return _mission.get_landing_alt(); }
// RTL
bool mission_landing_required() { return _rtl.get_rtl_type() == RTL::RTL_LAND; }
bool mission_landing_required() { return _rtl.get_rtl_type() == RTL::RTL_TYPE_MISSION_LANDING; }
bool in_rtl_state() const { return _vstatus.nav_state == vehicle_status_s::NAVIGATION_STATE_AUTO_RTL; }
bool abort_landing();

8
src/modules/navigator/navigator_main.cpp

@ -574,10 +574,10 @@ Navigator::run() @@ -574,10 +574,10 @@ Navigator::run()
const bool rtl_activated = _previous_nav_state != vehicle_status_s::NAVIGATION_STATE_AUTO_RTL;
switch (_rtl.get_rtl_type()) {
case RTL::RTL_LAND: // use mission landing
case RTL::RTL_CLOSEST:
case RTL::RTL_TYPE_MISSION_LANDING: // use mission landing
case RTL::RTL_TYPE_CLOSEST:
if (rtl_activated) {
if (_rtl.get_rtl_type() == RTL::RTL_LAND) {
if (_rtl.get_rtl_type() == RTL::RTL_TYPE_MISSION_LANDING) {
mavlink_log_info(get_mavlink_log_pub(), "RTL LAND activated\t");
events::send(events::ID("navigator_rtl_landing_activated"), events::Log::Info, "RTL activated");
@ -606,7 +606,7 @@ Navigator::run() @@ -606,7 +606,7 @@ Navigator::run()
break;
case RTL::RTL_MISSION:
case RTL::RTL_TYPE_MISSION_LANDING_REVERSED:
if (_mission.get_land_start_available() && !get_land_detected()->landed) {
// the mission contains a landing spot
_mission.set_execution_mode(mission_result_s::MISSION_EXECUTION_MODE_FAST_FORWARD);

12
src/modules/navigator/rtl.cpp

@ -115,8 +115,8 @@ void RTL::find_RTL_destination() @@ -115,8 +115,8 @@ void RTL::find_RTL_destination()
&& _navigator->get_vstatus()->vehicle_type == vehicle_status_s::VEHICLE_TYPE_ROTARY_WING;
// consider the mission landing if not RTL_HOME type set
if (_param_rtl_type.get() != RTL_HOME && _navigator->get_mission_start_land_available()) {
// consider the mission landing if not RTL_TYPE_HOME_ONLY type set
if (_param_rtl_type.get() != RTL_TYPE_HOME_ONLY && _navigator->get_mission_start_land_available()) {
double mission_landing_lat;
double mission_landing_lon;
float mission_landing_alt;
@ -137,8 +137,8 @@ void RTL::find_RTL_destination() @@ -137,8 +137,8 @@ void RTL::find_RTL_destination()
dlon = mission_landing_lon - global_position.lon;
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 || _param_rtl_type.get() != RTL_CLOSEST) {
// set destination to mission landing if closest or in RTL_TYPE_MISSION_LANDING or RTL_TYPE_MISSION_LANDING_REVERSED (so not in RTL_TYPE_CLOSEST)
if (dist_squared < min_dist_squared || _param_rtl_type.get() != RTL_TYPE_CLOSEST) {
min_dist_squared = dist_squared;
_destination.lat = mission_landing_lat;
_destination.lon = mission_landing_lon;
@ -147,8 +147,8 @@ void RTL::find_RTL_destination() @@ -147,8 +147,8 @@ 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 (_param_rtl_type.get() == RTL_MISSION) {
// do not consider rally point if RTL type is set to RTL_TYPE_MISSION_LANDING_REVERSED, so exit function and use either home or mission landing
if (_param_rtl_type.get() == RTL_TYPE_MISSION_LANDING_REVERSED) {
return;
}

8
src/modules/navigator/rtl.h

@ -64,10 +64,10 @@ public: @@ -64,10 +64,10 @@ public:
~RTL() = default;
enum RTLType {
RTL_HOME = 0,
RTL_LAND,
RTL_MISSION,
RTL_CLOSEST,
RTL_TYPE_HOME_ONLY = 0,
RTL_TYPE_MISSION_LANDING,
RTL_TYPE_MISSION_LANDING_REVERSED,
RTL_TYPE_CLOSEST,
};
enum RTLDestinationType {

Loading…
Cancel
Save