安装 VINS-fusion VINS-Mono
将vins-mono 下载到ros工作空间catkin_ws里面
cd /home/jiangz/catkin_ws/src
git clone https://github.com/HKUST-Aerial-Robotics/VINS-Fusion.git
遇到的bug基本可以通过下面三个解决
进入调试模式 :https://www.cxybb.com/article/u014527548/86503256
**opencv4 安装 VINS :遇到的bug
千万不要多安装一个opencv3!!!**会因为两个库冲突,导致segment fault!
https://zhuanlan.zhihu.com/p/432167383
https://blog.csdn.net/tjj1998/article/details/110500320
ceres问题 :
https://blog.csdn.net/weixin_56024057/article/details/128344034
使用T265相机启动
由于VINS-Fusion里面的t265相机的yaml包已经没有了,这次测试 VINS—Mono的
roslaunch vins_estimator realsense_fisheye.launch
roslaunch vins_estimatot vins_rviz.launch
rosbag play xxx.bag
注意需要修改 realsense_fisheye.launch 里面的相机内参,tpoic和输出路径名字
内参的来源参考了这篇文章:https://blog.csdn.net/weixin_45810108/article/details/116917579
%YAML:1.0
#common parameters
imu_topic: "/camera/imu"
image_topic: "/camera/fisheye1/image_raw"
output_path: "~/catkin_ws/src/VINS-Fusion-master/vins_output"
#camera calibration
model_type: KANNALA_BRANDT
camera_name: camera
image_width: 848
image_height: 800
projection_parameters:
k2: -0.00836907513439655
k3: 0.0468319803476334
k4: -0.0438220910727978
k5: 0.00818893685936928
mu: 285.814514160156
mv: 285.921997070312
u0: 424.557891845703
v0: 394.814086914062
# Extrinsic parameter between IMU and Camera.
estimate_extrinsic: 1 # 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.
#Rotation from camera frame to imu frame, imu^R_cam
extrinsicRotation: !!opencv-matrix
rows: 3
cols: 3
dt: d
data: [0.99992917, 0.00878151, 0.00803387,
-0.00870674, 0.9999189, -0.0092943,
-0.00811483, 0.00922369, 0.99992453]
#Translation from camera frame to imu frame, imu^T_cam
extrinsicTranslation: !!opencv-matrix
rows: 3
cols: 1
dt: d
data: [0.00188568, 0.00123801, 0.01044055]
#feature traker paprameters
max_cnt: 120 # max feature number in feature tracking
min_dist: 30 # min distance between two features
freq: 10 # frequence (Hz) of publish tracking result. At least 10Hz for good estimation. If set 0, the frequence will be same as raw image
F_threshold: 1.0 # ransac threshold (pixel)
show_track: 1 # publish tracking image as topic
equalize: 0 # if image is too dark or light, trun on equalize to find enough features
fisheye: 0 # if using fisheye, trun on it. A circle mask will be loaded to remove edge noisy points
#optimization parameters
max_solver_time: 0.04 # max solver itration time (ms), to guarantee real time
max_num_iterations: 8 # max solver itrations, to guarantee real time
keyframe_parallax: 10.0 # keyframe selection threshold (pixel)
#imu parameters The more accurate parameters you provide, the better performance
acc_n: 0.08 # accelerometer measurement noise standard deviation. #0.2 0.04
gyr_n: 0.004 # gyroscope measurement noise standard deviation. #0.05 0.004
acc_w: 0.00004 # accelerometer bias random work noise standard deviation. #0.02
gyr_w: 2.0e-6 # gyroscope bias random work noise standard deviation. #4.0e-5
g_norm: 9.805 # gravity magnitude
#loop closure parameters
loop_closure: 1 # start loop closure
fast_relocalization: 1 # useful in real-time and large project
load_previous_pose_graph: 0 # load and reuse previous pose graph; load from 'pose_graph_save_path'
pose_graph_save_path: "~/catkin_ws/src/VINS-Fusion-master/vins_output/pose_graph/" # save and load path
#unsynchronization parameters
estimate_td: 1 # online estimate time offset between camera and imu
td: 0.010 # 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).
#visualization parameters
save_image: 1 # save image in pose graph for visualization prupose; you can close this function by setting 0
visualize_imu_forward: 0 # output imu forward propogation to achieve low latency and high frequence results
visualize_camera_size: 0.4 # size of camera marker in RVIZ
效果:
不咋地,会漂移,具体原因还需要进一步的探究,但是终究是跑起来了555
vins-fusion gps融合代码
环境要求:
vision-opencv noetic分支
opencv 4.2
ceres 1.4
rosrun vins vins_node <path>/xxx.yaml
rosrun global_fusion global_fusion_node
rosbag play xxx.bag
输出topic: /globalEstimator/global_odometry