kalibr使用笔记

官网

GitHub - ethz-asl/kalibr: The Kalibr visual-inertial calibration toolboxThe Kalibr visual-inertial calibration toolbox. Contribute to ethz-asl/kalibr development by creating an account on GitHub.https://github.com/ethz-asl/kalibr

编译

编译kalibr的Bug:

fatal error: libv4l2.h: 没有那个文件或目录

sudo apt install libv4l-dev  (专门用来处理视频图像)

标定过程

Kalibr标定完整过程(相机用的小觅深度系列相机)_超超512的博客-CSDN博客_kalibr标定https://blog.csdn.net/u010056641/article/details/105665309

 生成标定板

支持checkerboard和apriltag:

参考https://github.com/ethz-asl/kalibr/wiki/calibration-targets

使用Aprilgrid的好处:

partially visible calibration boards can be used ;pose of the target is fully resolved (no flips)

运行kalibr_create_target_pdf –h

报错:ImportError: No module named pyx

生成棋盘格会有报错,因为作者写的提示代码少了-,最后应为

kalibr_create_target_pdf --type checkerboard --nx 6 --ny 6 --csx 0.05 --csy 0.1

根据打印后的棋盘格,编辑标定板信息,文件名april_6x6.yaml

#example for aprilgrid

target_type: 'aprilgrid' #gridtype

tagCols: 6 #number of apriltags

tagRows: 6 #number of apriltags

tagSize: 0.088 #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[-]

#example for checkerboard

target_type: 'checkerboard' #gridtype

targetRows: 14 #number of internal chessboard corners

targetCols: 11 #number of internal chessboard corners

rowSpacingMeters: 0.04 #size of one chessboard square [m]

colSpacingMeters: 0.04 #size of one chessboard square [m]

 kalibr使用笔记_第1张图片

打印标定板

打印注意要按照实际的大小打印,而且打印的标定版至少要占图像的3/4;

标定相机

kalibr_calibrate_cameras的详细参数见kalibr-master/aslam_offline_calibration/kalibr/python/kalibr_calibrate_cameras

常用kalibr_calibrate_cameras 参数说明:

--bag /home/heyijia/stereo_calibra.bag

--topics /left /right

--models pinhole-radtan pinhole-radtan : pinhole-equi,omni-radtan

--target /home/heyijia/april_6x6_80x80cm_A0.yaml

--show-extraction

采用 pinhole-equi 模型,对畸变大的相机效果不错

VINS采用MEI模型,即omni-radtan

运行以上指令出现BUG:ImportError: No module named igraph

sudo apt install python-igraph

 标定过程中出现BUG

initialization of focal length for cam with topic /img_left failed

kalibr 标定记录_AndyCheng_hgcc的博客-CSDN博客_kalibr标定

解决:

如果提示不能得到初始焦距的时候,可以设置:export KALIBR_MANUAL_FOCAL_LENGTH_INIT=1。然后运行程序,当程序运行失败的时候,它会提示要你手动输入一个焦距,Initialization of focal length failed. Provide manual initialization: 这时你手动输入比如 400,给比较大的值,也能收敛。

