ubuntu20.04跑PL-VINS

2023-05-16

PL-VINS源码:https://github.com/cnqiangfu/PL-VINS

编译时报错

catkin_make

Ceres报错

报错信息

CMake Error at /usr/local/lib/cmake/Ceres/CeresConfig.cmake:85 (message):
  Failed to find Ceres - Found Eigen dependency, but the version of Eigen
  found (3.4.0) does not exactly match the version of Eigen Ceres was
  compiled with (3.3.7).  This can cause subtle bugs by triggering violations
  of the One Definition Rule.  See the Wikipedia article
  http://en.wikipedia.org/wiki/One_Definition_Rule for more details
Call Stack (most recent call first):
  /usr/local/lib/cmake/Ceres/CeresConfig.cmake:200 (ceres_report_not_found)
  PL-VINS/camera_model/CMakeLists.txt:19 (find_package)


CMake Error at PL-VINS/camera_model/CMakeLists.txt:19 (find_package):
  Found package configuration file:

    /usr/local/lib/cmake/Ceres/CeresConfig.cmake

  but it set Ceres_FOUND to FALSE so package "Ceres" is considered to be NOT
  FOUND.


-- Configuring incomplete, errors occurred!
See also "/home/tian/projects/catkin_plvins/build/CMakeFiles/CMakeOutput.log".
See also "/home/tian/projects/catkin_plvins/build/CMakeFiles/CMakeError.log".
make: *** [Makefile:320:cmake_check_build_system] 错误 1
Invoking "make cmake_check_build_system" failed

解决方案
重新编译了ceres

sudo make install

Ceres报错未定义某种类型

把Cmake的C++版本调到14,因为这种类型是在C++14中定义的,C++11及以前没有

另一个报错

/home/tian/projects/catkin_plvins/src/PL-VINS/feature_tracker/src/linefeature_tracker.h:18:10: fatal error: line_descriptor_custom.hpp: 没有那个文件或目录
   18 | #include "line_descriptor_custom.hpp"

PL-VINS/feature_tracker/CMakeLists.txt里的路径写错了,焯!

opencv报错

报错信息
‘CV_RGB2GRAY’ was not declared in this scope
版本问题,改一下宏定义。

pose_graph.cpp keyframe.cpp
CV_FONT_HERSHEY_SIMPLEX -> cv::FONT_HERSHEY_SIMPLEX
/feature_tracker/src/linefeature_tracker.cpp
CV_INTER_LINEAR - > cv::INTER_LINEAR

https://blog.csdn.net/weixin_43421058/article/details/119139425?spm=1001.2014.3001.5502

feature_tracker/src/linefeature_tracker.cpp:360:32: error: ‘CV_WINDOW_NORMAL’ was not declared in this scope

#include “linefeature_tracker.h” 中添加 #include <opencv2/highgui/highgui_c.h>

编译时警告

/usr/bin/ld: warning: libopencv_imgproc.so.3.4, needed by /home/tian/projects/catkin_plvins/devel/lib/libcamera_model.so, may conflict with libopencv_imgproc.so.4.2
/usr/bin/ld: warning: libopencv_core.so.3.4, needed by /home/tian/projects/catkin_plvins/devel/lib/libcamera_model.so, may conflict with libopencv_core.so.4.2
/usr/bin/ld: warning: libopencv_imgproc3.so.3.3, needed by /home/tian/projects/catkin_plvins/src/PL-VINS/feature_tracker/src/line_descriptor/lib/liblinedesc.so, not found (try using -rpath or -rpath-link)
/usr/bin/ld: warning: libopencv_core3.so.3.3, needed by /home/tian/projects/catkin_plvins/src/PL-VINS/feature_tracker/src/line_descriptor/lib/liblinedesc.so, not found (try using -rpath or -rpath-link)
[100%] Built target LineFeature_tracker

运行时报错

[linefeature_tracker-4] process has died [pid 64095, exit code 127, cmd /home/tian/projects/catkin_plvins/devel/lib/feature_tracker/LineFeature_tracker __name:=linefeature_tracker __log:=/home/tian/.ros/log/bb25222c-a43e-11ec-a1bb-1358954dce55/linefeature_tracker-4.log].
log file: /home/tian/.ros/log/bb25222c-a43e-11ec-a1bb-1358954dce55/linefeature_tracker-4*.log

有人说是因为3.4.6版本以后把LSD部分去掉了,看了一下我的3.4.15的源码确实LSD.cpp少了近一千行。
尝试把低版本的实现直接拷贝到工程里,但整不太明白,决定放弃这一路线,再安装一个3.2.0版的opencv.

编译opencv3.2.0

fatal error: stdlib.h: 没有那个文件或目录
解决:
https://stackoverflow.com/questions/40262928/error-compiling-opencv-fatal-error-stdlib-h-no-such-file-or-directory

报错:

/home/tian/libs/opencv-3.2.0/modules/videoio/src/cap_ffmpeg_impl.hpp:1541:21: error: ‘CODEC_FLAG_GLOBAL_HEADER’ was not declared in this scope; did you mean ‘AV_CODEC_FLAG_GLOBAL_HEADER’?
 1541 |         c->flags |= CODEC_FLAG_GLOBAL_HEADER;
      |                     ^~~~~~~~~~~~~~~~~~~~~~~~
      |                     AV_CODEC_FLAG_GLOBAL_HEADER

解决:https://blog.csdn.net/guo_lei_lamant/article/details/81568346

cv2.cpp const 错误:
https://forums.raspberrypi.com/viewtopic.php?t=251274

换了cvbridge

https://gitee.com/bingobinlw/cv_bridge
节点还是挂了但正常了很多

[image_node_b-7] process has died [pid 59826, exit code -6, cmd /home/tian/projects/catkin_plvins/devel/lib/image_node_b/image_node_b __name:=image_node_b __log:=/home/tian/.ros/log/6c262928-a529-11ec-9cfa-6db51d71f3b4/image_node_b-7.log].
log file: /home/tian/.ros/log/6c262928-a529-11ec-9cfa-6db51d71f3b4/image_node_b-7*.log
terminate called after throwing an instance of 'cv::Exception'
  what():  OpenCV(3.4.15) /home/tian/libs/opencv-3.4.15/modules/imgproc/src/lsd.cpp:139: error: (-213:The function/feature is not implemented) Implementation has been removed due original code license issues in function 'LineSegmentDetectorImpl'

[linefeature_tracker-4] process has died [pid 59823, exit code -6, cmd /home/tian/projects/catkin_plvins/devel/lib/feature_tracker/LineFeature_tracker __name:=linefeature_tracker __log:=/home/tian/.ros/log/6c262928-a529-11ec-9cfa-6db51d71f3b4/linefeature_tracker-4.log].
log file: /home/tian/.ros/log/6c262928-a529-11ec-9cfa-6db51d71f3b4/linefeature_tracker-4*.log
^C[pose_graph-6] killing on exit
[plvins_estimator-5] killing on exit
[feature_tracker-3] killing on exit
[rvizvisualisation-2] killing on exit
terminate called without an active exception
terminate called without an active exception
QFileSystemWatcher::removePaths: list is empty
QFileSystemWatcher::removePaths: list is empty
[rosout-1] killing on exit
[master] killing on exit
shutting down processing monitor...
... shutting down processing monitor complete
done

最后发现cmake没改全,能跑了.

opencv环境变量配置

https://blog.csdn.net/public669/article/details/99044895

编译vinsmono

参考

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

ubuntu20.04跑PL-VINS 的相关文章

随机推荐