D435 camera + pixhwak flight control IMU calibration (internal participation and external reference)

foreword

Recently , the autonomous aerial robot project of Zhejiang University was reproduced , and many problems were encountered in the process, which were solved one by one. According to the video teaching method, the basic odometer is not easy to drift, but I still want to do the Kalibr calibration that has been circulating on the Internet for a long time. The main reason is that when looking up the data, I found that the more accurate the external parameter matrix, the better the effect of VINS, so let's start!

D435 Camera Internal Parameter Calibration

1. Pre-work
Refer to this article , download the required files such as the calibration board, and watch the video twice.
2. Drive realsense and start px4

roslaunch realsense2_camera rs_camera.launch
roslaunch mavros px4.launch

Check the topic and find the topic you need. Those who understand the basics of ros should be fine.
3. Recording package
Record according to the actions taught in the video

rosbag record -O stereo_calibra.bag /camera/infra1/image_rect_raw /camera/infra2/image_rect_raw /mavros/imu/data /mavros/imu/data_raw

The package name of stereo_calibra.bag itself, /camera/infra1/image_rect_raw /camera/infra2/image_rect_raw /mavros/imu/data /mavros/imu/data_raw is the topic name
and mentioned above to reduce the topic frequency, I don’t think it needs to be reduced , Calibration is not a real-time running program, of course, the more accurate the better!
If there is any misunderstanding, please point out in the comments!
4. Run the calibration program
to add environment variables:

source devel/setup.bash

Run the calibration program:

rosrun kalibr kalibr_calibrate_cameras --bag stereo_calibra.bag --topics /camera/infra1/image_rect_raw /camera/infra2/image_rect_raw  --models pinhole-equi pinhole-equi --target /home/liuzao/april_6x6_80x80cm.yaml

Pay special attention to the path problem here. I ran it a few times and reported an error. Finally, put the stereo_calibra.bag recorded earlier under Kalibr_ws/. This is the workspace where I compiled kalibr

Error 1:
There is a type of error, there is no screenshot of the error message, but it can be solved by following the prompts
insert image description here
Error 2:
RuntimeError: [CameraChainParameters Reader]: Could not write configuration to camchain-/home/liuzao/stereo_calibra.yaml
This error is very annoying , is the path problem, toss a few times, try the command in the fourth step many times, and finally solve it.

pixhwak IMU internal reference calibration

As a whole, I also refer to the above link, and I will write about the pits I have stepped on.
After running the launch file, that is, after executing this command

roslaunch imu_utils px4_imu.launch

insert image description here

The window shows wait for imu data.
Don't think that the program is not running. In fact, the program has no feedback information, but it is running.
If you want to verify it, you can set max_time_min to 1, and you can see the effect immediately.
The number that should be set correctly should be consistent with the annotation in my picture.

Joint calibration of camera and IMU

Download a standard template, which is categorized as follows
Camera internal reference calibration file: cam_april-camchain.yaml stereo_calibra.bag (this is self-recorded, not downloaded)
IMU internal reference calibration file: imu_adis16448.yaml
Calibration board file: april_6x6_80x80cm.yaml

Replace the parameters in the template file with the parameters you measured earlier! ! !

bag-from-to is the running time of the intercepted package, which can be estimated according to the actual situation. Generally, the head and tail are removed for 5 seconds. Like mine, the time is 91 seconds, so the interception is 5~86 seconds.
Enter the Kalibr_ws folder and execute the command:
insert image description here
I put this picture to compare the location of the command and the file, because it is easy for novices to get confused because of this, and some files are copied from other places.

rosrun kalibr kalibr_calibrate_imu_camera --target april_6x6_80x80cm.yaml --cam cam_april-camchain.yaml --imu imu_adis16448.yaml --bag stereo_calibra.bag --bag-from-to 5 86

Here comes the point! ! !
cam_april-camchain.yaml should look like this, otherwise it will report an error. I missed the T_cn_cnm1 matrix before, and the result was an error saying that the baseline could not be found.
insert image description here

Error 1:
RuntimeError: [CameraChainParameters Reader]: invalid camera baseline (cam1 in cam_april-camchain.yaml)
This is the error that the baseline cannot be found above!

reference link

https://blog.csdn.net/qinqinxiansheng/article/details/108629530
https://zhuanlan.zhihu.com/p/309287821
http://admin.guyuehome.com/34592

Guess you like

Origin blog.csdn.net/private_Jack/article/details/131122949