Step 1: write camchain Yaml. For specific parameters, refer to the yaml file obtained above. No parameters can be deleted.
cam0: camera_model: pinhole distortion_coeffs: [0.3741003900681439, -0.3881978058678547, 3.1716618459908745, -6.001063348025562] distortion_model: equidistant intrinsics: [390.758503853357, 391.25816160400524, 321.83897980850134, 239.4465181428646] resolution: [640, 480] rostopic: /infra_left cam1: T_cn_cnm1: - [0.9999998901585861, -4.294157013095873e-05, 0.00046673208390293774, -0.05012845047306967] - [4.2939084706306155e-05, 0.9999999990638859, 5.335182709763375e-06, -4.592119433712806e-05] - [-0.00046673231256714554, -5.315141075253501e-06, 0.9999998910663435, 2.7033932716557476e-06] - [0.0, 0.0, 0.0, 1.0] camera_model: pinhole distortion_coeffs: [0.34234774358277686, 0.11586227173983633, 0.1467711250555194, -0.10482812645454345] distortion_model: equidistant intrinsics: [390.99220733802025, 391.5150578117259, 321.8225997794459, 239.3566665455548] resolution: [640, 480] rostopic: /infra_right
Step 2: write imu Yam, the specific parameters use the parameters calibrated by imu before
accelerometer_noise_density: 1.3105289977393427e-02 accelerometer_random_walk: 2.6279926558638435e-04 gyroscope_noise_density: 1.5606318435633282e-03 gyroscope_random_walk: 1.6355489539708390e-05 rostopic: /imu update_rate: 200.0
Step 3: prepare the previous checkerboard Yaml file
Step 4: copy RS in realsense ROS package_ camera. Launch, renamed rs_imu_stereo.launch, change to
Will
<arg name="enable_sync" default="false"/>
Replace with:
<arg name="enable_sync" default="true"/>
This aligns the imu and binocular data in time
take
<arg name="unite_imu_method" default=""/>
Change to
<arg name="unite_imu_method" default="linear_interpolation"/>
This ensures that there will be imu topics
Step 5: start realsense
I'm at ~ / catkin_ Run in WS $!! After the recording of file data, the storage place is also in / catkin_ws)
roslaunch realsense2_camera rs_imu_stereo.launch
Step 6: turn off IR structured light, refer to the above
rosrun rqt_reconfigure rqt_reconfigure
Open camera - > stereo_ Emitter in module_ Enabled set to off(0)
Step 7: open rviz, add imu topic, infra1 topic and infra2 topic, and adjust the position of realsense d435i to ensure that the binocular image data always contains all the contents of the calibration board
Step 8: adjust the publishing frequency of imu and binocular topic and publish them with a new topic name. The publishing frequency of binocular image is changed to 20Hz and imu is changed to 200Hz
Use Ctrl+shift+T to open a new terminal. One terminal runs the other, running separately
rosrun topic_tools throttle messages /camera/infra1/image_rect_raw 20.0 /infra_left rosrun topic_tools throttle messages /camera/infra2/image_rect_raw 20.0 /infra_right rosrun topic_tools throttle messages /camera/imu 200.0 /imu
Step 9: start recording the data packet. Similarly, note that the binocular image should include the whole calibration board in the whole process. At the same time, it should not move too fast, which will cause the image to be too blurred and move back and forth in the front, back, left, right, up and down directions. It can be recorded for about 90 seconds and not used for 15 seconds. The recording command is:
Use Ctrl+shift+T to open another new terminal to run
rosbag record -O imu_stereo.bag /infra_left /infra_right /imu
Its generated file IMU_ stereo. The bag is located in the path of running and starting the realsense terminal. You should copy it and put it in kalibr_ In workspace, put it together with the folder of the following calibration command.
Step 10: start calibration, and the calibration command is
kalibr_calibrate_imu_camera --target checkerboard.yaml --cam camchain.yaml --imu imu.yaml --bag imu_stereo.bag –show-extraction
Finally, four files are generated:
camchain-imucam-imu_stereo.yaml
imu-imu_stereo.yaml
report-imucam-imu_stereo.pdf
results-imucam-imu_stereo.txt