ORB-SLAM3中遇到的坑

笔记目录

  • 一. error: ‘usleep’ was not declared in this scope usleep(1000);
  • 二.sudo: rosdep:找不到命令
  • 三.pkg_resources.DistributionNotFound: The 'rospkg>=1.3.0' distribution was not found and is required by rosdep
  • 四.ERROR: cannot download default sources list from:https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/sources.list.d/20-default.listWebsite may be down.
  • 五.ERROR: Rosdep experienced an error: ('The read operation timed out',)
  • 学习时间


去年在跑orb-slam2中遇到了很多报错,今年发现有orb-slam3,决定解决一下以前的错误。相比orb-slam2,orb-slam3会更容易上手一些。先放一张跑成功的图片。

ORB-SLAM3中遇到的坑_第1张图片orb-slam3配置这里就不说了(参考博客: https://blog.csdn.net/qq_41807801/article/details/109807901),这里只记录bug。

主要问题处在运行build_ros.sh报错…后来发现翻个墙解决一下sudo rosdep init
rosdep update的问题就可以跑通了。

一. error: ‘usleep’ was not declared in this scope usleep(1000);

bug描述: 这个错误出自orb-slam2,意思是找不到头文件
解决方法:
在以下文件中加入#include

src中
LocaMapping.cc
Tracking.cc
System.cc
LoopClosing.cc
Viewer.cc

Examples/Monocular中
mono_euroc.cc
mono_kitti.cc
mono_tum.cc

Examples/RGB-D中
rgbd_tum.cc

/Examples/Stereo中
stereo_kitti.cc
stereo_euroc.cc

Examples/ROS/ORB_SLAM2/src/AR
ViewerAR.cc

二.sudo: rosdep:找不到命令

解决方法: 安装python-rosdep
sudo apt-get install python-rosdep
pip install rospkg
sudo rosdep init
sudo rosdep update

三.pkg_resources.DistributionNotFound: The ‘rospkg>=1.3.0’ distribution was not found and is required by rosdep

问题分析: ros默认python2,使用pip装的是python3的rospkg库需要装pip2然后pip2 install rospkg
解决方法: python2安装pip2
curl https://bootstrap.pypa.io/2.7/get-pip.py -o get-pip.py
python2 get-pip.py
pip2 install rospkg

四.ERROR: cannot download default sources list from:https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/sources.list.d/20-default.listWebsite may be down.

参考博客: https://blog.csdn.net/qq_44830040/article/details/106049992
解决方法: sudo rm /etc/ros/rosdep/sources.list.d/20-default.list

五.ERROR: Rosdep experienced an error: (‘The read operation timed out’,)


软件包的编译
chmod +x build.sh
./build.sh
chmod +x build_ros.sh
./build_ros.sh
export ROS_PACKAGE_PATH=${ROS_PACKAGE_PATH}:/home/…(这里填上你 ORB_SLAM3的具体路径)/ORB_SLAM3/Examples/ROS

最后记录一下运行步骤:
roscore

roslaunch usb_cam usb_cam-test.launch

rosrun ORB_SLAM3 Mono /home/wyd/catkin_ws/src/ORB_SLAM3/Vocabulary/ORBvoc.txt /home/wyd/catkin_ws/src/ORB_SLAM3/Examples/ROS/ORB_SLAM3/Asus.yaml

学习时间

2021.5.8


你可能感兴趣的:(ros,bug)