PX4检查位置速度有效性

在Commander::check_posvel_validity函数中检查位置速度有效性

检查项目有3个:

  1. 数据有效性,valid;
  2. 判断距离上一次有效的时间间隔或时间戳是否为0;
  3. 检查精度因子是否达到期望的精度。

最后在加上时间校验。


    // Check accuracy with hysteresis in both test level and time
    if (level_check_pass) {
        if (was_valid) {
            // still valid, continue to decrease probation time
            const int64_t probation_time_new = *probation_time_us - hrt_elapsed_time(last_fail_time_us);
            *probation_time_us = math::constrain(probation_time_new, POSVEL_PROBATION_MIN, POSVEL_PROBATION_MAX);

        } else {
            // check if probation period has elapsed
            if (hrt_elapsed_time(last_fail_time_us) > *probation_time_us) {
                valid = true;
            }
        }

    } else {
        // level check failed
        if (was_valid) {
            // FAILURE! no longer valid
            valid = false;

        } else {
            // failed again, increase probation time
            const int64_t probation_time_new = *probation_time_us + hrt_elapsed_time(last_fail_time_us) * _failsafe_pos_gain.get();
            *probation_time_us = math::constrain(probation_time_new, POSVEL_PROBATION_MIN, POSVEL_PROBATION_MAX);
        }

        *last_fail_time_us = hrt_absolute_time();
    }
 


这个函数用于检测gps、local_position的xy位置、local_position的xy速度有效性,最后再写入status_flags。

参数COM_POS_FS_GAIN:

This sets the rate that the loss of position probation time grows when position checks are failing. The default value has been optimised for rotary wing applications. For fixed wing applications a value of 0 should be used.

参数COM_POS_FS_PROB:

The probation delay is the number of seconds that the EKF innovation checks need to pass for the position to be declared good after it has been declared bad. The probation delay will be reset to this parameter value when takeoff is detected. After takeoff, if position checks are passing, the probation delay will reduce by one second for every lapsed second of valid position down to a minimum of 1 second. If position checks are failing, the probation delay will increase by COM_POS_FS_GAIN seconds for every lapsed second up to a maximum of 100 seconds. The default value has been optimised for rotary wing applications. For fixed wing applications, a value of 1 should be used.

如果信号无效,会一直监测有效性,并增加probation_time_us,最多到100s。

如果信号有效,会一直减小probation_time_us,最小到1s。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值