您现在的位置是:首页 >其他 >2D平面机器人运动ESKF过程相关方程推导网站首页其他

2D平面机器人运动ESKF过程相关方程推导

weixin_43409736 2024-07-23 00:01:02
简介2D平面机器人运动ESKF过程相关方程推导

2D平面运动相关状态量及符号约定

机器人(Robot)状态:世界系下位置(Positon)记为 P R = ∣ x R y R ∣ P_R=egin{vmatrix} x_R \ y_R end{vmatrix} PR= xRyR ,世界系下航向(orientation)记为 Φ Phi Φ;
路标点(Landmark)状态:世界系下位置(Postion)记为 P L = ∣ x L y L ∣ P_L=egin{vmatrix} x_L\ y_L end{vmatrix} PL= xLyL ;
约定:
真实状态(true state)表示为: P R , Φ R , P L P_R, Phi _R, P_L PR,ΦR,PL;
名义状态(nominal state)表示为: P ^ R , Φ ^ R , P ^ L hat{P}_R, hat{Phi} _R, hat{P}_L P^R,Φ^R,P^L;
误差状态(error state)表示为: P ~ R , Φ ~ R , P ~ L widetilde{P}_R, widetilde{Phi} _R, widetilde{P}_L P R,Φ R,P L;
二维旋转矩阵:记为 C ( ⋅ ) C(cdot) C(),则对于yaw角 Φ Phi Φ,有:
C ( Φ ) = [ c o s Φ − s i n Φ s i n Φ c o s Φ ] (1) C(Phi) = egin{bmatrix} cosPhi & -sinPhi\ sinPhi& cosPhi end{bmatrix} ag{1} C(Φ)=[cosΦsinΦsinΦcosΦ](1)
旋转矩阵的转置:
C T ( Φ ) = [ c o s Φ − s i n Φ s i n Φ c o s Φ ] (2) C^T(Phi) = egin{bmatrix} cosPhi & -sinPhi\ sinPhi& cosPhi end{bmatrix} ag{2} CT(Φ)=[cosΦsinΦsinΦcosΦ](2)
记系数矩阵:
J = [ 0 − 1 1 0 ] (3) J = egin{bmatrix} 0 & -1 \ 1& 0 end{bmatrix} ag{3} J=[0110](3)
根据求导法则,有:
旋转矩阵的导数:
C ′ ( Φ ) = J C ( Φ ) (4) C'(Phi) = JC(Phi) ag{4} C(Φ)=JC(Φ)(4)
旋转矩阵转置的导数:
C T ′ ( Φ ) = − J C T ( Φ ) (5) {C^T}'(Phi) = -JC^T(Phi) ag{5} CT(Φ)=JCT(Φ)(5)

卡尔曼滤波器(Kalman Filter)方程的一般形式

假设有 k k k时刻状态量,由非线性传播函数 g ( ⋅ ) g(cdot) g()可以递推 k + 1 k+1 k+1时刻的状态量,传播函数所需输入记为 u u u,则有:
X k + 1 = g ( X k , u ) (6) X_{k+1} = g(X_k, u) ag{6} Xk+1=g(Xk,u)(6)
由于 g ( ⋅ ) g(cdot) g()是非线性的,而卡尔曼滤波器要求在线性系统中递推,因此,需要对 g ( X k , u ) g(X_k, u) g(Xk,u)进行线性化展开,使得:
X k + 1 = F X k + A u (7) X_{k+1} = FX_k + Au ag{7} Xk+1=FXk+Au(7)
这里的 F F F A A A均为与状态量 X X X u u u无关的矩阵,此外卡尔曼滤波器假设传感器的噪声是服从高斯分布的,这里假设 X k ∼ ( 0 , P k ) X_ksim(0, P_k) Xk(0,Pk) u ∼ ( 0 , R ) usim(0, R) u(0,R),根据高斯分布的线性递推方程:
X k + 1 ∼ ( 0 , F P k F T + R ) (8) X_{k+1}sim(0, FP_kF^T+R) ag{8} Xk+1(0,FPkFT+R)(8)
对于非线性观测方程 h ( ⋅ ) h(cdot) h()也需要进行类似地线性展开,使得 k + 1 k+1 k+1时刻的状态量 z k + 1 z_{k+1} zk+1 k k k时刻状态量 z k z_k zk呈线性关系即:
z k + 1 = H X k + 1 ∣ k + v (9) z_{k+1}=HX_{k+1|k}+v ag{9} zk+1=HXk+1∣k+v(9)
其中 v v v表示测量噪声。

