ORB-EKF

1 篇文章 0 订阅

前言

ORB是视觉slam算法,这里利用ORB提取到的特征点用于EKF,本实验模型为车载RGBD相机


1. 运动方程

与里程计模型相同,但是区别于传统的平面机器人姿态估计,状态向量中存储的landmark是三维的,即:
s t a t e _ v e c t o r = [ x y θ L i w o r l d ] state\_vector = \begin{bmatrix} x \\ y \\ \theta \\ L^{world}_i \end{bmatrix} state_vector=xyθLiworld

其中:
L i w o r l d = [ L x w o r l d L y w o r l d L z w o r l d ] L^{world}_i = \begin{bmatrix} L^{world}_x \\ L^{world}_y \\ L^{world}_z \end{bmatrix} Liworld=LxworldLyworldLzworld

所以协方差矩阵的维度:
s i z e ( P ) = 3 + n u m l a n d m a r k ∗ 3 , 3 + n u m l a n d m a r k ∗ 3 size(P) = 3 + numlandmark * 3 ,3 + numlandmark*3 size(P)=3+numlandmark3,3+numlandmark3

2. 观测方程(observation function)

状态向量 s t a t e _ v e c t o r state\_vector state_vector中存储是地标的世界坐标和相机的世界坐标与姿态
那么引入两个算式:
1)landmark由世界坐标到相机坐标:
r i = [ x y 0 ] r_i = \begin{bmatrix} x \\ y \\ 0 \end{bmatrix} ri=xy0

R = [ s i n ( θ ) − c o s ( θ ) 0 0 0 − 1 c o s ( θ ) s i n ( θ ) 0 ] R = \begin{bmatrix} sin(\theta) & -cos(\theta) & 0 \\ 0 & 0 & -1 \\ cos(\theta) & sin(\theta) & 0 \end{bmatrix} R=sin(θ)0cos(θ)cos(θ)0sin(θ)010

L i c a m e r a = R ( L i w o r l d − r i ) L^{camera}_i = R(L^{world}_i - r_i) Licamera=R(Liworldri)

2) 由相机坐标到像素坐标
u = c x + f x L x c a m e r a / L z c a m e r a u = c_x + f_xL^{camera}_x/L^{camera}_z u=cx+fxLxcamera/Lzcamera
v = c y + f y L y c a m e r a / L z c a m e r a v = c_y + f_yL^{camera}_y/L^{camera}_z v=cy+fyLycamera/Lzcamera

将上述两个算式组合就可以得到观测方程:
u = c x + f x ( s i n ( θ ) ( l x k − x ) − c o s ( θ ) ( l y k − y ) ) c o s ( θ ) ( l x k − x ) + s i n ( θ ) ( l y k − y ) u = c_x + \frac{f_x(sin(\theta)(l_x^k - x) - cos(\theta)(l_y^k - y))}{cos(\theta)(l_x^k - x) + sin(\theta)(l_y^k - y)} u=cx+cos(θ)(lxkx)+sin(θ)(lyky)fx(sin(θ)(lxkx)cos(θ)(lyky))

v = c y − l z k f y c o s ( θ ) ( l x k − x ) + s i n ( θ ) ( l y k − y ) v = c_y - \frac{l_z^kf_y}{cos(\theta)(l_x^k - x) + sin(\theta)(l_y^k - y)} v=cycos(θ)(lxkx)+sin(θ)(lyky)lzkfy

我们认为观测为像素坐标


3. 逆观测方程 (invers observation function)

2.中已经讨论过观测方程,由 L x w o r l d , L y w o r l d , L z w o r l d L^{world}_x,L^{world}_y,L^{world}_z Lxworld,Lyworld,Lzworld得到像素坐标 u , v u,v u,v,那么所谓的逆运动方程就是反过来:由 u , v + d u,v + d u,v+d(d
表示深度,其实就等于 L z w o r l d L^{world}_z Lzworld),计算 L x w o r l d , L y w o r l d L^{world}_x,L^{world}_y Lxworld,Lyworld,总之:

l x k = d c o s ( θ ) + ( u − c x ) d s i n ( θ ) f x + x l_x^k = dcos(\theta) + \frac{(u - c_x)dsin(\theta)}{f_x} + x lxk=dcos(θ)+fx(ucx)dsin(θ)+x

l k y = d s i n ( θ ) − ( u − c x ) d c o s ( θ ) f x + y l^y_k = dsin(\theta) - \frac{(u - c_x)dcos(\theta)}{f_x} + y lky=dsin(θ)fx(ucx)dcos(θ)+y

