diff --git a/msg/versioned/VehicleStatus.msg b/msg/versioned/VehicleStatus.msg index 856e1a80e3..a42b4edc8f 100644 --- a/msg/versioned/VehicleStatus.msg +++ b/msg/versioned/VehicleStatus.msg @@ -40,7 +40,7 @@ uint8 NAVIGATION_STATE_AUTO_MISSION = 3 # Auto mission mode uint8 NAVIGATION_STATE_AUTO_LOITER = 4 # Auto loiter mode uint8 NAVIGATION_STATE_AUTO_RTL = 5 # Auto return to launch mode uint8 NAVIGATION_STATE_POSITION_SLOW = 6 -uint8 NAVIGATION_STATE_AUTO_RTL_DR = 7 # Auto dead-reckoning return to launch mode +uint8 NAVIGATION_STATE_AUTO_RTL_DEAD_RECKONING = 7 # Auto dead-reckoning return to launch mode uint8 NAVIGATION_STATE_FREE4 = 8 uint8 NAVIGATION_STATE_FREE3 = 9 uint8 NAVIGATION_STATE_ACRO = 10 # Acro mode diff --git a/src/lib/modes/ui.hpp b/src/lib/modes/ui.hpp index 014fad4c87..84744a180f 100644 --- a/src/lib/modes/ui.hpp +++ b/src/lib/modes/ui.hpp @@ -52,7 +52,7 @@ static inline uint32_t getValidNavStates() (1u << vehicle_status_s::NAVIGATION_STATE_AUTO_LOITER) | (1u << vehicle_status_s::NAVIGATION_STATE_AUTO_RTL) | (1u << vehicle_status_s::NAVIGATION_STATE_POSITION_SLOW) | - (1u << vehicle_status_s::NAVIGATION_STATE_AUTO_RTL_DR) | + (1u << vehicle_status_s::NAVIGATION_STATE_AUTO_RTL_DEAD_RECKONING) | (1u << vehicle_status_s::NAVIGATION_STATE_ACRO) | (1u << vehicle_status_s::NAVIGATION_STATE_TERMINATION) | (1u << vehicle_status_s::NAVIGATION_STATE_OFFBOARD) | diff --git a/src/modules/commander/ModeUtil/control_mode.cpp b/src/modules/commander/ModeUtil/control_mode.cpp index 8a2003bc3b..f5037f3cb6 100644 --- a/src/modules/commander/ModeUtil/control_mode.cpp +++ b/src/modules/commander/ModeUtil/control_mode.cpp @@ -106,7 +106,7 @@ void getVehicleControlMode(uint8_t nav_state, uint8_t vehicle_type, vehicle_control_mode.flag_control_allocation_enabled = true; break; - case vehicle_status_s::NAVIGATION_STATE_AUTO_RTL_DR: + case vehicle_status_s::NAVIGATION_STATE_AUTO_RTL_DEAD_RECKONING: case vehicle_status_s::NAVIGATION_STATE_DESCEND: vehicle_control_mode.flag_control_auto_enabled = true; vehicle_control_mode.flag_control_climb_rate_enabled = true; diff --git a/src/modules/commander/ModeUtil/mode_requirements.cpp b/src/modules/commander/ModeUtil/mode_requirements.cpp index a29d54fd02..dce155e62a 100644 --- a/src/modules/commander/ModeUtil/mode_requirements.cpp +++ b/src/modules/commander/ModeUtil/mode_requirements.cpp @@ -133,11 +133,11 @@ void getModeRequirements(uint8_t vehicle_type, failsafe_flags_s &flags) setRequirement(vehicle_status_s::NAVIGATION_STATE_AUTO_RTL, flags.mode_req_home_position); setRequirement(vehicle_status_s::NAVIGATION_STATE_AUTO_RTL, flags.mode_req_prevent_arming); - // NAVIGATION_STATE_AUTO_RTL_DR - setRequirement(vehicle_status_s::NAVIGATION_STATE_AUTO_RTL_DR, flags.mode_req_angular_velocity); - setRequirement(vehicle_status_s::NAVIGATION_STATE_AUTO_RTL_DR, flags.mode_req_attitude); - setRequirement(vehicle_status_s::NAVIGATION_STATE_AUTO_RTL_DR, flags.mode_req_local_alt); - setRequirement(vehicle_status_s::NAVIGATION_STATE_AUTO_RTL_DR, flags.mode_req_prevent_arming); + // NAVIGATION_STATE_AUTO_RTL_DEAD_RECKONING + setRequirement(vehicle_status_s::NAVIGATION_STATE_AUTO_RTL_DEAD_RECKONING, flags.mode_req_angular_velocity); + setRequirement(vehicle_status_s::NAVIGATION_STATE_AUTO_RTL_DEAD_RECKONING, flags.mode_req_attitude); + setRequirement(vehicle_status_s::NAVIGATION_STATE_AUTO_RTL_DEAD_RECKONING, flags.mode_req_local_alt); + setRequirement(vehicle_status_s::NAVIGATION_STATE_AUTO_RTL_DEAD_RECKONING, flags.mode_req_prevent_arming); // NAVIGATION_STATE_ACRO setRequirement(vehicle_status_s::NAVIGATION_STATE_ACRO, flags.mode_req_angular_velocity); diff --git a/src/modules/commander/failsafe/framework.cpp b/src/modules/commander/failsafe/framework.cpp index a57c8f033a..3ed2d91639 100644 --- a/src/modules/commander/failsafe/framework.cpp +++ b/src/modules/commander/failsafe/framework.cpp @@ -572,10 +572,10 @@ void FailsafeBase::getSelectedAction(const State &state, const failsafe_flags_s returned_state.cause = Cause::Generic; // fallthrough - case Action::DeadReckonRTL: - if (modeCanRun(status_flags, vehicle_status_s::NAVIGATION_STATE_AUTO_RTL_DR) + case Action::DeadReckoningRTL: + if (modeCanRun(status_flags, vehicle_status_s::NAVIGATION_STATE_AUTO_RTL_DEAD_RECKONING) && _param_com_pos_fs_act.get() == 1) { - selected_action = Action::DeadReckonRTL; + selected_action = Action::DeadReckoningRTL; break; } @@ -681,7 +681,7 @@ uint8_t FailsafeBase::modeFromAction(const Action &action, uint8_t user_intended case Action::RTL: return vehicle_status_s::NAVIGATION_STATE_AUTO_RTL; - case Action::DeadReckonRTL: return vehicle_status_s::NAVIGATION_STATE_AUTO_RTL_DR; + case Action::DeadReckoningRTL: return vehicle_status_s::NAVIGATION_STATE_AUTO_RTL_DEAD_RECKONING; case Action::Land: return vehicle_status_s::NAVIGATION_STATE_AUTO_LAND; diff --git a/src/modules/commander/failsafe/framework.h b/src/modules/commander/failsafe/framework.h index 3277efce47..fbcdaea3c3 100644 --- a/src/modules/commander/failsafe/framework.h +++ b/src/modules/commander/failsafe/framework.h @@ -61,7 +61,7 @@ public: Hold, RTL, - DeadReckonRTL, + DeadReckoningRTL, Land, Descend, Disarm, @@ -106,7 +106,7 @@ public: case Action::RTL: return "RTL"; - case Action::DeadReckonRTL: return "Dead Reckoning RTL"; + case Action::DeadReckoningRTL: return "Dead Reckoning RTL"; case Action::Land: return "Land"; diff --git a/src/modules/commander/px4_custom_mode.h b/src/modules/commander/px4_custom_mode.h index 2d7c0a8342..895dcd859c 100644 --- a/src/modules/commander/px4_custom_mode.h +++ b/src/modules/commander/px4_custom_mode.h @@ -228,7 +228,7 @@ static inline union px4_custom_mode get_px4_custom_mode(uint8_t nav_state) custom_mode.sub_mode = PX4_CUSTOM_SUB_MODE_EXTERNAL8; break; - case vehicle_status_s::NAVIGATION_STATE_AUTO_RTL_DR: + case vehicle_status_s::NAVIGATION_STATE_AUTO_RTL_DEAD_RECKONING: custom_mode.main_mode = PX4_CUSTOM_MAIN_MODE_AUTO; custom_mode.sub_mode = PX4_CUSTOM_SUB_MODE_AUTO_RTL_DR; break; diff --git a/src/modules/flight_mode_manager/FlightModeManager.cpp b/src/modules/flight_mode_manager/FlightModeManager.cpp index 13f1a666cc..4f19a2ea41 100644 --- a/src/modules/flight_mode_manager/FlightModeManager.cpp +++ b/src/modules/flight_mode_manager/FlightModeManager.cpp @@ -154,7 +154,8 @@ void FlightModeManager::start_flight_task() bool task_failure = false; const bool nav_state_descend = (_vehicle_status_sub.get().nav_state == vehicle_status_s::NAVIGATION_STATE_DESCEND); - const bool nav_state_rtl_dr = (_vehicle_status_sub.get().nav_state == vehicle_status_s::NAVIGATION_STATE_AUTO_RTL_DR); + const bool nav_state_rtl_dr = (_vehicle_status_sub.get().nav_state == + vehicle_status_s::NAVIGATION_STATE_AUTO_RTL_DEAD_RECKONING); // Follow me if (_vehicle_status_sub.get().nav_state == vehicle_status_s::NAVIGATION_STATE_AUTO_FOLLOW_TARGET) {