对于误差状态的卡尔曼滤波器(Error State Kalman Filter)其状态量为 X ~ widetilde{X} X ,因此,需要推导与 X ~ k widetilde{X}_k X k X ~ k + 1 widetilde{X}_{k+1} X k+1相关的线性化传播方程以及测量方程。

2D平面机器人运动ESKF过程推导

误差传播状态方程推导

设,从 k k k时刻到 k + 1 k+1 k+1时刻,机器人的真实状态(true state)变化量记为 ( P k + 1 k , Φ k + 1 k ) ({P}^k_{k+1}, Phi^k_{k+1}) (Pk+1k,Φk+1k),路标点位置是在世界系下的位置是固定的,则有:

true state对应的传播方程:

P R k + 1 = P R k + C ( Φ R k ) P k + 1 k Φ R k + 1 = Φ R k + Φ k + 1 k P L k + 1 = P L k egin{align*} P_{R_k+1} &= P_{R_k} + C(Phi_{R_k})P^k_{k+1} ag{10}\ Phi _{R_k+1} &= Phi_{R_k} + Phi^k_{k+1} ag{11}\ P_{L_k+1} &= P_{L_k} ag{12} end{align*} PRk+1ΦRk+1PLk+1=PRk+C(ΦRk)Pk+1k=ΦRk+Φk+1k=PLk(10)(11)(12)

nominal state对应的传播方程:

P ^ R k + 1 = P ^ R k + C ( Φ ^ R k ) P ^ k + 1 k Φ ^ R k + 1 = Φ ^ R k + Φ ^ k + 1 k P ^ L k + 1 = P ^ L k egin{align*} hat{P}_{R_k+1} &= hat{P}_{R_k} + C(hat{Phi}_{R_k})hat{P}^k_{k+1} ag{13}\ hat{Phi}_{R_k+1} &= hat{Phi}_{R_k} + hat{Phi}^k_{k+1} ag{14}\ hat{P}_{L_k+1} &= hat{P}_{L_k} ag{15} end{align*} P^Rk+1Φ^Rk+1P^Lk+1=P^Rk+C(Φ^Rk)P^k+1k=Φ^Rk+Φ^k+1k=P^Lk(13)(14)(15)
由于:
X ~ = X − X ^ (16) widetilde{X} = X - hat{X} ag{16} X =XX^(16)
则:

error state对应的传播方程:

