From 7a2ef4a917870cd380ab45f825e39797978c37ff Mon Sep 17 00:00:00 2001 From: Matthias Grob Date: Thu, 7 Oct 2021 11:58:01 +0200 Subject: [PATCH] Commander: don't publish RC_IN_MODE to vehicle_status This just contains the content of the parameter which is redundant and results in multiple sources of truth. --- msg/vehicle_status.msg | 5 ----- .../commander/Arming/PreFlightCheck/PreFlightCheck.cpp | 5 ++++- src/modules/commander/Commander.cpp | 3 --- src/modules/commander/Commander.hpp | 2 -- 4 files changed, 4 insertions(+), 11 deletions(-) diff --git a/msg/vehicle_status.msg b/msg/vehicle_status.msg index 7285a93721..61b476aa7d 100644 --- a/msg/vehicle_status.msg +++ b/msg/vehicle_status.msg @@ -48,10 +48,6 @@ uint8 NAVIGATION_STATE_AUTO_PRECLAND = 20 # Precision land with landing target uint8 NAVIGATION_STATE_ORBIT = 21 # Orbit in a circle uint8 NAVIGATION_STATE_MAX = 22 -uint8 RC_IN_MODE_DEFAULT = 0 -uint8 RC_IN_MODE_OFF = 1 -uint8 RC_IN_MODE_GENERATED = 2 - uint8 VEHICLE_TYPE_UNKNOWN = 0 uint8 VEHICLE_TYPE_ROTARY_WING = 1 uint8 VEHICLE_TYPE_FIXED_WING = 2 @@ -83,7 +79,6 @@ bool in_transition_mode # True if VTOL is doing a transition bool in_transition_to_fw # True if VTOL is doing a transition from MC to FW bool rc_signal_lost # true if RC reception lost -uint8 rc_input_mode # set to 1 to disable the RC input, 2 to enable manual control to RC in mapping. bool data_link_lost # datalink to GCS lost uint8 data_link_lost_counter # counts unique data link lost events diff --git a/src/modules/commander/Arming/PreFlightCheck/PreFlightCheck.cpp b/src/modules/commander/Arming/PreFlightCheck/PreFlightCheck.cpp index 1c5060324c..5afd1c4e3a 100644 --- a/src/modules/commander/Arming/PreFlightCheck/PreFlightCheck.cpp +++ b/src/modules/commander/Arming/PreFlightCheck/PreFlightCheck.cpp @@ -197,7 +197,10 @@ bool PreFlightCheck::preflightCheck(orb_advert_t *mavlink_log_pub, vehicle_statu } /* ---- RC CALIBRATION ---- */ - if (status.rc_input_mode == vehicle_status_s::RC_IN_MODE_DEFAULT) { + int32_t com_rc_in_mode{0}; + param_get(param_find("COM_RC_IN_MODE"), &com_rc_in_mode); + + if (com_rc_in_mode == 0) { if (rcCalibrationCheck(mavlink_log_pub, report_failures, status.is_vtol) != OK) { if (report_failures) { mavlink_log_critical(mavlink_log_pub, "RC calibration check failed"); diff --git a/src/modules/commander/Commander.cpp b/src/modules/commander/Commander.cpp index f2fcbb1503..7a41fb8b8a 100644 --- a/src/modules/commander/Commander.cpp +++ b/src/modules/commander/Commander.cpp @@ -659,7 +659,6 @@ Commander::Commander() : _status_flags.condition_system_sensors_initialized = true; // We want to accept RC inputs as default - _status.rc_input_mode = vehicle_status_s::RC_IN_MODE_DEFAULT; _status.nav_state = vehicle_status_s::NAVIGATION_STATE_MANUAL; _status.nav_state_timestamp = hrt_absolute_time(); _status.arming_state = vehicle_status_s::ARMING_STATE_INIT; @@ -1840,8 +1839,6 @@ Commander::run() _status_flags.avoidance_system_required = _param_com_obs_avoid.get(); - _status.rc_input_mode = _param_rc_in_off.get(); - _arm_requirements.arm_authorization = _param_arm_auth_required.get(); _arm_requirements.esc_check = _param_escs_checks_required.get(); _arm_requirements.global_position = !_param_arm_without_gps.get(); diff --git a/src/modules/commander/Commander.hpp b/src/modules/commander/Commander.hpp index 61182bfe66..fd25f6a86a 100644 --- a/src/modules/commander/Commander.hpp +++ b/src/modules/commander/Commander.hpp @@ -245,8 +245,6 @@ private: (ParamInt) _param_flight_uuid, (ParamInt) _param_takeoff_finished_action, - (ParamInt) _param_rc_in_off, - // Circuit breakers (ParamInt) _param_cbrk_supply_chk, (ParamInt) _param_cbrk_usb_chk,