Ubuntu 18.04 ———(Intel RealSense D435i)运行VINS-Mono

一、准备工作

1、Intel Realsense D435i、Ubuntu 18.04
2、已经安装好Realsense驱动
3、已经安装好VINS-Mono并且能运行数据集

二、修改参数

rs_camera.launch

  1. 修改部分参数【rs_camera.launch】;

第一处,修改unite_imu_method如下,这里是让IMU的角速度和加速度作为一个topic输出

#6450<arg name="unite_imu_method"      default="copy"/>

第二处,修改enable_sync参数为true,这里是开机相机和IMU的同步

#5250<arg name="enable_sync"           default="true"/>

第三处,修改enable_gyro,enable_accel为true;默认不发布

<arg name="enable_gyro"   default="true"/>
<arg name="enable_accel"  default="true"/>

realsense_color_config.yaml

1、订阅的topic

#common parameters
imu_topic: "/camera/imu"
image_topic: "/camera/color/image_raw"

2、相机的内参,通过读取camera_info得到或者自己标定,采用以下命令可以读取厂家的camera_info,但与实际可能存在差距。

rostopic echo /camera/color/camera_info

3、IMU到相机的变换矩阵
IMU到相机的变换矩阵,默认0这里我根据注释的提示修改成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.

这里IMU和camera之间的外参矩阵建议使用Kalibr工具进行离线标定,也可以改成1或者2让估计器自己标定和优化。

4、IMU参数,这个需要对IMU的噪声和Bias进行标定,同时重力加速度对结果有影响。

#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.81       # gravity magnitude

5、realsense d435i说是已经做好了硬件同步所以不需要在线估计同步时差(但是用kalibr标定出来和在线估计出来都存在大概-0.06的时间差)

#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)

6、相机曝光方式应为全局曝光

#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). 

然后就可以运行了

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

报错:

[ WARN] [1652767456.813384298]: waiting for image and imu...
vocabulary_file/home/sfann/catkin_ws/src/VINS-Mono/pose_graph/../support_files/brief_k10L6.bin
loop start load vocabulary
OpenCV Error: Assertion failed (_mask.empty() || (_mask.type() == CV_8UC1 && _mask.sameSize(_image))) in goodFeaturesToTrack, file /build/opencv-L2vuMj/opencv-3.2.0+dfsg/modules/imgproc/src/featureselect.cpp, line 366
terminate called after throwing an instance of 'cv::Exception'
  what():  /build/opencv-L2vuMj/opencv-3.2.0+dfsg/modules/imgproc/src/featureselect.cpp:366: error: (-215) _mask.empty() || (_mask.type() == CV_8UC1 && _mask.sameSize(_image)) in function goodFeaturesToTrack

BRIEF_PATTERN_FILE/home/sfann/catkin_ws/src/VINS-Mono/pose_graph/../support_files/brief_pattern.yml
/home/tony-ws1/output/pose_graph/ not exists, trying to create it 
/home/tony-ws1/output not exists, trying to create it 
/home/tony-ws1 not exists, trying to create it 
Failed to create folder /home/tony-ws1 
/home/tony-ws1/output/ not exists, trying to create it 
/home/tony-ws1 not exists, trying to create it 
Failed to create folder /home/tony-ws1 
no previous pose graph
[feature_tracker-1] process has died [pid 8424, exit code -6, cmd /home/sfann/catkin_ws/devel/lib/feature_tracker/feature_tracker __name:=feature_tracker __log:=/home/sfann/.ros/log/2a718c1c-d5a7-11ec-a32c-000c298e2de6/feature_tracker-1.log].
log file: /home/sfann/.ros/log/2a718c1c-d5a7-11ec-a32c-000c298e2de6/feature_tracker-1*.log
[ WARN] [1652767552.186227336]: image discontinue! detect a new sequence!
new sequence
sequence cnt 2 
[ WARN] [1652767557.666477363]: image discontinue! detect a new sequence!
new sequence
sequence cnt 3 
[ WARN] [1652767601.168880999]: image discontinue! detect a new sequence!
new sequence
sequence cnt 4 
[ WARN] [1652767626.179102064]: image discontinue! detect a new sequence!
new sequence
sequence cnt 5 
[ WARN] [1652767632.880353309]: image discontinue! detect a new sequence!
new sequence
sequence cnt 6 
[ WARN] [1652767632.908686706]: only support 5 sequences since it's boring to copy code for more sequences.
[FATAL] [1652767632.908739701]: BREAKPOINT HIT
	file = /home/sfann/catkin_ws/src/VINS-Mono/pose_graph/src/pose_graph_node.cpp
	line=77

[pose_graph-3] process has died [pid 8426, exit code -9, cmd /home/sfann/catkin_ws/devel/lib/pose_graph/pose_graph __name:=pose_graph __log:=/home/sfann/.ros/log/2a718c1c-d5a7-11ec-a32c-000c298e2de6/pose_graph-3.log].
log file: /home/sfann/.ros/log/2a718c1c-d5a7-11ec-a32c-000c298e2de6/pose_graph-3*.log

解决办法:

修改enable_gyro,enable_accel为true;默认不发布

<arg name="enable_gyro"   default="true"/>
<arg name="enable_accel"  default="true"/>

修改相机的图片大小相关参数,以及根据相机的内参矩阵K对相机的内参进行修改

image_width: 1280
image_height: 720

修改后的文件

在这里插入图片描述

参考文献

https://blog.csdn.net/weixin_44444810/article/details/121252009?
https://blog.csdn.net/qq_41839222/article/details/86552367

  • 2
    点赞
  • 18
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值