ardupilot开发 --- EKF 篇

1. EKF1~EKF3

待续…

2. Ardupilot滤波算法的演变

在这里插入图片描述
使用DCM还是EKF?
AHRS_EKF_USE: set to “1” to use the EKF, “0” to use DCM for attitude control and inertial nav (Copter-3.2.1) or ahrs dead reckoning (Plane) for position control. In Copter-3.3 (and higher) this parameter is forced to “1” and cannot be changed.

3. EKF3

  • AHRS_EKF_TYPE = 3
    EK2_ENABLE = 0
    EK3_ENABLE = 1
  • 飞控有多少个IMU就会运行多少个 EKF core 或称 EKF lane
    EK3_IMU_MASK 参数决定哪些IMU用于运行EKF lane.
  • 只有一个EKF lane 被用作飞机的状态估计AHRS,由参数EK3_PRIMARY决定,0 selects the first IMU lane in the EK3_IMU_MASK, 1 the second。这个用作AHRS的EKF3 lane 被称为 primary lane
  • 当 primary lane 出问题(误差很大,innovation大)时就会发生lane切换,即将其他表现正常的 EKF lane 切换为 primary lane,称为 Lane Switching
  • Lane Switching 由传感器的亲和度 EK3_AFFINITY 和错误阈值 EK3_ERR_THRESH 决定。
  • EK3_AFFINITY 和 EK3_ERR_THRESH 如何设置?
    在这里插入图片描述

3.1 例子

某飞控具有:
3 IMUs
1 Barometer
2 GPS
2 Airspeeds
3 Magnetometers
EKF Lane 的传感器分配情况如下:
在这里插入图片描述
原文:Conventionally, each lane uses the primary instance of the Airspeed, Barometer, GPS and Magnetometer sensors.
疑问:3个IMU(Lane)2个GPS,怎么确定哪个Lane使用的是哪个GPS呢??Lane3使用的为什么是GPS1而不是2呢??
去源代码中一探究竟,看看这些传感器是如何被分配给 EKF lanes 的!!
待续…

4. 代码解析

在类中找到

private:
    uint8_t num_cores; // number of allocated cores
    uint8_t primary;   // current primary core
    NavEKF3_core *core = nullptr;

可知 core 肯定是指向了 NavEKF3_core 数组的首地址。
在类的.cpp中寻找 num_cores (因为core和num_cores肯定是关联出现的,找到num_cores就可以找到cores):

// Call constructors on all cores
for (uint8_t i = 0; i < num_cores; i++) {
	new (&core[i]) NavEKF3_core(this);
}

可知 core 就是指向 NavEKF3_core 数组的首地址。
想知道传感器分配情况,就得进入构造函数NavEKF3_core(this)中寻找答案:
待续…

  • 0
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值