1.projectname
2.rospkg
3.
rospack found package "ORB_SLAM3" at "", but the current
directory is "/home/lc/ORB_SLAM3/Examples_old/ROS/ORB_SLAM3". You should
double-check your ROS_PACKAGE_PATH to ensure that packages are found in the
correct precedence order.
export ROS_PACKAGE_PATH=${ROS_PACKAGE_PATH}:/home/lc/ORB_SLAM3/Examples_old/ROS
ros inintial
4.sophus/se3.hpp: No such file or directory
git clone https://github.com/strasdat/Sophus.git
cd Sophus/
mkdir build
cd build
cmake ..
make
sudo make install
5.error: conversion from ‘Sophus::SE3f {aka Sophus::SE3}’ to non-scalar type ‘cv::Mat’ requested
error: no matching function for call to ‘std::vectorcv::Mat::push_back(Eigen::Vector3f)’
error: conversion from ‘Eigen::Vector3f {aka Eigen::Matrix<float, 3, 1>}’ to non-scalar type ‘cv::Mat’ requested
https://github.com/UZ-SLAMLab/ORB_SLAM3/issues/442
系统环境 ubuntu 18.04 , melodic, opencv4.0(本地编译 仅make 未make install,考虑兼容性问题未安装)
解决办法:
1、编译ros版本,需要将Examples_old文件夹下ROS文件夹复制到Examples文件夹下。将CMakeLists中用到OpenCV4的地方,连接到你的库位置。
2、将路径添加至~/.bashrc,这部分参考官方文档,运行./build.sh ./build_ros.sh
3、提示找不到sophus库,修改CMAKELISTS, include_directories中添加 ${PROJECT_SOURCE_DIR}/../../../Thirdparty/Sophus
4、Sophus::SE3f, cv::MAT,Eigen::Vector3f类型转换报错,应该是不能直接转换,不过可以换个办法,
解决 cv::Mat Tcw = mpSLAM->TrackMonocular(cv_ptr->image,cv_ptr->header.stamp.toSec()); 报错
cv::Mat Tcw;
Sophus::SE3f Tcw_SE3f = mpSLAM->TrackMonocular(cv_ptr->image,cv_ptr->header.stamp.toSec());
Eigen::Matrix4f Tcw_Matrix = Tcw_SE3f.matrix();
cv::eigen2cv(Tcw_Matrix, Tcw);
解决 vPoints.push_back(pMP->GetWorldPos()); 报错
cv::Mat WorldPos;
cv::eigen2cv(pMP->GetWorldPos(), WorldPos);
vPoints.push_back(WorldPos);
解决 cv::Mat Xw = pMP->GetWorldPos();报错
cv::Mat Xw;
cv::eigen2cv(pMP->GetWorldPos(), Xw);
再编译,没有其他问题的话正常编译通过。
5、回到 workspace目录下面 ,source下环境,rosrun ORB_SLAM3 Stereo_Inertial ./src/ORB_SLAM3/Vocabulary/ORBvoc.txt ./src/ORB_SLAM3/Examples_old/Stereo-Inertial/EuRoC.yaml true,就可以正常运行,新版本的yaml文件不知道为啥运行会报错,暂时未研究。
6.error: ‘eigen2cv’ is not a member of ‘cv’
+head
#include <Eigen/Dense>
#include <opencv2/core/eigen.hpp>
#include <opencv2/opencv.hpp>
'build_ros.sh' is waiting for updating · Issue #479 · UZ-SLAMLab/ORB_SLAM3 · GitHub
注释掉cmakelist中关于AR的部分解决问题
# Node for monocular camera (Augmented Reality Demo)
#rosbuild_add_executable(MonoAR
#src/AR/ros_mono_ar.cc
#src/AR/ViewerAR.h
#src/AR/ViewerAR.cc
#)
#target_link_libraries(MonoAR
#${LIBS}
#)
7.rosrun ORB_SLAM3 Mono Vocabulary/ORBvoc.txt Examples/ROS/ORB_SLAM3/Asus.yaml
/home/mr-mmm/SLAM/ORB_SLAM3/Examples/ROS/ORB_SLAM3/Mono: error while loading shared libraries: libDBoW2.so: cannot open shared object file: No such file or directory
error while loading shared libraries - ROS Answers: Open Source Q&A Forum
*.so 移动到 /usr/lib/ 解决问题
8.(ORB_SLAM3 + ROS采坑实录(从零开始的毕设生活第一弹) - 藏原走 - 博客园)
Aborted (core dumped)" when running Ros example
run Mono_Inertial Segmentation fault (core dumped)
run Mono_Inertial Segmentation fault (core dumped) · Issue #333 · UZ-SLAMLab/ORB_SLAM3 · GitHubz