双目相机与IMU camera IMU 联合标定工具箱使用方法——Kalibr

16个相机参数:

Overview

ethz-asl/kalibr is a toolbox that solves the following calibration problems:

    Multiple camera calibration: intrinsic and extrinsic calibration of a camera-systems with non-globally shared overlapping fields of view
    Camera-IMU calibration: spatial and temporal calibration of an IMU w.r.t a camera-system
    Rolling Shutter Camera calibration: full intrinsic calibration (projection, distortion and shutter parameters) of rolling shutter cameras

kalibr website:

https://github.com/ethz-asl/kalibr/wiki/multiple-camera-calibration

https://github.com/ethz-asl/kalibr

1.安装

Kalibr 提供两种使用方式。第一种为CDE下直接使用,作者将所需的库文件打包好,省去了配置dependency的步骤,可以直接从

https://github.com/ethz-asl/kalibr/wiki/downloads

下载, 注意需要科学浏览。

下载之后直接用

./cde-exec+命令 即可使用对应的工具。

例如如果我们想使用kalibr内的kalibr_calibrate_cameras功能,

使用

./ced-exec kalibr_calibrate_cameras --target april_6x6.yaml --bag static.bag --models pinhole-equi pinhole-equi omni-radtan omni-radtan --topics /cam0/image_raw /cam1/image_raw /cam2/image_raw /cam3/image_raw

单目+IMU双目+IMU 为例,讲解使用 Kalibr工具 标定 Camera-IMU,其中使用的摄像头分别为 Realsense ZR300MYNT-EYE S系列摄像头

2.开始标定

Kalibr不仅提供了IMU以及camera的联合标定工具箱,也提供了camera标定工具箱。

在此我们先使用camera标定工具对相机进行标定。

首先我们需要制作标定板,在此推荐使用april tag,可以使用kalibr自带工具自定义生成不同大小的标定板,命令如下

kalibr_create_target_pdf --type apriltag --nx [NUM_COLS] --ny [NUM_ROWS] --tsize [TAG_WIDTH_M] --tspace [TAG_SPACING_PERCENT]
  1. roscore
  2. rosrun uvc_camera uvc_camera_node
  3. rosrun image_view image_view image:=/image_raw
  4. rostipic list
  5. rqt_image_view
  6. rosbag record -o test /image_raw
  7. rosbag play test_2019-08-14-14-22-35.bag

将生成的pdf打印出来,置于平稳,光照充足的地方,注意要保持平整。

Kalibr作者推荐将camera固定,然后移动标定板,这样可以提高标定的稳定性,但是鉴于我使用场景受限,我使用的是晃动camera方法。

之后就可以开始录制bag了,使用

rosbag record /cam0/image_raw /cam1/image_raw /imu0

若对相机标定结果满意我们可以继续进行camera以及imu的联合标定步骤,此步使用了如下信息:

1. 标定板yaml

2. 相机标定结果yaml

3. imu内参yaml

4. 前面使用的对应bag

有了如上材料即可进行联合标定,具体如下

kalibr_calibrate_imu_camera --target aprilgrid6x4.yaml --cam camchain-2017-06-14-09-13-29.yaml --imu imu.yaml --bag 2017-06-14-09-13-29.bag --bag-from-to 5 45

 最后的--bag_from_to是选取地5-45s的bag数据,去除了拾取防止设备产生的抖动部分影响。我们建议进行多组标定之后将标定结果进行最佳无偏估计,不建议对R部分直接取平均值,可以将多组数据的R部分转换成四元数。之后进行处理。

3.标定板文件:target.yaml
Kalibr支持三种标定板,分别是Aprilgrid、Checkerboard和Circlegrid。

4.帮助小陶的标定记录

 april.yaml

target_type: 'aprilgrid' #gridtype
tagCols: 6               #number of apriltags
tagRows: 6               #number of apriltags
tagSize: 0.025           #size of apriltag, edge to edge [m]
tagSpacing: 0.3          #ratio of space between tags to tagSize
                         #example: tagSize=2m, spacing=0.5m --> tagSpacing=0.25[-]

imu_adis16448.yaml

rostopic: /imu/data
update_rate: 200.0 #Hz

#accelerometer_noise_density: 2.0000e-3 #continous
#accelerometer_random_walk: 1.9393e-05 
#gyroscope_noise_density: 1.6968e-04 #continous
#gyroscope_random_walk: 1.9393e-05


