< >
Home » NX入门教程软件篇 » NX入门教程软件篇-安装ORB_SLAM v3

NX入门教程软件篇-安装ORB_SLAM v3

文章说明

  • 本文章主要介绍如何在nx上安装orbslamv3

  • 测试环境:NVIDIA Jetson Xavier NX + Ubuntu 20.04 + ROS2 Galactic + OpenCV4.5.4

  • 测试所用镜像:JP502-xnx-sd-card-image-b231

安装步骤

  • 安装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
  • 安装orbslam3
$ cd ~/tools/
$ git clone https://ghproxy.com/https://github.com/EndlessLoops/ORB_SLAM3
$ cd ~/tools/ORB_SLAM3
$ sudo chmod +x build.sh
$ ./build.sh
$ cd ~/tools/ORB_SLAM3/Thirdparty/Sophus/build/
$ sudo make install

  • 安装orbslam3 ros2包
$ mkdir -p ~/ros2_orb_slamv3_ws/src
$ cd ~/ros2_orb_slamv3_ws/src
$ git clone https://ghproxy.com/https://github.com/EndlessLoops/ORB_SLAM3_ROS2.git orbslam3_ros2
$ cd ~/ros2_orb_slamv3_ws/
$ colcon build
$ echo 'source ~/ros2_orb_slamv3_ws/install/setup.bash' >> ~/.bashrc
$ echo 'export LD_LIBRARY_PATH=~/tools/ORB_SLAM3/lib:$LD_LIBRARY_PATH' >> ~/.bashrc

测试步骤

1.数据集测试

$ cd 
$ wget -c http://robotics.ethz.ch/~asl-datasets/ijrr_euroc_mav_dataset/machine_hall/MH_01_easy/MH_01_easy.zip
$ unzip MH_01_easy.zip -d MH01/
  • 测试
$ cd ~/tools/ORB_SLAM3
$ ./Examples/Monocular/mono_euroc ./Vocabulary/ORBvoc.txt ./Examples/Monocular/EuRoC.yaml ~/MH01 ./Examples/Monocular/EuRoC_TimeStamps/MH01.txt dataset-MH01_mono

请输入图片描述

2.ROS2包测试

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

  • 启动相机

# 安装相机驱动
$ sudo apt install ros-galactic-realsense2-camera 
# 启动相机
$ ros2 launch realsense2_camera rs_launch.py rgb_camera.profile:='640x480x15' depth_module.profile:='640x480x15'
  • 启动ROS2节点
# Mono例程
$ ros2 run orbslam3 mono ~/tools/ORB_SLAM3/Vocabulary/ORBvoc.txt ~/tools/ORB_SLAM3/Examples/Monocular/RealSense_D435i.yaml
# RGBD例程
$ ros2 run orbslam3 rgbd ~/tools/ORB_SLAM3/Vocabulary/ORBvoc.txt ~/tools/ORB_SLAM3/Examples/RGB-D/RealSense_D435i.yaml

请输入图片描述

FAQ

Q1
  • 运行数据集例程时没有出现可视化窗口
ubuntu@ubuntu-desktop:~/tools/ORB_SLAM3$ ./Examples/Monocular/mono_euroc ./Vocabulary/ORBvoc.txt ./Examples/Monocular/EuRoC.yaml ~/MH01 ./Examples/Monocular/EuRoC_TimeStamps/MH01.txt dataset-MH01_mono
num_seq = 1
file name: dataset-MH01_mono
Loading images for sequence 0...LOADED!

-------

ORB-SLAM3 Copyright (C) 2017-2020 Carlos Campos, Richard Elvira, Juan J. Gómez, José M.M. Montiel and Juan D. Tardós, University of Zaragoza.
ORB-SLAM2 Copyright (C) 2014-2016 Raúl Mur-Artal, José M.M. Montiel and Juan D. Tardós, University of Zaragoza.
This program comes with ABSOLUTELY NO WARRANTY;
This is free software, and you are welcome to redistribute it
under certain conditions. See LICENSE.txt.

Input sensor was set to: Monocular
Loading settings from ./Examples/Monocular/EuRoC.yaml
Camera1.k3 optional parameter does not exist...
    -Loaded camera 1
    -Loaded image info
    -Loaded ORB settings
Viewer.imageViewScale optional parameter does not exist...
    -Loaded viewer settings
System.LoadAtlasFromFile optional parameter does not exist...
System.SaveAtlasToFile optional parameter does not exist...
    -Loaded Atlas settings