P ~ R k + 1 = P ~ R k + C ( Φ R k ) P k + 1 k − C ( Φ ^ R k ) P ^ k + 1 k Φ ~ R k + 1 = Φ ~ R k + Φ ~ k + 1 k P ~ L k + 1 = P ~ L k egin{align*} widetilde{P}_{R_k+1} &= widetilde{P}_{R_k} + C(Phi_{R_k})P^k_{k+1} - C(hat{Phi}_{R_k})hat{P}^k_{k+1} ag{17}\ widetilde{Phi} _{R_k+1} &= widetilde{Phi}_{R_k} + widetilde{Phi}^k_{k+1} ag{18}\ widetilde{P}_{L_k+1} &= widetilde{P}_{L_k} ag{19} end{align*} P Rk+1Φ Rk+1P Lk+1=P Rk+C(ΦRk)Pk+1kC(Φ^Rk)P^k+1k=Φ Rk+Φ k+1k=P Lk(17)(18)(19)
由于Robot状态量 X R = ∣ x R y R Φ ∣ X_R = egin{vmatrix} x_R \ y_R \ Phiend{vmatrix} XR= xRyRΦ ,所以公式 ( 17 ) (17) (17)是非线性的,需要对其进行线性化展开,展开点在 X ^ R hat{X}_R X^R
P ~ R k + 1 = P ~ R k + C ( Φ R k ) P k + 1 k − C ( Φ ^ R k ) P ^ k + 1 k = P ~ R k + C ( Φ R k ) P k + 1 k − C ( Φ ^ R k ) ( P k + 1 k − P ~ k + 1 k ) = P ~ R k + ( C ( Φ R k ) − C ( Φ ^ R k ) ) P k + 1 k + C ( Φ ^ ) P ~ k + 1 k ≈ P ~ R k + J C ( Φ ^ R k ) Φ ~ R k P k + 1 k + C ( Φ ^ ) P ~ k + 1 k ≈ P ~ R k + C ( Φ ^ ) P ~ k + 1 k + J C ( Φ ^ R k ) P ^ k + 1 k Φ ~ R k egin{align*} widetilde{P}_{R_k+1} &= widetilde{P}_{R_k} + C(Phi_{R_k})P^k_{k+1} - C(hat{Phi}_{R_k})hat{P}^k_{k+1}\ &=widetilde{P}_{R_k}+C(Phi_{R_k})P^k_{k+1}-C(hat{Phi}_{R_k})(P^k_{k+1}-widetilde{P}^k_{k+1})\ &=widetilde{P}_{R_k}+(C(Phi_{R_k})-C(hat{Phi}_{R_k}))P^k_{k+1}+C(hat{Phi})widetilde{P}^k_{k+1}\ &approxwidetilde{P}_{R_k}+JC( hat{Phi}_{R_k}) widetilde{Phi}_{R_k}P^k_{k+1}+C(hat{Phi})widetilde{P}^k_{k+1}\ &approxwidetilde{P}_{R_k}+C(hat{Phi})widetilde{P}^k_{k+1}+JC( hat{Phi}_{R_k}) hat{P}^k_{k+1}widetilde{Phi}_{R_k} ag{20} end{align*} P Rk+1=P Rk+C(ΦRk)Pk+1kC(Φ^Rk)P^k+1k=P Rk+C(ΦRk)Pk+1kC(Φ^Rk)(Pk+1kP k+1k)=P Rk+(C(ΦRk)C(Φ^Rk))Pk+1k+C(Φ^)P k+1kP Rk+JC(Φ^Rk)Φ RkPk+1k+C(Φ^)P k+1kP Rk+C(Φ^)P k+1k+JC(Φ^Rk)P^k+1kΦ Rk(20)
误差状态传播函数经过线性化展开后,有:
X ~ k + 1 = ∣ I 2 J C ( Φ ^ R k ) P ^ k + 1 k 0 1 × 2 1 ∣ × ∣ P ~ R k P ~ L k ∣ + ∣ C ( Φ ^ ) 0 0 1 × 2 1 ∣ × ∣ P ~ k + 1 k Φ ~ k + 1 k ∣ = ∣ I 2 J C ( Φ ^ R k ) P ^ k + 1 k 0 1 × 2 1 ∣ X ~ k + ∣ C ( Φ ^ ) 0 0 1 × 2 1 ∣ X ~ k + 1 k egin{align*} widetilde{X}_{k+1} &= egin{vmatrix} I_2& JC( hat{Phi}_{R_k}) hat{P}^k_{k+1}\ extbf{0}_{1 imes2}&1 end{vmatrix} imesegin{vmatrix} widetilde{P}_{R_k} \ widetilde{P}_{L_k} end{vmatrix}+egin{vmatrix} C(hat{Phi}) & extbf{0} \ extbf{0}_{1 imes2} & 1 end{vmatrix} imesegin{vmatrix} widetilde{P}^k_{k+1}\ widetilde{Phi}^k_{k+1} end{vmatrix} \ &= egin{vmatrix} I_2& JC( hat{Phi}_{R_k}) hat{P}^k_{k+1}\ extbf{0}_{1 imes2}&1 end{vmatrix}widetilde{X}_k+egin{vmatrix} C(hat{Phi}) & extbf{0} \ extbf{0}_{1 imes2} & 1 end{vmatrix}widetilde{X}^k_{k+1} ag {21} end{align*} X k+1= I201×2JC(Φ^Rk)P^k+1k1 × P RkP Lk + C(Φ^)01×201 × P k+1kΦ k+1k = I201×2JC(Φ^Rk)P^k+1k1 X k+ C(Φ^)01×201 X k+1k(21)

