![a88175f830488f199def3038cce2124b.png](https://i-blog.csdnimg.cn/blog_migrate/e872383fb7e796b70da421f496ad6856.jpeg)
写在前面
对于卡尔曼滤波,大多数人仅限于会用,很少有人能透彻的理解,而关于卡尔曼滤波中那几个关键参数的调整更是一头雾水。自从写完「深度解析卡尔曼滤波在IMU中的使用」一文,很多朋友咨询卡尔曼滤波的参数到底怎么调整,工作之余总结一下,由于水平有限,错误之处在所难免,欢迎交流指正。
本篇还是以飞控与移动机器人中常用的IMU
芯片MPU6050
为例,详细讲解卡尔曼滤波中那几个关键参数的调整。
源码参考 TKJElectronics/KalmanFilter
Kalman::Kalman() {
/* We will set the variables like so, these can also be tuned by the user */
Q_angle = 0.001f;
Q_bias = 0.003f;
R_measure = 0.03f;
angle = 0.0f; // Reset the angle
bias = 0.0f; // Reset bias
P[0][0] = 0.0f; // Since we assume that the bias is 0 and we know the starting angle (use setAngle), the error covariance matrix is set like so - see: http://en.wikipedia.org/wiki/Kalman_filter#Example_application.2C_technical
P[0][1] = 0.0f;
P[1][0] = 0.0f;
P[1][1] = 0.0f;
};
// The angle should be in degrees and the rate should be in degrees per second and the delta time in seconds
float Kalman::getAngle(float newAngle, float newRate, float dt) {
// KasBot V2 - Kalman filter module - http://www.x-firm.com/?page_id=145
// Modified by Kristian Lauszus
// See my blog post for more information: http://blog.tkjelectronics.dk/2012/09/a-practical-approach-to-kalman-filter-and-how-to-implement-it
//