mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-03 16:08:53 +08:00
modeCheck: add warning when RC enabled but not present
This commit is contained in:
@@ -246,6 +246,8 @@ public:
|
|||||||
void armingCheckFailure(NavModes required_modes, HealthComponentIndex component, uint32_t event_id,
|
void armingCheckFailure(NavModes required_modes, HealthComponentIndex component, uint32_t event_id,
|
||||||
const events::LogLevels &log_levels, const char *message);
|
const events::LogLevels &log_levels, const char *message);
|
||||||
|
|
||||||
|
void clearArmingBits(NavModes modes);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Clear can_run bits for certain modes. This will prevent mode switching and trigger failsafe if the
|
* Clear can_run bits for certain modes. This will prevent mode switching and trigger failsafe if the
|
||||||
* mode is being run.
|
* mode is being run.
|
||||||
@@ -302,8 +304,6 @@ private:
|
|||||||
|
|
||||||
NavModes reportedModes(NavModes required_modes);
|
NavModes reportedModes(NavModes required_modes);
|
||||||
|
|
||||||
void clearArmingBits(NavModes modes);
|
|
||||||
|
|
||||||
NavModes getModeGroup(uint8_t nav_state) const;
|
NavModes getModeGroup(uint8_t nav_state) const;
|
||||||
|
|
||||||
friend class HealthAndArmingChecks;
|
friend class HealthAndArmingChecks;
|
||||||
|
|||||||
@@ -144,6 +144,10 @@ void ModeChecks::checkAndReport(const Context &context, Report &reporter)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (reporter.failsafeFlags().manual_control_signal_lost && reporter.failsafeFlags().mode_req_manual_control != 0) {
|
if (reporter.failsafeFlags().manual_control_signal_lost && reporter.failsafeFlags().mode_req_manual_control != 0) {
|
||||||
|
const bool rc_disabled = (_param_com_rc_in_mode.get() == 4);
|
||||||
|
NavModes nav_modes = rc_disabled ? (NavModes)reporter.failsafeFlags().mode_req_manual_control : NavModes::None;
|
||||||
|
events::LogLevel log_level = rc_disabled ? events::Log::Error : events::Log::Warning;
|
||||||
|
|
||||||
/* EVENT
|
/* EVENT
|
||||||
* @description
|
* @description
|
||||||
* Connect and enable stick input or use autonomous mode.
|
* Connect and enable stick input or use autonomous mode.
|
||||||
@@ -151,10 +155,11 @@ void ModeChecks::checkAndReport(const Context &context, Report &reporter)
|
|||||||
* Sticks can be enabled via <param>COM_RC_IN_MODE</param> parameter.
|
* Sticks can be enabled via <param>COM_RC_IN_MODE</param> parameter.
|
||||||
* </profile>
|
* </profile>
|
||||||
*/
|
*/
|
||||||
reporter.armingCheckFailure((NavModes)reporter.failsafeFlags().mode_req_manual_control,
|
reporter.armingCheckFailure(nav_modes,
|
||||||
health_component_t::remote_control,
|
health_component_t::remote_control,
|
||||||
events::ID("check_modes_manual_control"),
|
events::ID("check_modes_manual_control"),
|
||||||
events::Log::Critical, "No manual control input");
|
log_level, "No manual control input");
|
||||||
|
reporter.clearArmingBits((NavModes)reporter.failsafeFlags().mode_req_manual_control);
|
||||||
reporter.clearCanRunBits((NavModes)reporter.failsafeFlags().mode_req_manual_control);
|
reporter.clearCanRunBits((NavModes)reporter.failsafeFlags().mode_req_manual_control);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -49,6 +49,7 @@ private:
|
|||||||
void checkArmingRequirement(const Context &context, Report &reporter);
|
void checkArmingRequirement(const Context &context, Report &reporter);
|
||||||
|
|
||||||
DEFINE_PARAMETERS_CUSTOM_PARENT(HealthAndArmingCheckBase,
|
DEFINE_PARAMETERS_CUSTOM_PARENT(HealthAndArmingCheckBase,
|
||||||
(ParamBool<px4::params::COM_ARM_MIS_REQ>) _param_com_arm_mis_req
|
(ParamBool<px4::params::COM_ARM_MIS_REQ>) _param_com_arm_mis_req,
|
||||||
|
(ParamInt<px4::params::COM_RC_IN_MODE>) _param_com_rc_in_mode
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user