-
Notifications
You must be signed in to change notification settings - Fork 0
/
design_EKF
85 lines (60 loc) · 1.63 KB
/
design_EKF
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
X_0=[x,y,z,vx,vy,vz]'
y_0=[ul_0,vl_0,ur_0,vr_0]'
A = [1 0 0 delt_T 0 0 ;
0 1 0 0 delt_T 0 ;
0 0 1 0 0 delt_T ;
0 0 0 1 0 0 ;
0 0 0 0 1 0 ;
0 0 0 0 0 1 ] ;
R = [1 0 0 0 ;
0 1 0 0 ;
0 0 1 0 ;
0 0 0 1 ;];
Q = [1 0 0 0 0 0;
0 1 0 0 0 0;
0 0 1 0 0 0;
0 0 0 0.001 0 0;
0 0 0 0 0.001 0;
0 0 0 0 0 0.001];
p_0 = [0.1 0 0 0 0 0;
0 0.1 0 0 0 0;
0 0 0.1 0 0 0;
0 0 0 0.1 0 0;
0 0 0 0 0.1 0;
0 0 0 0 0 0.1];
当前时刻 k,上一时刻,k-1
ekf初始
根据前两帧的x,y,z估计 k-1时刻的vx,vy,vz
vx = x[1]-x[0];
vy = y[1]-y[0];
vz = z[1]-z[0];
(1)状态更新
if ID ==1 {};//第一帧不更新
else
{
读取 Y(k)(TT时刻)
e = Y(k) - y(k)
X(k) = x(k)+K(k-1)e
}
(2)协方差阵更新
if ID ==1 {};//第一帧不更新
else
P=[I-KH]P
(3)状态一步预测
X = FX
(4)协方差阵预测
P = FPF(T)+Q;
(5)滤波增益矩阵
H 雅克比矩阵求出:
//
//
//
//
//
K = PH(T)[HPH(T)+R](-1)
(6)ROI区域估计
y(k)
[ul_p,vl_p,ur_p,vr_p]=h(x,y,z) (TT时刻)
保存到文档
返回跟踪算法
(延时20ms)