Input focal length guess if initial guess fails. (#346) · ethz-asl/kalibr@d8bdfc5 · GitHub

运行:

export KALIBR_MANUAL_FOCAL_LENGTH_INIT=1

rosrun kalibr kalibr_calibrate_cameras --bag /home/hik/share/stereo_calibra04201450_4.bag --topics /img_left /img_right --models pinhole-radtan pinhole-radtan --target /home/hik/share/april_6x6_80x80cm.yaml --show-extraction

解决2

换一种相机模型MEI,即可自动计算出focal_length

rosrun kalibr kalibr_calibrate_cameras --bag /home/hik/share/stereo_calibra_0423_1.bag --topics /img_left /img_right --models omni-radtan omni-radtan --target /home/hik/share/april_6x6_80x80cm.yaml --show-extraction

kalibr 标定记录_AndyCheng_hgcc的博客-CSDN博客_kalibr标定

 标定imu

安装

https://blog.csdn.net/weixin_41586393/article/details/99306237

用imu_utils标定IMU,之后用于kalibr中相机和IMU的联合标定_一ping就通的博客-CSDN博客_code_utils

GitHub - gaowenliang/imu_utils: A ROS package tool to analyze the IMU performance.

sudo apt-get install libdw-dev

下载imu_utils和code_utils后,先编译code_utils(因为imu_utils依赖code_utils,填坑: 在code_utils下面找到sumpixel_test.cpp,修改#include "backward.hpp"为 #include “code_utils/backward.hpp”,再编译。),然后编译imu_util

录数据

让IMU静止不动两个小时,录制IMU的bag

准备标定

#imu topic的名字

#标定的时长

标定

roscore
rosbag play -r 200 imu.bag
roslaunch imu_utils mynt_imu.launch

注意:

输出的imu.yaml中加速度和陀螺仪的格式必须写成1.0e-04这样的格式,否则报错:

can't multiply sequence by non-int of type 'str'

联合标定

kalibr_calibrate_imu_camera详细参数参见:

kalibr-master/aslam_offline_calibration/kalibr/python/kalibr_calibrate_imu_camera

 kalibr_calibrate_imu_camera参数说明:

--target /home/heyijia/april_6x6_80x80cm_A0.yaml

--cam /home/heyijia/camchain-homeheyijiastereo_calibra.yaml

--imu /home/heyijia/imu_mynteye.yaml

--bag /home/heyijia/stereo_imu_calibra.bag

--bag-from-to 2 37

运行指令:

rosrun kalibr kalibr_calibrate_imu_camera --bag /home/hik/share/stereo_imu_calibra0420.bag --cam /home/hik/share/camchain-homehiksharestereo_calibra04201450_4.yaml --imu /home/hik/share/imu.yaml --target /home/hik/share/april_6x6_80x80cm.yaml --show-extraction --perform-synchronization

 Bug:

OverflowError: bad numeric conversion: positive overflow

OverflowError: bad numeric conversion: positive overflow · Issue #401 · ethz-asl/kalibr · GitHub

有踩过坑的通过--perform-synchronization解决overflow的问题

rosrun kalibr kalibr_calibrate_imu_camera --bag /home/hik/share/stereo_imu_calibra0420.bag –perform-synchronization --cam /home/hik/share/camchain-homehiksharestereo_calibra04201450_4.yaml --imu /home/hik/share/imu.yaml --target /home/hik/share/april_6x6_80x80cm.yaml –show-extraction --no-time-calibration

运行以下数据集可以完成时间同步校验:

rosrun kalibr kalibr_calibrate_imu_camera --bag /home/hik/share/stereo_imu_calibra0421_3.bag --perform-synchronization --cam /home/hik/share/camchain-homehiksharestereo_calibra04201450_4.yaml --imu /home/hik/share/imu.yaml --target /home/hik/share/april_6x6_80x80cm.yaml --max-iter 100 --show-extraction

Camera imu时间同步问题(尚未解决)

Multi IMU and IMU intrinsic calibration · ethz-asl/kalibr Wiki · GitHub

Optimization failed! · Issue #55 · ethz-asl/kalibr · GitHub

Optimization failed in kalibr_calibration_imu_camera · Issue #41 · ethz-asl/kalibr · GitHub

Wrong transformation between IMU and camera · Issue #228 · ethz-asl/kalibr · GitHub

硬件同步方案

ROS camera and IMU synchronization | Work-is-Playing

附录

slam里常用的相机模型

SLAM 中常用的相机模型&畸变模型总结_啊啦啦工业的博客-CSDN博客_多项式畸变模型

MEI Camera:Omni + Radtan6

Pinhole Camera:Pinhole + Radtan

根据经验,小于90度使用Pinhole,大于90度使用MEI模型。

SLAM 中常用的相机模型&畸变模型总结_啊啦啦工业的博客-CSDN博客_多项式畸变模型


 

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

Kannala-Brandt model (pinhole-equi in Kalibr): https://github.com/ethz-asl/kalibr/pull/210

Imu和camera标定

1. Online calibration: VINS-Mono(Online Temporal Calibration for Monocular Visual-Inertial Systems, IROS 2018,Best student paper)

2. Online calibration: MSCKF(Online Temporal Calibration for Camera-IMU Systems:Theory and Algorithms,2014)

3. Offline calibration: Kalibr(Unified Temporal and Spatial Calibration for Multi-Sensor Systems,IROS 2013)

 

整理不易,点个赞呀,喂~ 

你可能感兴趣的:(标定,多传感器融合,VSLAM,自动驾驶)