1.其他依赖安装
cmake
sudo apt-get install cmake
安装gcc与g++
sudo apt-get install gcc g++
安装pangolin
sudo apt-get install libglew-devsudo apt-get install libboost-dev libboost-thread-dev libboost-filesystem-devsudo apt-get install libpython2.7-dev
git clone https://github.com/stevenlovegrove/Pangolin.git
cd Pangolin
mkdir build
cd build
cmake -DCPP11_NO_BOOSR=1 ..
make -j
sudo make install
opencv 安装请参考其他博客,我的版本为3.4
安装eigen
sudo apt-get install libeigen3-dev
sudo updatedb
locate eigen3
2.ROS快速安装教程
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 update
sudo apt install ros-melodic-desktop-full
sudo rosdep init
rosdep update
echo "source /opt/ros/melodic/setup.bash" >> ~/.bashrc
source ~/.bashrc
sudo apt install python-rosinstall python-rosinstall-generator python-wstool build-essential
可能出现错误
sudo rosdep init
ERROR: cannot download default sources list from:
https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/sources.list.d/20-default.list
Website may be down.
解决方案
sudo mkdir -p /etc/ros/rosdep/source.list.d
cd /etc/ros/rosdep/sources.list.d
sudo gedit 20-default.list
复制以下内容到上述文件中:
# os-specific listings first
yaml https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/osx-homebrew.yaml osx# generic
yaml https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/base.yaml
yaml https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/python.yaml
yaml https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/ruby.yaml
gbpdistro https://raw.githubusercontent.com/ros/rosdistro/master/releases/fuerte.yaml fuerte# newer distributions (Groovy, Hydro, ...) must not be listed anymore, they are being fetched from the rosdistro index.yaml instead
rosdep update
可能出现错误
sudo: source: command not found
打开bashrc文件,查看
"source /opt/ros/melodic/setup.bash"
这个地方可能出现了问题,去除 " " 即可。
2.配置ROS工作环境
mkdir -p ~/catkin_ws/src
cd ~/catkin_ws/src
catkin_inint_workspace
cd ..
catkin_make
source devel/setup.bash
echo "source /home/exbot/catkin_ws/devel/setup.bash" >> ~/.bashrc
echo "export ROS_PACKAGE_PATH=${ROS_PACKAGE_PATH}:/home/X X X/catkin_ws/src/ORB_SLAM2/Examples/ROS" >> ~/.bashrc
source ~/.bashrccd ~/catkin_ws/src
git clone https://github.com/bosch-ros-pkg/usb_cam.git
sudo apt-get install ros-melodic-usb-cam
cd usb_cam
mkdir build
cd build
cmake ..
make
将ORB-SLAM2 clone到catkin_ws/src/目录下
git clone https://github.com/raulmur/ORB_SLAM2.git ORB_SLAM2
cd ORB-slam2
chmod +x build.sh
./build.shchmod +x build.sh
./build_ros.sh
相机ROS标定包
sudo apt install ros-kinetic-camera-calibration
rosmake camera_calibration
sudo apt-get install ros-melodic-usb-cam roslaunch usb_cam usb_cam-test.launch
sudo apt install ros-kinetic-camera-calibration
移动,当calibrate变为绿色,按下,等待。commit保存
sudo apt-get install ros-melodic-image-view
修改ros_momo.cc文件,将/camera/image_raw修改为/usb_cam/image_raw/,后./build_ros.sh
将mycam.yaml 按照其他yaml文件进行修改
roscore
roslaunch usb_cam usb_cam-test.launch
rosrun ORB_SLAM2 Mono Vocabulary/ORBvoc.txt mycam.yaml
如果中途出现问题,可尝试
cd ~/catkin_ws
catkin_make
source ./devel/setup.bash
可能出现问题
输入 rescore
Command 'roscore' not found, but can be installed with: sudo apt install python-roslaunch
输入: sudo apt install python-roslaunch
报错:E: Unable to correct problems, you have held broken packages.
解决办法
sudo apt-get install ros-melodic-desktop
source ~/.bashrc
3.跑参考数据集
详情请见官网
参考数据集网址
https://vision.in.tum.de/data/datasets/rgbd-dataset/download
下载数据集
Category: Handheld SLAM - fr1/desk
Category: Robot SLAM - fr2/pioneer/360
./Examples/Monocular/mono_tum Vocabulary/ORBvoc.txt Examples/Monocular/TUMX.yaml PATH_TO_SEQUENCE_FOLDER
参考文章:
1.https://blog.csdn.net/qq_42037180/article/details/88371971?utm_medium=distribute.pc_relevant.none-task-blog-BlogCommendFromMachineLearnPai2-2.channel_param&depth_1-utm_source=distribute.pc_relevant.none-task-blog-BlogCommendFromMachineLearnPai2-2.channel_param
2.https://blog.csdn.net/yldmkx/article/details/99762360
3.https://blog.csdn.net/u010925447/article/details/55522005