1.跑TUM_VI数据集dataset-corridor4_512
时,从tum_vi_example.sh
中复制对应的运行命令,输入命令后提示找不到对应的TUM_512.yaml
文件,查找对应路径发现只有一个TUM-VI.yaml
应该是作者新发布的版本进行了删改,tum_vi_example.sh
是作者早期发布的版本里提供的脚本,但是后来版本更新时不知道为什么给删掉了,找了一下作者以前发行版本的代码是有TUM_512.yaml
这个文件的,对比了一下两个文件的相关参数是一致的,只有个别参数变量不一样,所以在终端将TUM_512.yaml
替换为TUM-VI.yaml
即可。
[rosbuild] rospack found package “ORB_SLAM3” at “”,but the current directory is “xxx/ORB_SLAM3/Examples/ROS/ORB_SLAM3”.You should double-check your ROS_PACKAGE_PATH to ensure that package are found in te correct precedence order.
提示说ROS包路径有问题。这是因为你并没有把你当前的ROS代码路径添加到ROS_PACKAGE_PATH
环境变量中,导致找不到。解决办法也很简单,sudo gedit ~/.bashrc
打开编辑器,然后再末尾添加如下内容(注意对应路径要换成你自己的):
export ROS_PACKAGE_PATH=$ROS_PACKAGE_PATH:YOUR_PATH/Examples/ROS/ORB_SLAM3
修改完成后需要在终端刷新环境变量
source ~/.bashrc
2.ModuleNotFoundError: No module named ‘rospkg’
ModuleNotFoundError: No module named 'rospkg'
CMake Error at /opt/ros/melodic/share/ros/core/rosbuild/private.cmake:77 (message):
[rosbuild] Syntax check of ORB_SLAM3/manifest.xml failed; aborting
Call Stack (most recent call first):
/opt/ros/melodic/share/ros/core/rosbuild/public.cmake:174 (_rosbuild_check_manifest)
CMakeLists.txt:7 (rosbuild_init)
-- Configuring incomplete, errors occurred!
See also "/home/lusx/Demos/ORB-SLAM3/ORB_SLAM_uz/Examples_old/ROS/ORB_SLAM3/build/CMakeFiles/CMakeOutput.log".
解决方式:
pip install rospkg //更新方式1
sudo apt-get install python-rospkg //更新方式2
3./ImuTypes.h:29:10: fatal error: sophus/se3.hpp: No such file or directory
在ROS
目录下的CMakeLists.txt
的include_directories
加一句
${PROJECT_SOURCE_DIR}/../../../Thirdparty/Sophus
4.ROS版本编译成功之后,运行如下命令,出现segmentation fault(core dumped)
rosrun ORB_SLAM3 Mono_Inertial ../../../Vocabulary/ORBvoc.txt TUM-VI.yaml true
将ORB-SLAM3目录和ROS/ORBSLAM3目录下的CMakeLists.txt中opencv的版本换成3.2.0,然后重新编译后解决,成功出现UI界面
5.程序跑起来后,播放数据集并将相机和IMU的topic名称转换成ORBSLAM3需要的名称,但是系统没有订阅到相关话题,UI界面无图像显示,通过rqt_graph查看发现系统只订阅到了imu的数据
原因:ROS系统下双目和单目订阅的话题是不同的,所以需要转换成不同的话题名称,而且单目的相机只需要转换cam0一个相机的就可以了,,流泪。。。
跑单目SLAM
# 启动ROS
roscore
# 启动程序
rosrun ORB_SLAM3 Mono_Inertial ../../../Vocabulary/ORBvoc.txt ../../Monocular-Inertial/EuRoC.yaml true
# 播放数据集
rosbag play ~/data/EuRoc/MH_01_easy.bag /cam0/image_raw:=/camera/image_raw /imu0:=/imu
6.跑双目程序报错
Input sensor was set to: Stereo-Inertial
Loading settings from TUM-VI.yaml
Camera1.overlappingBegin required parameter does not exist, aborting...
OpenCV Error: Assertion failed (tlsSlots.size() > slotIdx) in releaseSlot, file /build/opencv-L2vuMj/opencv-3.2.0+dfsg/modules/core/src/system.cpp, line 1092
terminate called after throwing an instance of 'cv::Exception'
what(): /build/opencv-L2vuMj/opencv-3.2.0+dfsg/modules/core/src/system.cpp:1092: error: (-215) tlsSlots.size() > slotIdx in function releaseSlot
原因:虽然单目和双目,以及文件夹Example
Example_old
中的yaml
文件的名称都是一样的,但是不可以通用,,如果跑Stereo_Inertial
则需要使用Example_old/Stereo-Inertial/
中相应的文件,再次流泪。。。
跑双目数据集
#启动ROS
roscore
#启动程序
rosrun ORB_SLAM3 Stereo_Inertial ../../../Vocabulary/ORBvoc.txt ../../Stereo-Inertial/EuRoC.yaml true
#播放数据集
rosbag play ~/data/EuRoc/MH_01_easy.bag /cam0/image_raw:=/camera/left/image_raw /cam1/image_raw:=/camera/right/image_raw /imu0:=/imu
放一张漂亮的轨迹图