< >
Home » ROS2与VSLAM入门教程 » ROS2与VSLAM入门教程-ubuntu22.04下安装orbslamv2

ROS2与VSLAM入门教程-ubuntu22.04下安装orbslamv2

文章摘要

  • 本教程主要介绍如何在ubuntu22.04下安装orbslamv2和其对应的orbslam ros2包

  • 测试环境:Ubuntu 22.04 + ROS Humble + OpenCV 4.5.4

RCM脚本快速安装

$ cs -s install_orb_slamv2.sh
  • 安装orbslam2 ros2包
$ source ~/.bashrc
$ cs -s install_ros2_orb_slamv2_ws.sh

分步安装

注意:但若进行上面的RCM脚本快速安装,就不需要再进行该分布安装步骤

  • 安装对应的依赖
$ sudo apt-get update
$ sudo apt-get install libpython2.7-dev libboost-filesystem-dev libboost-dev libboost-thread-dev libglew-dev libblas-dev liblapack-dev
$ sudo apt-get install cmake git libgtk2.0-dev pkg-config libavcodec-dev libavformat-dev libswscale-dev build-essential
  • 安装Pangolin
$ mkdir ~/tools/
$ cd ~/tools/
$ git clone https://ghproxy.com/https://github.com/stevenlovegrove/Pangolin
$ cd ~/tools/Pangolin
$ git checkout 25159034e62011b3527228e476cec51f08e87602
$ sed -i '33a\#include <limits>' ~/tools/Pangolin/include/pangolin/gl/colour.h
$ mkdir build
$ cd build
$ cmake -DCPP11_NO_BOOST=1 ..
$ make
  • 安装orbslam2
$ cd ~/tools/
$ git clone https://ghproxy.com/https://github.com/EndlessLoops/ORB_SLAM2
$ cd ORB_SLAM2
$ sudo chmod +x build.sh
$ ./build.sh
$ echo 'export LD_LIBRARY_PATH=~/tools/Pangolin/build/src/:~/tools/ORB_SLAM2/Thirdparty/DBoW2/lib:~/tools/ORB_SLAM2/Thirdparty/g2o/lib:~/tools/ORB_SLAM2/lib:$LD_LIBRARY_PATH' >> ~/.bashrc
$ echo 'export ORB_SLAM2_ROOT_DIR=~/tools/ORB_SLAM2' >> ~/.bashrc
  • 安装orbslam2 ros2包
$ mkdir -p ~/ros2_orb_slamv2_ws/src
$ cd ~/ros2_orb_slamv2_ws/src
$ git clone https://ghproxy.com/https://github.com/EndlessLoops/ros2-ORB_SLAM2
$ cd ~/ros2_orb_slamv2_ws/
$ colcon build
$ echo 'source ~/ros2_orb_slamv2_ws/install/setup.bash' >> ~/.bashrc

测试步骤

1.数据集测试

$ cd 
$ wget https://cvg.cit.tum.de/rgbd/dataset/freiburg1/rgbd_dataset_freiburg1_xyz.tgz
$ tar -xvzf rgbd_dataset_freiburg1_xyz.tgz
  • 测试
$ cd ~/tools/ORB_SLAM2
$ ./Examples/RGB-D/rgbd_tum Vocabulary/ORBvoc.txt Examples/RGB-D/TUM1.yaml ~/rgbd_dataset_freiburg1_xyz/ Examples/RGB-D/associations/fr1_xyz.txt

请输入图片描述

2.ROS2包测试

  • 本次测试使用的是D435i相机

  • 启动相机

# 安装相机驱动
$ sudo apt install ros-humble-realsense2-camera 
# 启动相机
$ ros2 launch realsense2_camera rs_launch.py
  • 启动ROS2节点
# Mono例程
$ ros2 run ros2_orbslam mono ~/tools/ORB_SLAM2/Vocabulary/ORBvoc.txt ~/ros2_orb_slamv2_ws/src/ros2-ORB_SLAM2/src/monocular/TUM1.yaml

# RGBD例程
$ ros2 run ros2_orbslam rgbd ~/tools/ORB_SLAM2/Vocabulary/ORBvoc.txt ~/ros2_orb_slamv2_ws/src/ros2-ORB_SLAM2/src/rgbd/TUM1.yaml

请输入图片描述

纠错,疑问,交流: 请进入讨论区点击加入Q群

获取最新文章: 扫一扫右上角的二维码加入“创客智造”公众号


标签: ros2与vslam入门教程