智能车制作
标题:
求解释卡尔曼滤波算法中几个参数的作用
[打印本页]
作者:
a490854591
时间:
2017-2-15 13:38
标题:
求解释卡尔曼滤波算法中几个参数的作用
static const float Q_angle=0.005,Q_gyro=0.001,R_angle=0.5,dt=0.005;
static const char C_0 = 1;
static float q_bias=0,angle_err=0,PCt_0=0,PCt_1=0,E=0,K_0=0,K_1=0,t_0=0,t_1=0;
static float P[2][2] = {
{ 1, 0 },
{ 0, 1 }
};
static float Pdot[4] ={0,0,0,0};
void Kalman_Filter(float angle_m,float gyro_m) //gyro_m:gyro_measure
{
attitudeTemp.angle+=(gyro_m-q_bias) * dt;
Pdot[0]=Q_angle - P[0][1] - P[1][0];
Pdot[1]=- P[1][1];
Pdot[2]=- P[1][1];
Pdot[3]=Q_gyro;
P[0][0] += Pdot[0] * dt;
P[0][1] += Pdot[1] * dt;
P[1][0] += Pdot[2] * dt;
P[1][1] += Pdot[3] * dt;
angle_err = angle_m - attitudeTemp.angle;
PCt_0 = C_0 * P[0][0];
PCt_1 = C_0 * P[1][0];
E = R_angle + C_0 * PCt_0;
K_0 = PCt_0 / E;
K_1 = PCt_1 / E;
t_0 = PCt_0;
t_1 = C_0 * P[0][1];
P[0][0] -= K_0 * t_0;
P[0][1] -= K_0 * t_1;
P[1][0] -= K_1 * t_0;
P[1][1] -= K_1 * t_1;
attitudeTemp.angle += K_0 * angle_err;
q_bias += K_1 * angle_err;
attitudeTemp.angle_dot = gyro_m-q_bias;
}
作者:
a490854591
时间:
2017-2-15 13:39
Q_angle=0.005,Q_gyro=0.001,R_angle=0.5,dt=0.005;这些分别有什么作用?
欢迎光临 智能车制作 (http://111.231.132.190/)
Powered by Discuz! X3.2