流程一览
配置ROS
ROS环境准备(以16.04 ROS Kinetic为例)
sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /
, → etc/apt/sources.list.d/ros-latest.list'
sudo apt-key adv --keyserver 'hkp://keyserver.ubuntu.com:80' --recv-key␣
, → C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654
sudo apt-get update
sudo apt-get install ros-kinetic-desktop-full
sudo rosdep init
rosdep update
echo "source /opt/ros/kinetic/setup.bash" >> ~/.bashrc
source ~/.bashrc
创建自己的工作空间:
mkdir -p ~/catkin_ws/src //创建文件夹
cd ~/catkin_ws/src //定位到src
catkin_init_workspace //对工作空间进行初始化
配置ORBSLAM
可以直接git,网速不好的可以直接去下压缩包:
下载地址:https://webdiis.unizar.es/~raulmur/orbslam/:.
编译ORBSLAM2 ROS
按照github上步骤准备好依赖库之后,执行:
cd catkin_ws/src
git clone https://github.com/raulmur/ORB_SLAM2.git ORB_SLAM2
cd ORB_SLAM2
chmod +x build.sh
./build.sh
#我们要用到他们ros库,所以执行
chmod +x build_ros.sh
./build_ros.sh
如果执行顺利,我们可以在Examples的ROS/ORBSLAM2下看到生成好的Mono,MonoAR,RGBD,Stereo文件.
常见错误及解决
运行build-ros.sh时出现问题一:
[rosbuild] rospack found package "ORB_SLAM2" at "", but the current directory is "/home/angelo/ORB_SLAM2/Examples/ROS/ORB_SLAM2". You should double-check your ROS_PACKAGE_PATH to ensure that packages are found in the correct precedence order.
解决方案:
sudo ln -s ~/ORB_