l k z = − ( v − c y ) d f y l^z_k = -\frac{(v - c_y)d}{f_y} lkz=fy(vcy)d


3. 雅各比矩阵H

3.1 observation function Jacob to pose

d = c o s ( θ ) ( l x k − x ) + s i n ( θ ) ( l y k − y ) d = cos(\theta)(l_x^k - x) + sin(\theta)(l_y^k - y) d=cos(θ)(lxkx)+sin(θ)(lyky)

∂ d ∂ x = − c o s ( θ ) \frac{\partial d}{\partial x} = -cos(\theta) xd=cos(θ)

∂ d ∂ y = − s i n ( θ ) \frac{\partial d}{\partial y} = -sin(\theta) yd=sin(θ)

∂ d ∂ θ = − s i n ( θ ) ( l x k − x ) + c o s ( θ ) ( l y k − y ) \frac{\partial d}{\partial \theta} = -sin(\theta)(l_x^k - x) + cos(\theta)(l_y^k - y) θd=sin(θ)(lxkx)+cos(θ)(lyky)

H p o s e = [ ∂ u ∂ x ∂ u ∂ y ∂ u ∂ θ ∂ v ∂ x ∂ v ∂ y ∂ v ∂ θ ] H_{pose} = \begin{bmatrix} \frac{\partial u}{\partial x} &\frac{\partial u}{\partial y} & \frac{\partial u}{\partial \theta} \\ \frac{\partial v}{\partial x} &\frac{\partial v}{\partial y} & \frac{\partial v}{\partial \theta} \end{bmatrix} Hpose=[xuxvyuyvθuθv]

那么有:

H p o s e = [ f x ( l y k − y ) ( c o s ( θ ) ( l x k − x ) + s i n ( θ ) ( l y k − y ) ) 2 − f x ( l x k − x ) ( c o s ( θ ) ( l x k − x ) + s i n ( θ ) ( l y k − y ) ) 2 − f x ( ( l y k − y ) 2 + ( l x k − x ) 2 ) ( c o s ( θ ) ( l x k − x ) + s i n ( θ ) ( l y k − y ) ) 2 c o s ( θ ) f y l z k ( c o s ( θ ) ( l x k − x ) + s i n ( θ ) ( l y k − y ) ) 2 s i n ( θ ) f y l z k ( c o s ( θ ) ( l x k − x ) + s i n ( θ ) ( l y k − y ) ) 2 − f y l z k ( − s i n ( θ ) ( l x k − x ) + c o s ( θ ) ( l y k − y ) ) ( c o s ( θ ) ( l x k − x ) + s i n ( θ ) ( l y k − y ) ) 2 ] H_{pose} = \begin{bmatrix} \frac{f_x(l_y^k - y)}{(cos(\theta)(l_x^k - x) + sin(\theta)(l_y^k - y))^2} &\frac{-f_x(l_x^k - x)}{(cos(\theta)(l_x^k - x) + sin(\theta)(l_y^k - y))^2} & \frac{-f_x((l_y^k - y)^2 + (l_x^k - x)^2)}{(cos(\theta)(l_x^k - x) + sin(\theta)(l_y^k - y))^2} \\ \frac{cos(\theta)f_yl_z^k}{(cos(\theta)(l_x^k - x) + sin(\theta)(l_y^k - y))^2} & \frac{sin(\theta)f_yl_z^k}{(cos(\theta)(l_x^k - x) + sin(\theta)(l_y^k - y))^2} & -\frac{f_yl_z^k(-sin(\theta)(l_x^k - x) + cos(\theta)(l_y^k - y))}{(cos(\theta)(l_x^k - x) + sin(\theta)(l_y^k - y))^2} \end{bmatrix} Hpose=(cos(θ)(lxkx)+sin(θ)(lyky))2fx(lyky)(cos(θ)(lxkx)+sin(θ)(lyky))2cos(θ)fylzk(cos(θ)(lxkx)+sin(θ)(lyky))2fx(lxkx)(cos(θ)(lxkx)+sin(θ)(lyky))2sin(θ)fylzk(cos(θ)(lxkx)+sin(θ)(lyky))2fx((lyky)2+(lxkx)2)(cos(θ)(lxkx)+sin(θ)(lyky))2fylzk(sin(θ)(lxkx)+cos(θ)(lyky))

