VINS-MONO Realsense d455运行记录

发布时间 2023-10-26 15:41:09作者: 小帆敲代码

安装VINS-Mono

创建工作空间

mkdir -p ~/vins_mono_ws/src   # 创建了第二层级的文件夹src,这是放ROS软件包的地方
cd ~/vins_mono_ws/src         # 进入工作空间,catkin_make必须在工作空间这个路径上执行
catkin_init_workspace         # 初始化src目录,生成的CMakeLists.txt为功能包编译配置

安装VINS-Mono

cd ~/vins_mono_ws/src
git clone https://github.com/HKUST-Aerial-Robotics/VINS-Mono.git
cd ..
catkin_make -j8
source ~/catkin_ws/devel/setup.bash # 刷新坏境

OpenCV版本问题

可以编译不同版本的cv_bridge::
https://blog.csdn.net/cym_hnu/article/details/130007829

运行时,/home/tony-ws1/output/pose_graph/ not exists

https://blog.csdn.net/weixin_43297891/article/details/115441480

使用Realsense d455运行

https://blog.csdn.net/weixin_44580210/article/details/89789416#t4

修改realsense包里的rs_camera.launch文件

我的路径是在:/opt/ros/noetic/share/realsense2_camera/launch

  • 修改unite_imu_method如下,这里是让IMU的角速度和加速度作为一个topic输出
 <arg name="unite_imu_method"      default="copy"/>
  • 修改enable_sync参数为true,这里是开机相机和IMU的同步
  <arg name="enable_sync"           default="true"/>

修改VINS-Mono包里的realsense_color_config.yaml文件

  • 修改订阅的topic
imu_topic: "/camera/imu"
image_topic: "/camera/color/image_raw"
  • 相机内参,通过打开运行 realsense 包获取内参
roslaunch realsense2_camera rs_camera.launch  # 运行realsense
rostopic echo /camera/color/camera_info       # 获取内参
  • IMU到相机的变换矩阵,根据注释的提示修改成2
# 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.

TODO: 因为在运行ORBSLAM3时进行过标定,但是结果不行,这里一会尝试一下使用标定的

  • IMU参数
#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
  • 是否需要在线估计同步时差,根据上述博主的建议这里选择不需要
#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)
  • 相机曝光改成全局曝光
#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). 

充分怀疑Realsense在ORBSLAM3上面出现问题是因为这个

运行

roslaunch realsense2_camera rs_camera.launch 
roslaunch vins_estimator realsense_color.launch 
roslaunch vins_estimator vins_rviz.launch

我重命名了一些文件,我的命令应该是:

roslaunch realsense2_camera rs_camera.launch
roslaunch vins_estimator realsense_color_d455.launch
roslaunch vins_estimator vins_rviz.launch

结果: