过程记录
背景
实验室笔记本上想跑一下vins-fusion。但是因为是有毕业师兄的代码,不敢随意破坏环境。
电脑环境:
ubuntu 20.04
opencv 3.3.1 和 4.2.0
Error:
vins-fusion中修改CMakeLists.txt,find_package(OpenCV 3.3.1 REQUIRED),正常编译通过,但是运行时会发生报错
[vins_estimator-3] process has died [pid 207403, exit code 1, cmd /home/robot/toniht_ws/vins_ws/devel/lib/vins/vins_node __name:=vins_estimator __log:=/home/robot/.ros/log/66df44e6-69a3-11ee-9b57-ed49ddae8523/vins_estimator-3.log].
log file: /home/robot/.ros/log/66df44e6-69a3-11ee-9b57-ed49ddae8523/vins_estimator-3*.log
opencv版本和cv_bridge版本不对应
Fix:
选择对应分支的vision_opencv
cd ~/vins_catkin_ws/src
git clone https://github.com/ros-perception/vision_opencv.git --branch melodic # melodic对应1.13版本
# 我只想保留cv_bridge,想带着vision_opencv的可以不做
mv vision_opencv/cv_bridge ./
rm -rf vision_opencv
修改cv_bridge中的CMakeLists.txt和package.xml
# CMakeLists.txt
project(cv_bridge_331)
# package.xml
<name>cv_bridge_331</name>
cd ~/vins_catkin_ws
catkin_make # 此时,src中要求只有cv_bridge,方便后面再编译时让vins找到cv_bridge_331