Xavier入门教程软件篇-安装ORB_SLAM v2
Xavier入门教程软件篇-安装ORB_SLAM v2
说明:
- 介绍如何在Xavier上安装ORB-SLAM-V2
- 环境:jetpack4.2.3
步骤:
但是Xavier板子,不能完全按照TX2板子的方法编译ORB_SLAM,会提示如下错误:
System.cc:315:9: error: ‘usleep’
- 找到ORB_SLAM2/src/目录下,更改如下文件:
Tracking.cc
Viewer.cc
System.cc
LoopClosing.cc
LocalMapping.cc
- 找到ORB_SLAM2/Examples/Monocular,更改如下文件:
mono_euroc.cc
- 找到ORB_SLAM2/Examples/RGB-D,更改如下文件:
rgbd_tum.cc
- 找到ORB_SLAM2/Examples/Stereo,更改如下文件:
stereo_euroc.cc
stereo_kitti.cc
- 添加头文件
#include <unistd.h>
都更改后,再进行build.sh编译
执行编译build_ros.sh时候,先修改CMakeList.txt
找到Examples/ROS/ORB_SLAM2下的CMakeList.txt文件,增加-lboost_system,如下:
set(LIBS
${OpenCV_LIBS}
${EIGEN3_LIBS}
${Pangolin_LIBRARIES}
${PROJECT_SOURCE_DIR}/../../../Thirdparty/DBoW2/lib/libDBoW2.so
${PROJECT_SOURCE_DIR}/../../../Thirdparty/g2o/lib/libg2o.so
${PROJECT_SOURCE_DIR}/../../../lib/libORB_SLAM2.so
-lboost_system
)
- 找到ORB_SLAM2/Examples/ROS/ORB_SLAM2/src/AR目录下
ViewerAR.cc
- 增加头文件
#include <unistd.h>
- 更改后,执行编译build_ros.sh
- 如果是使用d435i作为深度相机,更改ros_rgbd.cc
- 找到ORB-SLAM2/Examples/ROS/ORB-SLAM2/src中修改ros_rgbd.cc的topic订阅为如下:
message_filters::Subscriber<sensor_msgs::Image> rgb_sub(nh, "/camera/color/image_raw", 1);
message_filters::Subscriber<sensor_msgs::Image> depth_sub(nh, "/camera/aligned_depth_to_color/image_raw", 1);
- 重新编译
./build_ros.sh
测试:
- 启动d435i相机
roslaunch realsense2_camera rs_rgbd.launch
- 进入ORB_SLAM2目录
- 用TUM1.yaml的参数测试
rosrun ORB_SLAM2 RGBD Vocabulary/ORBvoc.txt Examples/RGB-D/TUM1.yaml
效果:
使用realsense_d435i.yaml的参数测试
rosrun ORB_SLAM2 RGBD Vocabulary/ORBvoc.txt Examples/RGB-D/realsense_d435i.yaml
- 效果:
参考:
- https://blog.csdn.net/qq_41839222/article/details/86503113
获取最新文章: 扫一扫右上角的二维码加入“创客智造”公众号