一、修改配置文件
1、修改mynteye_stereo_config.yaml
这里的话题订阅,自己写错了,搞了很久,发现话题不存在,根本无法运行,后来才发现,差点晕死过去
错误:
image0_topic: “/mynteye/left/image_raw”
image1_topic: “/mynteye/right/image_raw”
正确:
image0_topic: “/mynteye/left/image_color”
image1_topic: “/mynteye/right/image_color”
%YAML:1.0
#common parameters
#support: 1 imu 1 cam; 1 imu 2 cam: 2 cam;
imu: 0 #不使用IMU
num_of_cam: 2 #相机数量
imu_topic: "/mynteye/imu/data_raw"
image0_topic: "/mynteye/left/image_color"
image1_topic: "/mynteye/right/image_color"
output_path: "/home/tong/output/"
cam0_calib: "left_pinhole.yaml"
cam1_calib: "right_pinhole.yaml"
image_width: 640
image_height: 480
# IMU与相机之间的外参
estimate_extrinsic: 0 # 0 有一个精准的外参. We will trust the following imu^R_cam, imu^T_cam, don't change it.
# 1 有一个初始估计值. We will optimize around your initial guess.
body_T_cam0: !!opencv-matrix
rows: 4
cols: 4
dt: d
data: [ 4.2812441490024389e-03, -9.9997001507473682e-01,
-6.4528985710044385e-03, 5.2583356071589790e-05,
9.9996900935734523e-01, 4.2384270612576547e-03,
6.6344601088757426e-03, -4.2174706544162562e-02,
-6.6069110351583190e-03, -6.4811023350536514e-03,
9.9995717110239080e-01, 1.9238715201769417e-02, 0., 0., 0., 1. ]
body_T_cam1: !!opencv-matrix
rows: 4
cols: 4
dt: d
data: [ 1.6525177162010074e-03, -9.9998509853672479e-01,
-5.2030654132755290e-03, -2.9251875934051923e-03,
9.9994935393851081e-01, 1.6007594247438028e-03,
9.9361525360214843e-03, 7.4379061731550719e-02,
-9.9276756168115085e-03, -5.2192215666013279e-03,
9.9993709851324453e-01, 1.9302672329335892e-02, 0., 0., 0., 1. ]
#开启几个线程
multiple_thread: 1
#feature traker paprameters
max_cnt: 150 # 特征点跟踪中最大特征点数量
min_dist: 30 # 两个特征点的最小距离
freq: 10 # 发布跟踪结果的频率(hz). At least 10Hz for good estimation. If set 0, the frequence will be same as raw image
F_threshold: 1.0 # ransac阈值(像素)
show_track: 1 # 发布跟踪图像作为话题
#提高精度的一个算法flag:执行前向和后向光流,以提高特征跟踪精度
flow_back: 1 # perform forward and backward optical flow to improve feature tracking accuracy
#optimization parameters
max_solver_time: 0.04 # 最大求解迭代时间(ms),保证实时性
max_num_iterations: 8 # 最大求解次数,保证实时性
keyframe_parallax: 10.0 # 关键帧选择阈值(像素)
2、修改左右镜头配置文件
left_pinhole.yaml和right_pinhole.yaml
左:
%YAML:1.0
---
model_type: PINHOLE
camera_name: camera
image_width: 640
image_height: 480
distortion_parameters:
k1: -2.9968643188476562e-01
k2: 8.1668853759765625e-02
p1: 8.3923339843750000e-05
p2: 2.4032592773437500e-04
projection_parameters:
fx: 3.5571792602539062e+02
fy: 3.5605810546875000e+02
cx: 3.3191314697265625e+02
cy: 2.4654791259765625e+02
右:
%YAML:1.0
---
model_type: PINHOLE
camera_name: camera
image_width: 640
image_height: 480
distortion_parameters:
k1: -2.8634262084960938e-01
k2: 6.8401336669921875e-02
p1: 6.6375732421875000e-04
p2: -3.3569335937500000e-04
projection_parameters:
fx: 3.5439492797851562e+02
fy: 3.5494696044921875e+02
cx: 3.2524218750000000e+02
cy: 2.4891598510742188e+02
二、启动相机
source ~/catkin_ws_fusion_sample/src/MYNT-EYE-D-SDK/wrappers/ros/devel/setup.bash
roslaunch /home/chen/catkin_ws_fusion_sample/src/MYNT-EYE-D-SDK/wrappers/ros/src/mynteye_wrapper_d/launch/mynteye.launch stream_mode:=1
三、启动港科大的VINS-Fusion
分别启动三个终端:
roslaunch vins vins_rviz.launch
rosrun vins vins_node ~/catkin_ws_ccc/src/VINS-Fusion-master/config/mynteye/mynteye_stereo_config.yaml
rosrun loop_fusion loop_fusion_node ~/catkin_ws_ccc/src/VINS-Fusion-master/config/mynteye/mynteye_stereo_config.yaml