激光SLAM后端优化——雅克比矩阵推导
激光SLAM后端優化——雅克比矩陣推導
- Jacobi Matrix
Jacobi Matrix
In the EKF system, the maintained state quantities include three categories: IMU state, camera state, and Lidar state, which are expressed as follows:
Ximu=[nqbTbgTnvbTbaTnpbT]X_{imu}=\begin{bmatrix}^nq^T_b &b^T_g &^nv^T_b &b^T_a & ^np^T_b \end{bmatrix}Ximu?=[nqbT??bgT??nvbT??baT??npbT??]
Xcam=[Gqc0TGpc0T]X_{cam}=\begin{bmatrix}^Gq^T_{c_0} & ^Gp^T_{c_0} \end{bmatrix}Xcam?=[Gqc0?T??Gpc0?T??]
Xlidar=[GqLTGpLT]X_{lidar}=\begin{bmatrix}^Gq_L^T & ^Gp^T_L \end{bmatrix}Xlidar?=[GqLT??GpLT??]
Note: q stands for attitude and p stands for position.Normally,G stands for Earth-Centered,Earth-Fixed Coordinate System,n stands for Navigation System.
We combine the above three state variables into a total state variable,which are expressed as follows:
Xold=[Ximu(Xcam)N(Xlidar)M]X_{old}=\begin{bmatrix}X_{imu} & (X_{cam})_N & (X_{lidar})_M \end{bmatrix}Xold?=[Ximu??(Xcam?)N??(Xlidar?)M??]
So far, we have obtained the initial state variables of the entire system. And then,Let’s try to expand our state variables.
If we get a new lidar scan,we need to expand XXX just like this:
Xnew=[Ximu(Xcam)N(Xlidar)MXlidarnew]=[XoldXlidarnew]X_{new}=\begin{bmatrix} X_{imu} & (X_{cam})_N & (X_{lidar})_M & X_{lidar}^{new} \end{bmatrix}=\begin{bmatrix} X_{old}& X_{lidar}^{new} \end{bmatrix}Xnew?=[Ximu??(Xcam?)N??(Xlidar?)M??Xlidarnew??]=[Xold??Xlidarnew??]
For the covariance matrix, it can be expressed in the form of the following figure, in which the green blocks represent non-zero blocks, the blue blocks are all zero matrixes, and the orange blocks represent the content to be obtained when extending the lidar state of the k+1 th frame.
The expanded covariance is:
Pnew=[PoldPOLk+1PLk+1OPLLl+1]P_{new}=\begin{bmatrix}P_{old} & P_{OL_{k+1}} \\ P_{L_{k+1}O} & P_{LL_{l+1}} \end{bmatrix}Pnew?=[Pold?PLk+1?O??POLk+1??PLLl+1???]
📌 Let’s discuss some knowledge about the Jacobian matrix.For simplicity, we use a one-dimensional function as an example.If there is function curve y=f(x,t),and this is a point (x_0,y_0) in the curve i.e. y_0=f(x_0,t_0).
If I want to know the value of a point at t1t_1t1? on the curve that is very close to the point (x0,y0)(x_0,y_0)(x0?,y0?).If I know the X coordinate of this point is x1x_1x1?,so how can I get the Y coordinate of this point if the function at t1t_1t1? is very similar to that at t0t_0t0?. I can get Y as follows:
f(x1,t1)=y0+df(x,t0)dx∣x=x0(x1?x0)f(x_1,t_1)=y_0+\frac {df(x,t_0)}{dx}|_{x=x0}(x_1-x_0)f(x1?,t1?)=y0?+dxdf(x,t0?)?∣x=x0?(x1??x0?)
For n-dimensional functions we use the Jacobian matrix JJJ to represent the partial derivatives.We can get this:
f(X1,t1)=f(X0,t0)+J(X1?X0)f(X_1,t_1)=f(X_0,t_0)+J(X_1-X_0)f(X1?,t1?)=f(X0?,t0?)+J(X1??X0?)
From the law of covariance propagation, we can draw the following conclusions:
DX1X1=JDX0X0JTD_{X_1X_1}=JD_{X_0X_0}J^TDX1?X1??=JDX0?X0??JT
DX0X1=DX0X0JTD_{X_0X_1}=D_{X_0X_0}J^TDX0?X1??=DX0?X0??JT
DX1X0=JDx0x0D_{X_1X_0}=JD_{x_0x_0}DX1?X0??=JDx0?x0??
So,We can get:
Pnew=[PoldPOLk+1PLk+1OPLLl+1]=[PoldPoldJTJPoldJPoldJT]=[IJ]Pold[ITJT]P_{new}=\begin{bmatrix}P_{old} & P_{OL_{k+1}} \\ P_{L_{k+1}O} & P_{LL_{l+1}} \end{bmatrix} \\ \,\qquad =\begin{bmatrix}P_{old} & P_{old}J^T \\ JP_{old} & JP_{old}J^T \end{bmatrix} \\ \,\qquad =\begin{bmatrix}I \\J\end{bmatrix}P_{old}\begin{bmatrix}I^T & J^T\end{bmatrix}Pnew?=[Pold?PLk+1?O??POLk+1??PLLl+1???]=[Pold?JPold??Pold?JTJPold?JT?]=[IJ?]Pold?[IT?JT?]
Obviously,JJJ is the Jacobian matrix of the newly added lidar state variable XlidarnewX_{lidar}^{new}Xlidarnew? about the previous state variable XoldX_{old}Xold?. Mathematically, the newly added state variable XlidarnewX_{lidar}^{new}Xlidarnew?is only related to the state variable of imu.
First, construct the position and attitude of the lidar:
R(GqL)=R(Gqn)R(nqb)RLbR(^Gq_L)=R(^Gq_n)R(^nq_b)R^b_LR(GqL?)=R(Gqn?)R(nqb?)RLb?
GpL=R(Gqb)pL+GpB=R(GqN)R(nqb)b+Gpb^Gp_L=R(^Gq_b)p_L+^Gp_B=R(^Gq_N)R(^nq_b)^b+^Gp_bGpL?=R(Gqb?)pL?+GpB?=R(GqN?)R(nqb?)b+Gpb?
Find partial derivatives by adding perturbation terms,for position:
GpL+δGpL=R(Gqn)(I?[δθ]x)R(nqb)bpL+Gpb+δGpb^Gp_L+\delta^Gp_L=R(^Gq_n)(I-[\delta\theta]_\text{x})R(^nq_b)^bp_L+^Gp_b+\delta^Gp_bGpL?+δGpL?=R(Gqn?)(I?[δθ]x?)R(nqb?)bpL?+Gpb?+δGpb?
We can get the following formula:
δGpL=?[δθx]R(Gqn)R(nqb)bpL+δGpb=R(GqN)[R(nqb)bpL]xδθ+δGpb\delta^Gp_L=-[\delta\theta_\text{x}]R(^Gq_n)R(^nq_b)^bp_L+\delta^Gp_b=R(^Gq_N)[R(^nq_b)^bp_L]_\text{x}\delta\theta+\delta^Gp_bδGpL?=?[δθx?]R(Gqn?)R(nqb?)bpL?+δGpb?=R(GqN?)[R(nqb?)bpL?]x?δθ+δGpb?
Obviously,
?δGpL?δθ=R(Gqn)[R(nqb)bpL]x\frac {\partial\delta^Gp_L}{\partial\delta\theta}=R(^Gq_n)[R(^nq_b)^bp_L]_\text{x}?δθ?δGpL??=R(Gqn?)[R(nqb?)bpL?]x?
?δGpLδGpb=I\frac {\partial\delta^Gp_L}{\delta^Gp_b}=IδGpb??δGpL??=I
And for attitude:
R(GqL)=R(Gqn)R(nqb)RLbR(^Gq_L)=R(^Gq_n)R(^nq_b)R^b_LR(GqL?)=R(Gqn?)R(nqb?)RLb?
Find partial derivatives by adding perturbation terms:
R(GqL)(I+[δGθL]x)=R(Gqn)(I?[δnθb]x)R(nqb)RLbR(^Gq_L)(I+[\delta^G\theta_L]_\text{x})=R(^Gq_n)(I-[\delta^n\theta_b]_\text{x})R(^nq_b)R^b_LR(GqL?)(I+[δGθL?]x?)=R(Gqn?)(I?[δnθb?]x?)R(nqb?)RLb?
We can get the following formula:
R(GqL)[δGθL]x=?R(Gqn)[δnθ]xR(nqb)RLbR(^Gq_L)[\delta^G\theta_L]_\text{x}=-R(^Gq_n)[\delta^n\theta]_\text{x}R(^nq_b)R_L^bR(GqL?)[δGθL?]x?=?R(Gqn?)[δnθ]x?R(nqb?)RLb?
[δGθL]x=?RnL[δnθ]x(RnL)T[\delta^G\theta_L]_x=-R_n^L[\delta^n\theta]_\text{x}(R_n^L)^T[δGθL?]x?=?RnL?[δnθ]x?(RnL?)T
[δGθL]x=?[RnLδnθb]x[\delta^G\theta_L]_x=-[R^L_n\delta^n\theta_b]_\text{x}[δGθL?]x?=?[RnL?δnθb?]x?
Obviously,
?δGθL?δθ=?RnL\frac{\partial\delta^G\theta_L}{\partial\delta\theta}=-R_n^L?δθ?δGθL??=?RnL?
?δGθL?Gpb=0\frac{\partial\delta^G\theta_L}{\partial^Gp_b}=0?Gpb??δGθL??=0
To sum up, we can obtain the Jacobian matrix:
J=[?RnL0000...0R(Gqn)[R(nqb)bpL]x000I...0]J=\begin{bmatrix} -R^L_n & 0 & 0 & 0 & 0 & ... & 0 \\ R(^Gq_n)[R(^nq_b)^bp_L]_\text{x} & 0 & 0& 0& I & ... &0\end{bmatrix}J=[?RnL?R(Gqn?)[R(nqb?)bpL?]x??00?00?00?0I?......?00?]
總結
以上是生活随笔為你收集整理的激光SLAM后端优化——雅克比矩阵推导的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: UE5 使用MetaHuman 制作数字
- 下一篇: 慈悲 读后感