Ubuntu 18.04 running vins mono with D435i

Operating environment

  • Linux: Ubuntu18.04
  • ros: Melodic

1. Create a new ROS project directory folder

mkdir catkin_ws
cd catkin_ws
mkdir src
catkin_make

2. In the src folder, download and install the source code function package related to vins mono and compile it

https://github.com/intel-ros/realsense.git : SDK 2.0 development kit related to D435i depth camera
https://github.com/HKUST-Aerial-Robotics/VINS-Mono.git : vins mono related source code

cd src
git clone https://github.com/intel-ros/realsense.git
git clone https://github.com/HKUST-Aerial-Robotics/VINS-Mono.git
cd ..
catkin_make

3. Download relevant data sets and test them with the of data sets

3.1 download the data set and test it with the of the data set

Download site link for dataset: Dataset download link
https://projects.asl.ethz.ch/datasets/doku.php?id=kmavvisualinertialdatasets

The test downloads a data set package of MH_01_easy.bag (2.5G in size)

3.2 test with data set

source ~/catkin_ws/devel/setup.bash
roslaunch vins_estimator euroc.launch
roslaunch vins_estimator vins_rviz.launch

Use rosbag play to run the dataset package, and the downloaded dataset package is MH_01_easy.bag (2.5G in size)

rosbag play MH_01_easy.bag 

3.3 test results

  • Relevant windows obtained from dataset test

4. Run vins mono with D435i depth camera

4.1 modify camera startup parameter file

1) Modify RS in realsense function pack_ Camera.launch file

  • First, modify unite_imu_method is copy
  • And set enable_gyro and enable_ Modify the access parameter to true
  • In this way, the angular velocity and acceleration of IMU can be output as a topic, and the output topic is / camera/imu
<arg name="unite_imu_method"      default="copy"/>
<arg name="enable_gyro"         default="true"/>
<arg name="enable_accel"        default="true"/>
  • Second, modify enable_ The sync parameter is true. Here is the synchronization between the camera and IMU
<arg name="enable_sync"           default="true"/>

2) . verify whether the output topic contains / camera/imu

roslaunch realsense2_camera rs_camera.launch
rostopic list

The topics are as follows:

/camera/accel/imu_info
/camera/color/camera_info
/camera/color/image_raw
/camera/depth/camera_info
/camera/depth/image_rect_raw
/camera/extrinsics/depth_to_color
/camera/gyro/imu_info
/camera/imu
/camera/motion_module/parameter_descriptions
/camera/motion_module/parameter_updates
/camera/realsense2_camera_manager/bond
/camera/rgb_camera/auto_exposure_roi/parameter_descriptions
/camera/rgb_camera/auto_exposure_roi/parameter_updates
/camera/rgb_camera/parameter_descriptions
/camera/rgb_camera/parameter_updates
/camera/stereo_module/auto_exposure_roi/parameter_descriptions
/camera/stereo_module/auto_exposure_roi/parameter_updates
/camera/stereo_module/parameter_descriptions
/camera/stereo_module/parameter_updates
/diagnostics
/rosout
/rosout_agg
/tf
/tf_static

4.2 modify relevant configuration files in vins mono package

Modify realsense in vins mono package_ color_ Config.yaml file

  • First, modify the topic of the subscription
imu_topic: "/camera/imu"
image_topic: "/camera/color/image_raw"
  • Second, modify the camera internal parameters. Here, open and run realsesne package again, and then obtain the camera internal parameters through the following command
rostopic echo /camera/color/camera_info

It mainly modifies the parameters related to the picture size of the camera

image_height: 720
image_width: 1280
  • Third, the transformation matrix from IMU to camera is modified to 2 according to the notes
# Extrinsic parameter between IMU and Camera.
estimate_extrinsic: 2   # 0  Have an accurate extrinsic parameters. We will trust the following imu^R_cam, imu^T_cam, don't change it.
                        # 1  Have an initial guess about extrinsic parameters. We will optimize around your initial guess.
                        # 2  Don't know anything about extrinsic parameters. You don't need to give R,T. We will try to calibrate it. Do some rotation movement at beginning.                        
#If you choose 0 or 1, you should write down the following matrix.
  • Fourth, IMU parameters. Here, all the parameters annotated are modified
#imu parameters       The more accurate parameters you provide, the better performance
acc_n: 0.2          # accelerometer measurement noise standard deviation. #0.2
gyr_n: 0.05         # gyroscope measurement noise standard deviation.     #0.05
acc_w: 0.02         # accelerometer bias random work noise standard deviation.  #0.02
gyr_w: 4.0e-5       # gyroscope bias random work noise standard deviation.     #4.0e-5
g_norm: 9.80       # gravity magnitude
  • Fifth, whether it is necessary to estimate the synchronization time difference online. Choose no here according to the suggestions of other bloggers
#unsynchronization parameters
estimate_td: 0                      # online estimate time offset between camera and imu
td: 0.000                           # initial value of time offset. unit: s. readed image clock + td = real image clock (IMU clock)
  • Sixth, change the camera exposure to global exposure
#rolling shutter parameters
rolling_shutter: 0                      # 0: global shutter camera, 1: rolling shutter camera
rolling_shutter_tr: 0               # unit: s. rolling shutter read out time per frame (from data sheet). 

4.3 turn on the camera and run vins mono

roslaunch realsense2_camera rs_camera.launch 
roslaunch vins_estimator realsense_color.launch 
roslaunch vins_estimator vins_rviz.launch
  • Relevant windows obtained by running vins mono

Relevant reference links:

Relevant vins mono reference links:

Tags: Linux Ubuntu slam Autonomous vehicles

Posted on Wed, 10 Nov 2021 06:59:23 -0500 by msing