误差观测方程推导

对于世界坐标系下一点 P L P_L PL,将其变换到机器人坐标系下一点 P R P_R PR的观测方程为:
P R = C T ( Φ R k + 1 ∣ k ) ( P L − P R k + 1 ∣ k ) (22) P_R = C^T(Phi_{R_{k+1|k}})(P_L-P_{R_{k+1|k}}) ag{22} PR=CT(ΦRk+1∣k)(PLPRk+1∣k)(22)
那么,机器人在真实状态(true state)下时,有观测方程:
z = C T ( Φ R k + 1 ∣ k ) ( P L − P R k + 1 ∣ k ) + v (23) z = C^T(Phi_{R_{k+1|k}})(P_L-P_{R_{k+1|k}})+v ag{23} z=CT(ΦRk+1∣k)(PLPRk+1∣k)+v(23)
机器人在名义状态(nominal state)下时,有观测方程:
z ^ = C T ( Φ ^ R k + 1 ∣ k ) ( P L ^ − P ^ R k + 1 ∣ k ) (24) hat{z} = C^T(hat{Phi}_{R_{k+1|k}})(hat{P_L}-hat{P}_{R_{k+1|k}}) ag{24} z^=CT(Φ^Rk+1∣k)(PL^P^Rk+1∣k)(24)
那么误差状态(error state)方程由式 ( 23 ) − ( 24 ) (23)-(24) (23)(24)得到:
z ~ = C T ( Φ R k + 1 ∣ k ) ( P L − P R k + 1 ∣ k ) − C T ( Φ ^ R k + 1 ∣ k ) ( P L ^ − P ^ R k + 1 ∣ k ) + v = C T ( Φ R k + 1 ∣ k ) ( P L − P R k + 1 ∣ k ) − C T ( Φ ^ R k + 1 ∣ k ) ( P L − P ~ L − P R k + 1 ∣ k + P ~ R k + 1 ∣ k ) + v = ( C T ( Φ R k + 1 ∣ k ) − C T ( Φ ^ R k + 1 ∣ k ) ) ( P L − P R k + 1 ∣ k ) + C T ( Φ ^ R k + 1 ∣ k ) ( P ~ L − P ~ R k + 1 ∣ k ) + v ≈ − J C T ( Φ ^ R k + 1 ∣ k ) ( P L − P R k + 1 ∣ k ) Φ ~ R k + 1 ∣ k + C T ( Φ ^ R k + 1 ∣ k ) P ~ L − C T ( Φ ^ R k + 1 ∣ k ) P ~ R k + 1 ∣ k + v ≈ − J C T ( Φ ^ R k + 1 ∣ k ) ( P ^ L − P ^ R k + 1 ∣ k ) Φ ~ R k + 1 ∣ k + C T ( Φ ^ R k + 1 ∣ k ) P ~ L − C T ( Φ ^ R k + 1 ∣ k ) P ~ R k + 1 ∣ k + v egin{align*} widetilde{z} &= C^T(Phi_{R_{k+1|k}})(P_L-P_{R_{k+1|k}})-C^T(hat{Phi}_{R_{k+1|k}})(hat{P_L}-hat{P}_{R_{k+1|k}})+v\ &=C^T(Phi_{R_{k+1|k}})(P_L-P_{R_{k+1|k}})-C^T(hat{Phi}_{R_{k+1|k}})(P_L- widetilde{P}_L-P_{R_{k+1|k}}+widetilde{P}_{R_{k+1|k}})+v\ &=(C^T(Phi_{R_{k+1|k}})-C^T(hat{Phi}_{R_{k+1|k}}))(P_L-P_{R_{k+1|k}})+C^T(hat{Phi}_{R_{k+1|k}})(widetilde{P}_L-widetilde{P}_{R_{k+1|k}})+v\ &approx-JC^T(hat{Phi}_{R_{k+1|k}})(P_L-P_{R_{k+1|k}})widetilde{Phi}_{R_{k+1|k}}+C^T(hat{Phi}_{R_{k+1|k}})widetilde{P}_L-C^T(hat{Phi}_{R_{k+1|k}})widetilde{P}_{R_{k+1|k}}+v\ &approx-JC^T(hat{Phi}_{R_{k+1|k}})(hat{P}_L-hat{P}_{R_{k+1|k}})widetilde{Phi}_{R_{k+1|k}}+C^T(hat{Phi}_{R_{k+1|k}})widetilde{P}_L-C^T(hat{Phi}_{R_{k+1|k}})widetilde{P}_{R_{k+1|k}}+v ag{25} end{align*} z =CT(ΦRk+1∣k)(PLPRk+1∣k)CT(Φ^Rk+1∣k)(PL^P^Rk+1∣k)+v=CT(ΦRk+1∣k)(PLPRk+1∣k)CT(Φ^Rk+1∣k)(PLP LPRk+1∣k+P Rk+1∣k)+v=(CT(ΦRk+1∣k)CT(Φ^Rk+1∣k))(PLPRk+1∣k)+CT(Φ^Rk+1∣k)(P LP Rk+1∣k)+vJCT(Φ^Rk+1∣k)(PLPRk+1∣k)Φ Rk+1∣k+CT(Φ^Rk+1∣k)P LCT(Φ^Rk+1∣k)P Rk+1∣k+vJCT(Φ^Rk+1∣k)(P^LP^Rk+1∣k)Φ Rk+1∣k+CT(Φ^Rk+1∣k)P LCT(Φ^Rk+1∣k)P Rk+1∣k+v(25)
25 25 25写成线性矩阵的形式有:
z ~ = ∣ − C T ( Φ ^ R k + 1 ∣ k ) − J C T ( Φ ^ R k + 1 ∣ k ) ( P ^ L − P ^ R k + 1 ∣ k ) C T ( Φ ^ R k + 1 ∣ k ) ∣ × ∣ P ~ R k + 1 ∣ k Φ ~ R k + 1 ∣ k P ~ L ∣ + v = C T ( Φ ^ R k + 1 ∣ k ) ∣ − I 2 − J ( P ^ L − P ^ R k + 1 ∣ k ) I 2 ∣ × ∣ X ~ k ∣ k + 1 P ~ L ∣ + v egin{align*} widetilde{z} &= egin{vmatrix} -C^T(hat{Phi}_{R_{k+1|k}}) & -JC^T(hat{Phi}_{R_{k+1|k}})(hat{P}_L-hat{P}_{R_{k+1|k}}) & C^T(hat{Phi}_{R_{k+1|k}}) end{vmatrix} imesegin{vmatrix} widetilde{P}_{R_{k+1|k}}\ widetilde{Phi}_{R_{k+1|k}}\ widetilde{P}_L\ end{vmatrix}+v\ &=C^T(hat{Phi}_{R_{k+1|k}})egin{vmatrix} - extbf{I}_2 & -J(hat{P}_L-hat{P}_{R_{k+1|k}}) & extbf{I}_2 end{vmatrix} imesegin{vmatrix} widetilde{X}_{k|k+1}\ widetilde{P}_L end{vmatrix}+v ag{26} end{align*} z = CT(Φ^Rk+1∣k)JCT(Φ^Rk+1∣k)(P^LP^Rk+1∣k)CT(Φ^Rk+1∣k) × P Rk+1∣kΦ Rk+1∣kP L +v=CT(Φ^Rk+1∣k) I2J(P^LP^Rk+1∣k)I2 × X kk+1P L +v(26)
至此我们推导了误差状态传播方程和观测方程的线性表达式,后续按照卡尔曼滤波器的一般过程即可。

风语者!平时喜欢研究各种技术,目前在从事后端开发工作,热爱生活、热爱工作。