accelerometer_noise_density: 1.2e-2 #continous
accelerometer_random_walk: 3.0e-05 
gyroscope_noise_density: 1.0e-02 #continous
gyroscope_random_walk: 3.0e-05
 

results-imucam-2019-11-12-11-40-05.txt

Calibration results
===================
Normalized Residuals
----------------------------
Reprojection error (cam0):     mean 0.233871733163, median 0.206334845347, std: 0.148605727319
Gyroscope error (imu0):        mean 0.0943654955325, median 0.0867912466407, std: 0.0496732486016
Accelerometer error (imu0):    mean 0.119169698923, median 0.107462875286, std: 0.0668447618807

Residuals
----------------------------
Reprojection error (cam0) [px]:     mean 0.233871733163, median 0.206334845347, std: 0.148605727319
Gyroscope error (imu0) [rad/s]:     mean 0.0133452963602, median 0.0122741358095, std: 0.00702485818595
Accelerometer error (imu0) [m/s^2]: mean 0.020223768533, median 0.0182370546818, std: 0.011343932259

Transformation (cam0):
-----------------------
T_ci:  (imu0 to cam0): 
[[ 0.01032731 -0.99994666 -0.00016158  0.01401135]
 [ 0.03105076  0.0004822  -0.99951769  0.07414391]
 [ 0.99946446  0.01031731  0.03105408 -0.04191072]
 [ 0.          0.          0.          1.        ]]

T_ic:  (cam0 to imu0): 
[[ 0.01032731  0.03105076  0.99946446  0.03944135]
 [-0.99994666  0.0004822   0.01031731  0.01440725]
 [-0.00016158 -0.99951769  0.03105408  0.07541191]
 [ 0.          0.          0.          1.        ]]

timeshift cam0 to imu0: [s] (t_imu = t_cam + shift)
0.00165763516901


Gravity vector in target coords: [m/s^2]
[-0.00215999 -9.7244984  -1.26591825]


Calibration configuration
=========================

cam0
-----
  Camera model: omni
  Focal length: [3657.3894212462615, 3636.5284554729647]
  Principal point: [638.9568695670013, 503.393652719486]
  Omni xi: 5.80194283441
  Distortion model: radtan
  Distortion coefficients: [1.5274292230602973, -6.475270653629076, 0.0004049030197607094, 0.0019115670188138707]
  Type: aprilgrid
  Tags: 
    Rows: 6
    Cols: 6
    Size: 0.025 [m]
    Spacing 0.0075 [m]

IMU configuration
=================

IMU0:
----------------------------
  Model: calibrated
  Update rate: 200.0
  Accelerometer:
    Noise density: 0.012 
    Noise density (discrete): 0.169705627485 
    Random walk: 3e-05
  Gyroscope:
    Noise density: 0.01
    Noise density (discrete): 0.141421356237 
    Random walk: 3e-05
  T_i_b
    [[ 1.  0.  0.  0.]
     [ 0.  1.  0.  0.]
     [ 0.  0.  1.  0.]
     [ 0.  0.  0.  1.]]
  time offset with respect to IMU0: 0.0 [s]

Q1:I imu topics修改:如果标定相机zed leadsensor mynt 等相机录制IMU节点topics可能为xxx/imu/data 需要修改imu.yaml文件进行适配。

Q2:一个是利用rosbag节点运行的时候, 将发布的主题进行修改(remap )。另一个则是这roslaunch文件中进行修改.

下面利用两种不同的方式将/image_raw‘映射到/camera/image_raw.

1. rosbag remap
 rosbag play ros.bag  /image_raw:=/camera/image_raw

2. roslaunch remap
<remap from="/image_raw" to="/camera/image_raw"/>
 

  1. https://github.com/ethz-asl/kalibr/wiki/calibration-targets
  2. https://www.cnblogs.com/wongyi/p/11152062.html
  3. https://blog.csdn.net/yangdashi888/article/details/51356385
  4. https://github.com/ethz-asl/kalibr/wiki/camera-imu-calibration
发布了71 篇原创文章 · 获赞 104 · 访问量 16万+

猜你喜欢

转载自blog.csdn.net/Darlingqiang/article/details/99570561
IMU