Preface:This article is written for a nifty girl who I cherish.
(0)Caculate camera 2 imu matrix and translation vector
i
m
u
R
c
a
m
i
m
u
T
c
a
m
⃗
\space ^{imu}R_{cam} \newline \space \newline \vec{^{imu}T_{cam}}
imuRcam imuTcam
以imu坐标系为基本坐标系,计算cam坐标系中的向量映射为imu坐标系的旋转矩阵与平移向量有:
V
i
m
u
=
i
m
u
R
c
a
m
v
c
a
m
+
i
m
u
T
c
a
m
⃗
V_{imu}=\space ^{imu}R_{cam}v_{cam}+\vec{^{imu}T_{cam}}
Vimu= imuRcamvcam+imuTcam
满足矩阵左乘;
而对应到坐标轴旋转,是cam坐标系旋转到imu坐标系的旋转;
计算步骤:
- 在物体中心标出xyz坐标轴
- 以imu坐标系为基本坐标系,依次找到轴旋转到想要的坐标系(固定角旋转)
- 写出imu到cam的逆旋转,写出旋转四元数:
写四元数思路: 空间中任意旋转都基于一特定轴+角度
对于四元数 ( w , x , y , z ) (w,x,y,z) (w,x,y,z),有:
{ c o s ( θ / 2 ) n x s i n ( θ / 2 ) n y s i n ( θ / 2 ) n z s i n ( θ / 2 ) \begin{cases} cos(\theta/2) \\ n_xsin(\theta/2) \\n_ysin(\theta/2) \\n_zsin(\theta/2) \end{cases} ⎩⎪⎪⎪⎨⎪⎪⎪⎧cos(θ/2)nxsin(θ/2)nysin(θ/2)nzsin(θ/2)
表示绕着轴 ( n x , n y , n z ) T (n_x,n_y,n_z)^T (nx,ny,nz)T旋转 θ \theta θ度, ( n x , n y , n z ) T (n_x,n_y,n_z)^T (nx,ny,nz)T一般为一单位向量 - 运用matlab “quat2dcm()” 函数求解旋转矩阵,依次将矩阵乘起来,考虑越靠近cam坐标系的旋转矩阵放在右边
- 拿出三个单位向量做验证
Example:
(2)Camera
Global shutter camera is better than rolling shutter camera;
Realsense D435 rgb camera is rolling shutter camera;
(3)Calibration imu and camera use kalibr
- catkin_make in :Link
First use: catkin_make -j16
Then no error except “compiler internal error”, use: carkin_make -j1 - write to default source file:
gedit ~/.bashrc
type:"source ~/Codes/kalibr_workspace/devel/setup.bash", and save file