|
/** *Imbalanced propeller check threshold * *Value at which the imbalanced propeller metric (based on horizontaland *vertical acceleration variance) triggers a failure * *Setting this value to 0 disables the feature. * *@min 0 *@max 1000 *@increment 1 *@group Failure Detector */ PARAM_DEFINE_INT32(FD_IMB_PROP_THR,30);
/** *Imbalanced propeller failsafe mode * *Action the system takes when an imbalanced propeller is detected bythe failure detector. *See also FD_IMB_PROP_THR to set the failure threshold. * *@group Commander * *@value -1 Disabled *@value 0 Warning *@value 1 Return *@value 2 Land *@increment 1 */ PARAM_DEFINE_INT32(COM_IMB_PROP_ACT,0);
voidFailureDetector::updateImbalancedPropStatus() { //略
constbool is_imbalanced = metric_lpf > _param_fd_imb_prop_thr.get(); _status.flags.imbalanced_prop= is_imbalanced; //略 }
/** *安全飞行数据擦除(SFDE,SecureFlight Data Erasure)功能螺旋桨不平衡故障恢复时间 * *当SFDE_ACT_MASK中启用了【检测到螺旋桨不平衡故障】后,留给故障恢复的时间,超过该时间后则安全飞行数据擦除功能生效。 *本参数修改后实时生效。 * *@unit s *@min 0 *@max 100 *@group Secure Flight Data Erasure */ PARAM_DEFINE_INT32(SFDE_IMBPROP_RCV,60);
voidCommander::run() { //略
while(!should_exit()) {
fd_status.fd_imbalanced_prop= _failure_detector.getStatusFlags().imbalanced_prop; fd_status.fd_motor= _failure_detector.getStatusFlags().motor; fd_status.imbalanced_prop_metric= _failure_detector.getImbalancedPropMetric(); fd_status.motor_failure_mask= _failure_detector.getMotorFailures(); } }
reporter.failsafeFlags().fd_imbalanced_prop= context.status().failure_detector_status & vehicle_status_s::FAILURE_IMBALANCED_PROP;
if(reporter.failsafeFlags().fd_imbalanced_prop) { /*EVENT *@description *Check that all propellers are mounted correctly and are not damaged. * *<profile name="dev"> *This check can be configured via <param>FD_IMB_PROP_THR</param>and <param>COM_IMB_PROP_ACT</param> parameters. *</profile> */ reporter.healthFailure(NavModes::All,health_component_t::system,events::ID("check_failure_detector_imbalanced_prop"), events: og::Critical,"Imbalanced propeller detected");
if(reporter.mavlink_log_pub()) { mavlink_log_critical(reporter.mavlink_log_pub()," reflight Fail: Imbalanced propeller detected"); } }
if(!_erase&& (_act_mask & 0x20)){ // 检测到螺旋桨不平衡故障 if(_failure_detector_status.fd_imbalanced_prop) { if(_failure_imbalanced_prop_timestamp== 0){ _failure_imbalanced_prop_timestamp= now; }
if(hrt_elapsed_time(&_failure_imbalanced_prop_timestamp)> (hrt_abstime)_param_sfde_imbprop_rcv.get() * 1e6){ _erase= true; _reason= 0x10; _erase_cancel= false; mavlink_log_critical(&_mavlink_log_pub,"螺旋桨不平衡故障触发擦除"); _failure_imbalanced_prop_timestamp= 0; } }else{ _failure_imbalanced_prop_timestamp= now; } }
(ParamInt<px4::params::SFDE_IMBPROP_RCV>)_param_sfde_imbprop_rcv,
|