System.thFarPoints optional parameter does not exist...
    -Loaded misc parameters
----------------------------------
SLAM settings:
    -Camera 1 parameters (Pinhole): [ 458.65399169921875 457.29598999023438 367.21499633789062 248.375 ]
    -Camera 1 distortion parameters: [  -0.28340810537338257 0.073959067463874817 0.00019359000725671649 1.7618711353861727e-05 ]
    -Original image size: [ 752 , 480 ]
    -Current image size: [ 600 , 350 ]
    -Camera 1 parameters after resize: [  365.94735717773438 333.44500732421875 292.99069213867188 181.10678100585938 ]
    -Sequence FPS: 20
    -Features per image: 1000
    -ORB scale factor: 1.2000000476837158
    -ORB number of scales: 8
    -Initial FAST threshold: 20
    -Min FAST threshold: 7

Loading ORB Vocabulary. This could take a while...
Vocabulary loaded!

Initialization of Atlas from scratch
Creation of new map with id: 0
Creation of new map with last KF id: 0
Seq. Name:
There are 1 cameras in the atlas
Camera 0 is pinhole
First KF:0; Map init KF:0
New Map created with 508 points
A1
  • mono_euroc.cc第83行的false替换为true
$ vim ~/tools/ORB_SLAM3/Examples/Monocular/mono_euroc.cc

ORB_SLAM3::System SLAM(argv[1],argv[2],ORB_SLAM3::System::MONOCULAR,false);
# 第83行的`false`替换为`true`
ORB_SLAM3::System SLAM(argv[1],argv[2],ORB_SLAM3::System::MONOCULAR, true);

$ cd ~/tools/ORB_SLAM3
$ ./build.sh
Q2
  • 测试ros2例程时,出现打开orb_slam的窗口后就会快速关闭,期间没有报错,但不能正常使用例程
A2
Q3
  • 运行ros2例程时,总是卡在Waiting For Images的界面,终端一直输出one frame has been sent
A3
Q4
  • 编译ros2包报错:/usr/bin/ld: /lib/x86_64-linux-gnu/libopencv_calib3d.so.4.5d: error adding symbols: DSO missing from command line

ubuntu@ubuntu:~/ros2_orb_slamv3_ws$ colcon build
Starting >>> orbslam3
--- stderr: orbslam3                             
/usr/bin/ld: CMakeFiles/stereo.dir/src/stereo/stereo-slam-node.cpp.o: undefined reference to symbol '_ZN2cv23initUndistortRectifyMapERKNS_11_InputArrayES2_S2_S2_NS_5Size_IiEEiRKNS_12_OutputArrayES7_'
/usr/bin/ld: /lib/x86_64-linux-gnu/libopencv_calib3d.so.4.5d: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
gmake[2]: *** [CMakeFiles/stereo.dir/build.make:211: stereo] Error 1
gmake[1]: *** [CMakeFiles/Makefile2:195: CMakeFiles/stereo.dir/all] Error 2
gmake[1]: *** Waiting for unfinished jobs....
/usr/bin/ld: CMakeFiles/stereo-inertial.dir/src/stereo-inertial/stereo-inertial-node.cpp.o: undefined reference to symbol '_ZN2cv23initUndistortRectifyMapERKNS_11_InputArrayES2_S2_S2_NS_5Size_IiEEiRKNS_12_OutputArrayES7_'
/usr/bin/ld: /lib/x86_64-linux-gnu/libopencv_calib3d.so.4.5d: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
gmake[2]: *** [CMakeFiles/stereo-inertial.dir/build.make:210: stereo-inertial] Error 1
gmake[1]: *** [CMakeFiles/Makefile2:221: CMakeFiles/stereo-inertial.dir/all] Error 2
gmake: *** [Makefile:146: all] Error 2
---
Failed   <<< orbslam3 [2.60s, exited with code 2]


Summary: 0 packages finished [2.78s]
  1 package failed: orbslam3
  1 package had stderr output: orbslam3
A4
  • 修改orbslam3_ros2包的CMakeLists.txt文件
$ vim ~/ros2_orb_slamv3_ws/src/orbslam3_ros2/CMakeLists.txt

# 添加OpenCV的查找语句
find_package(OpenCV 4.0 QUIET)
# 添加OpenCV再末尾
ament_target_dependencies(stereo-inertial rclcpp sensor_msgs cv_bridge ORB_SLAM3 Pangolin OpenCV)

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

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


标签: nx入门教程软件篇