H p o s e H_{pose} Hpose搞错了,每一项都要加上一个负号


3.2 observation function Jacob to landmark

d = c o s ( θ ) ( l x k − x ) + s i n ( θ ) ( l y k − y ) d = cos(\theta)(l_x^k - x) + sin(\theta)(l_y^k - y) d=cos(θ)(lxkx)+sin(θ)(lyky)

∂ d ∂ l x k = c o s ( θ ) \frac{\partial d}{\partial l_x^k} = cos(\theta) lxkd=cos(θ)

∂ d ∂ l y k = s i n ( θ ) \frac{\partial d}{\partial l_y^k} = sin(\theta) lykd=sin(θ)

H m a p = [ ∂ u ∂ l x k ∂ u ∂ l y k ∂ u ∂ l z k ∂ v ∂ l x k ∂ v ∂ l y k ∂ v ∂ l z k ] H_{map} = \begin{bmatrix} \frac{\partial u}{\partial l_x^k} &\frac{\partial u}{\partial l_y^k} & \frac{\partial u}{\partial l_z^k} \\ \frac{\partial v}{\partial l_x^k} &\frac{\partial v}{\partial l_y^k} & \frac{\partial v}{\partial l_z^k} \end{bmatrix} Hmap=[lxkulxkvlykulykvlzkulzkv]

那么有:

H m a p = [ − f x ( l y k − y ) c o s ( θ ) ( l x k − x ) + s i n ( θ ) ( l y k − y ) f x ( l x k − x ) c o s ( θ ) ( l x k − x ) + s i n ( θ ) ( l y k − y ) 0 − l z k f y c o s ( θ ) ( c o s ( θ ) ( l x k − x ) + s i n ( θ ) ( l y k − y ) ) 2 − l z k f y s i n ( θ ) ( c o s ( θ ) ( l x k − x ) + s i n ( θ ) ( l y k − y ) ) 2 f y c o s ( θ ) ( l x k − x ) + s i n ( θ ) ( l y k − y ) ] H_{map} = \begin{bmatrix} -\frac{f_x(l_y^k - y)}{cos(\theta)(l_x^k - x) + sin(\theta)(l_y^k - y)} &\frac{f_x(l_x^k - x)}{cos(\theta)(l_x^k - x) + sin(\theta)(l_y^k - y)} & 0 \\ -\frac{l_z^kf_ycos(\theta)}{(cos(\theta)(l_x^k - x) + sin(\theta)(l_y^k - y))^2} & -\frac{l_z^kf_ysin(\theta)}{(cos(\theta)(l_x^k - x) + sin(\theta)(l_y^k - y))^2} & \frac{f_y}{cos(\theta)(l_x^k - x) + sin(\theta)(l_y^k - y)}\end{bmatrix} Hmap=cos(θ)(lxkx)+sin(θ)(lyky)fx(lyky)(cos(θ)(lxkx)+sin(θ)(lyky))2lzkfycos(θ)cos(θ)(lxkx)+sin(θ)(lyky)fx(lxkx)(cos(θ)(lxkx)+sin(θ)(lyky))2lzkfysin(θ)0cos(θ)(lxkx)+sin(θ)(lyky)fy

H m a p H_{map} Hmap搞错了,每一项都要加上一个负号


3.3 inverse observation function Jacob to pose

G p o s e = [ 1 0 − d s i n ( θ ) + ( u − c x ) d c o s ( θ ) f x 0 1 d c o s ( θ ) + ( u − c x ) d s i n ( θ ) f x 0 0 0 ] G_{pose} = \begin{bmatrix} 1 &0 & -dsin(\theta) + \frac{(u - c_x)dcos(\theta)}{f_x} \\ 0 & 1 & dcos(\theta) + \frac{(u - c_x)dsin(\theta)}{f_x} \\ 0 & 0 & 0\end{bmatrix} Gpose=100010dsin(θ)+fx(ucx)dcos(θ)dcos(θ)+fx(ucx)dsin(θ)0


3.4 inverse observation function Jacob to landmark

G m a p = [ d s i n ( θ ) f x 0 − d c o s ( θ ) f x 0 0 − d f y ] G_{map} = \begin{bmatrix} \frac{dsin(\theta)}{f_x} & 0 \\ -\frac{dcos(\theta)}{f_x} & 0 \\ 0 & -\frac{d}{f_y} \end{bmatrix} Gmap=fxdsin(θ)fxdcos(θ)000fyd

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值