ubuntu20 运行GVINS遇到的问题

  • Post author:
  • Post category:其他




安装ROS

进入ROS官网

link


点击安装,跳转后点击

ROS Noetic Ninjemys


选择对应操作系统(本人是ubuntu20.04),按照步骤安装

安装完成后创建工作空间



下载GVINS源码并编译

进入github链接,https://github.com/HKUST-Aerial-Robotics/GVINS(

link

)

opencv_contrib4.2.0:link

首先安装各个依赖库,其中gnss_comm库需要下载到

catkin_ws/src

中,并编译

接着clone GVINS源码

// 下载源码
cd ~/catkin_ws/src/
git clone https://github.com/HKUST-Aerial-Robotics/GVINS.git;

编译

cd ~/catkin_ws/
catkin_make
source ~/catkin_ws/devel/setup.bash



编译遇到的错误

1.报如下错误

CMake Error at /opt/ros/noetic/share/cv_bridge/cmake/cv_bridgeConfig.cmake:113 (message):
  Project 'cv_bridge' specifies '/usr/include/opencv4' as an include dir,
  which is not found.  It does neither exist as an absolute directory nor in
  '${{prefix}}//usr/include/opencv4'.  Check the issue tracker
  'https://github.com/ros-perception/vision_opencv/issues' and consider
  creating a ticket if the problem has not been reported yet.

解决:修改

/opt/ros/noetic/share/cv_bridge/cmake/cv_bridgeConfig.cmake

中第96行

set(_include_dirs "include;/usr/include/opencv4")

改为

set(_include_dirs "include;/usr/local/include/opencv4")

2.如果同时安装了opencv3和opencv4版本,可能会默认使用opencv4库从而报许多错,这是由于opencv版本不同导致的,一个一个修改太麻烦,直接在将自己下载编译的opencv3中的build文件添加到

/home/d/catkin_ws/src/GVINS/camera_model/CMakeLists.txt

中,如

set(OpenCV_DIR /home/d/lib/opencv-3.4.2/build/)
find_package(OpenCV REQUIRED)

3.报如下错误

*** 没有规则可制作目标“/usr/lib/x86_64-linux-gnu/libopencv_calib3d.so.4.2.0”,由“/home/d/catkin_ws/devel/lib/gvins/gvins” 需求。 停止。

解决办法:

参考https://blog.csdn.net/sunjintaoxxx/article/details/121766965

link

文章中的办法

sudo ln -s -f -i /自己的libopencv_calib3d.so.4.2.0路径 /报错目录/xxx.so
sudo ln -s -f -i /home/d/lib/opencv-4.2.0/build/lib/libopencv_calib3d.so.4.2.0 /usr/lib/x86_64-linux-gnu/libopencv_calib3d.so.4.2.0

类似的这种错误还有很多,照着这个办法依次解决

sudo ln -s -f -i /home/d/lib/opencv-4.2.0/build/lib/libopencv_calib3d.so.4.2.0 /usr/lib/x86_64-linux-gnu/libopencv_calib3d.so.4.2.0
sudo ln -s -f -i /home/d/lib/opencv-4.2.0/build/lib/libopencv_dnn.so.4.2.0 /usr/lib/x86_64-linux-gnu/libopencv_dnn.so.4.2.0
sudo ln -s -f -i /home/d/lib/opencv-4.2.0/build/lib/libopencv_features2d.so.4.2.0 /usr/lib/x86_64-linux-gnu/libopencv_features2d.so.4.2.0
sudo ln -s -f -i /home/d/lib/opencv-4.2.0/build/lib/libopencv_flann.so.4.2.0 /usr/lib/x86_64-linux-gnu/libopencv_flann.so.4.2.0
sudo ln -s -f -i /home/d/lib/opencv-4.2.0/build/lib/libopencv_highgui.so.4.2.0 /usr/lib/x86_64-linux-gnu/libopencv_highgui.so.4.2.0
sudo ln -s -f -i /home/d/lib/opencv-4.2.0/build/lib/libopencv_ml.so.4.2.0 /usr/lib/x86_64-linux-gnu/libopencv_ml.so.4.2.0
sudo ln -s -f -i /home/d/lib/opencv-4.2.0/build/lib/libopencv_objdetect.so.4.2.0 /usr/lib/x86_64-linux-gnu/libopencv_objdetect.so.4.2.0
sudo ln -s -f -i /home/d/lib/opencv-4.2.0/build/lib/libopencv_photo.so.4.2.0 /usr/lib/x86_64-linux-gnu/libopencv_photo.so.4.2.0
sudo ln -s -f -i /home/d/lib/opencv-4.2.0/build/lib/libopencv_stitching.so.4.2.0 /usr/lib/x86_64-linux-gnu/libopencv_stitching.so.4.2.0
sudo ln -s -f -i /home/d/lib/opencv-4.2.0/build/lib/libopencv_video.so.4.2.0 /usr/lib/x86_64-linux-gnu/libopencv_video.so.4.2.0
sudo ln -s -f -i /home/d/lib/opencv-4.2.0/build/lib/libopencv_videoio.so.4.2.0 /usr/lib/x86_64-linux-gnu/libopencv_videoio.so.4.2.0



版权声明:本文为qq_51294589原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。