【无人机自主导航5 SLAM】Intel Realsense T265C双目相机实现ORB-SLAM3

本文主要是介绍【无人机自主导航5 SLAM】Intel Realsense T265C双目相机实现ORB-SLAM3,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

转载自:https://dgzc.ganahe.top/ganahe/2021/wrjzzdhsjirtsmxj.html

【无人机自主导航5 SLAM】Intel Realsense T265C双目相机实现ORB-SLAM3

C/C++ GanAHE 4个月前 (03-21) 32次浏览 已收录 5个评论 扫描二维码

文章目录[隐藏]

  • 一、ORB-SLAM3依赖
  • 二、ORB-SLAM3配置编译
  • 三、编译ORB-SLAM3的ROS接口
  • 四、运行ORB-SLAM3
  • 补充

深度相机的SDK驱动安装、ROS功能包编译等内容在本站文章:
【无人机自主导航4-1 视觉传感器】通过ROS发布、订阅话题连接视觉相机已有说明,未配置环境的先进行驱动配置。

一、ORB-SLAM3依赖

(一)Pangolin

 
  1. #安装依赖
  2. sudo apt install libglew-dev
  3. sudo apt install cmake
  4. sudo apt install libpython2.7-dev
  5. #可选依赖见github,我没装所以就不贴出来啦
  6. #下载并编译
  7. git clone https://github.com/stevenlovegrove/Pangolin.git
  8. cd Pangolin
  9. mkdir build
  10. cd build
  11. cmake ..
  12. cmake --build .
  13. #最后不要忘了安装
  14. sudo make install

(二)其他

根据Github仓库自行安装其他缺少的库。

二、ORB-SLAM3配置编译

 
  1. cd ~/catkin_ws/src
  2. git clone https://github.com/UZ-SLAMLab/ORB_SLAM3.git ORB_SLAM3
  3. #编译
  4. cd ORB_SLAM3
  5. chmod +x build.sh
  6. ./build.sh
  7. cd ..
  8. catkin_make
  9. source devel/setup.bash

三、编译ORB-SLAM3的ROS接口

 
  1. chmod +x build_ros.sh
  2. ./build_ros.sh

3.1 修正相机 launch

根据下方路径自行修改launch文件,包括相机内外参数、启动的镜头、fps等,启动相机时,启动更改后相应的文件即可:

 
  1. ganahe@ganahe-Nitro-AN515-51:~/catkin_ws/src/realsense-ros/realsense2_camera/launch$ pwd
  2. /home/ganahe/catkin_ws/src/realsense-ros/realsense2_camera/launch
  3. ganahe@ganahe-Nitro-AN515-51:~/catkin_ws/src/realsense-ros/realsense2_camera/launch$ tree
  4. .
  5. ├── demo_pointcloud.launch
  6. ├── demo_t265.launch
  7. ├── includes
  8. │   └── nodelet.launch.xml
  9. ├── opensource_tracking.launch
  10. ├── rs_aligned_depth.launch
  11. ├── rs_camera.launch
  12. ├── rs_d400_and_t265.launch
  13. ├── rs_d435_camera_with_model.launch
  14. ├── rs_from_file.launch
  15. ├── rs_multiple_devices.launch
  16. ├── rs_rgbd.launch
  17. ├── rs_rtabmap.launch
  18. └── rs_t265.launch

本机的参数文件如下:

 
  1. <!--
  2. Important Notice: For wheeled robots, odometer input is a requirement for robust
  3. and accurate tracking. The relevant APIs will be added to librealsense and
  4. ROS/realsense in upcoming releases. Currently, the API is available in the
  5. https://github.com/IntelRealSense/librealsense/blob/master/third-party/libtm/libtm/include/TrackingDevice.h#L508-L515.
  6. -->
  7. <launch>
  8. <arg name="serial_no" default=""/>
  9. <arg name="usb_port_id" default=""/>
  10. <arg name="device_type" default="t265"/>
  11. <arg name="json_file_path" default=""/>
  12. <arg name="camera" default="camera"/>
  13. <arg name="tf_prefix" default="$(arg camera)"/>
  14. <arg name="fisheye_width" default="848"/>
  15. <arg name="fisheye_height" default="800"/>
  16. <arg name="enable_fisheye1" default="true"/>
  17. <arg name="enable_fisheye2" default="true"/>
  18. <arg name="fisheye_fps" default="30"/>
  19. <arg name="gyro_fps" default="200"/>
  20. <arg name="accel_fps" default="62"/>
  21. <arg name="enable_gyro" default="true"/>
  22. <arg name="enable_accel" default="true"/>
  23. <arg name="enable_pose" default="true"/>
  24. <arg name="enable_sync" default="false"/>
  25. <arg name="linear_accel_cov" default="0.01"/>
  26. <arg name="initial_reset" default="false"/>
  27. <arg name="unite_imu_method" default=""/>
  28. <arg name="publish_odom_tf" default="true"/>
  29. <group ns="$(arg camera)">
  30. <include file="$(find realsense2_camera)/launch/includes/nodelet.launch.xml">
  31. <arg name="tf_prefix" value="$(arg tf_prefix)"/>
  32. <arg name="serial_no" value="$(arg serial_no)"/>
  33. <arg name="usb_port_id" value="$(arg usb_port_id)"/>
  34. <arg name="device_type" value="$(arg device_type)"/>
  35. <arg name="json_file_path" value="$(arg json_file_path)"/>
  36. <arg name="enable_sync" value="$(arg enable_sync)"/>
  37. <arg name="fisheye_width" value="$(arg fisheye_width)"/>
  38. <arg name="fisheye_height" value="$(arg fisheye_height)"/>
  39. <arg name="enable_fisheye1" value="$(arg enable_fisheye1)"/>
  40. <arg name="enable_fisheye2" value="$(arg enable_fisheye2)"/>
  41. <arg name="fisheye_fps" value="$(arg fisheye_fps)"/>
  42. <arg name="gyro_fps" value="$(arg gyro_fps)"/>
  43. <arg name="accel_fps" value="$(arg accel_fps)"/>
  44. <arg name="enable_gyro" value="$(arg enable_gyro)"/>
  45. <arg name="enable_accel" value="$(arg enable_accel)"/>
  46. <arg name="enable_pose" value="$(arg enable_pose)"/>
  47. <arg name="linear_accel_cov" value="$(arg linear_accel_cov)"/>
  48. <arg name="initial_reset" value="$(arg initial_reset)"/>
  49. <arg name="unite_imu_method" value="$(arg unite_imu_method)"/>
  50. <arg name="publish_odom_tf" value="$(arg publish_odom_tf)"/>
  51. </include>
  52. </group>
  53. </launch>

启动指令如下:

 
  1. roscore

打开新的终端,启动T265C:

 
  1. # 注意在此之前必须在 rs_t265.launch中设定相机的参数,比如是否开启相机
  2. roslaunch realsense2_camera rs_t265.launch

3.2 修改Topic

打开相机节点实现通讯:

 
  1. # 注意在此之前必须在 rs_t265.launch中设定相机的参数,比如是否开启相机
  2. roslaunch realsense2_camera rs_t265.launch

查看相机镜头对应的话题信息:

 
  1. rostopic list

根据显示的信息修改ros_stereo.cc文件,比如本文中的数据修正为:

 
  1. message_filters::Subscriber<sensor_msgs::Image> left_sub(nh, "/camera/fisheye1/image_raw", 1);
  2. message_filters::Subscriber<sensor_msgs::Image> right_sub(nh, "/camera/fisheye2/image_raw", 1);

再次编译./build_ros.sh

3.3 再次编译功能包

随后执行:

 
  1. cd ~/catkin_ws
  2. catkin_make
  3. source devel/setup.bash

四、运行ORB-SLAM3

三个终端

  • 首先执行:
     
    1. roscore
  • 运行相机:
 
  1. roslaunch realsense2_camera rs_t265.launch
  • 运行SLAM:
 
  1. rosrun ORB_SLAM3 Stereo ~/catkin_ws/src/ORB_SLAM3/Vocabulary/ORBvoc.txt
  2. ~/catkin_ws/src/ORB_SLAM3/Examples/ROS/ORB_SLAM3/T265.yaml false

补充

根据大家的反馈,下面补充本文实验所用的T265.yaml文件,基本采用官方的改动较小:

 
  1. %YAML:1.0
  2. #--------------------------------------------------------------------------------------------
  3. # Camera Parameters. Adjust them!
  4. #--------------------------------------------------------------------------------------------
  5. Camera.type: "PinHole"
  6. # Camera calibration and distortion parameters (OpenCV)
  7. Camera.fx: 286.419189453125
  8. Camera.fy: 286.384307861328
  9. Camera.cx: 101.355010986328
  10. Camera.cy: 102.183197021484
  11. Camera.k1: 0.0
  12. Camera.k2: 0.0
  13. Camera.p1: 0.0
  14. Camera.p2: 0.0
  15. Camera.width: 848
  16. Camera.height: 800
  17. # Camera frames per second
  18. Camera.fps: 30.0
  19. # IR projector baseline times fx (aprox.)
  20. Camera.bf: 40.0
  21. # Color order of the images (0: BGR, 1: RGB. It is ignored if images are grayscale)
  22. Camera.RGB: 1
  23. # Close/Far threshold. Baseline times.
  24. ThDepth: 40.0
  25. # Deptmap values factor
  26. DepthMapFactor: 1.0
  27. #--------------------------------------------------------------------------------------------
  28. # ORB Parameters
  29. #--------------------------------------------------------------------------------------------
  30. # ORB Extractor: Number of features per image
  31. ORBextractor.nFeatures: 1000
  32. # ORB Extractor: Scale factor between levels in the scale pyramid
  33. ORBextractor.scaleFactor: 1.2
  34. # ORB Extractor: Number of levels in the scale pyramid
  35. ORBextractor.nLevels: 8
  36. # ORB Extractor: Fast threshold
  37. # Image is divided in a grid. At each cell FAST are extracted imposing a minimum response.
  38. # Firstly we impose iniThFAST. If no corners are detected we impose a lower value minThFAST
  39. # You can lower these values if your images have low contrast
  40. ORBextractor.iniThFAST: 20
  41. ORBextractor.minThFAST: 7
  42. #--------------------------------------------------------------------------------------------
  43. # Viewer Parameters
  44. #--------------------------------------------------------------------------------------------
  45. Viewer.KeyFrameSize: 0.05
  46. Viewer.KeyFrameLineWidth: 1
  47. Viewer.GraphLineWidth: 0.9
  48. Viewer.PointSize:2
  49. Viewer.CameraSize: 0.08
  50. Viewer.CameraLineWidth: 3
  51. Viewer.ViewpointX: 0
  52. Viewer.ViewpointY: -0.7
  53. Viewer.ViewpointZ: -1.8
  54. Viewer.ViewpointF: 500

GanAHE 的小创元世纪, 版权所有丨如未注明 , 均为原创丨本网站采用@BY-NC-SA协议进行授权
转载请注明原文链接:【无人机自主导航5 SLAM】Intel Realsense T265C双目相机实现ORB-SLAM3

这篇关于【无人机自主导航5 SLAM】Intel Realsense T265C双目相机实现ORB-SLAM3的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/506959

相关文章

Vue项目的甘特图组件之dhtmlx-gantt使用教程和实现效果展示(推荐)

《Vue项目的甘特图组件之dhtmlx-gantt使用教程和实现效果展示(推荐)》文章介绍了如何使用dhtmlx-gantt组件来实现公司的甘特图需求,并提供了一个简单的Vue组件示例,文章还分享了一... 目录一、首先 npm 安装插件二、创建一个vue组件三、业务页面内 引用自定义组件:四、dhtmlx

Vue ElementUI中Upload组件批量上传的实现代码

《VueElementUI中Upload组件批量上传的实现代码》ElementUI中Upload组件批量上传通过获取upload组件的DOM、文件、上传地址和数据,封装uploadFiles方法,使... ElementUI中Upload组件如何批量上传首先就是upload组件 <el-upl

Docker部署Jenkins持续集成(CI)工具的实现

《Docker部署Jenkins持续集成(CI)工具的实现》Jenkins是一个流行的开源自动化工具,广泛应用于持续集成(CI)和持续交付(CD)的环境中,本文介绍了使用Docker部署Jenkins... 目录前言一、准备工作二、设置变量和目录结构三、配置 docker 权限和网络四、启动 Jenkins

Python3脚本实现Excel与TXT的智能转换

《Python3脚本实现Excel与TXT的智能转换》在数据处理的日常工作中,我们经常需要将Excel中的结构化数据转换为其他格式,本文将使用Python3实现Excel与TXT的智能转换,需要的可以... 目录场景应用:为什么需要这种转换技术解析:代码实现详解核心代码展示改进点说明实战演练:从Excel到

如何使用CSS3实现波浪式图片墙

《如何使用CSS3实现波浪式图片墙》:本文主要介绍了如何使用CSS3的transform属性和动画技巧实现波浪式图片墙,通过设置图片的垂直偏移量,并使用动画使其周期性地改变位置,可以创建出动态且具有波浪效果的图片墙,同时,还强调了响应式设计的重要性,以确保图片墙在不同设备上都能良好显示,详细内容请阅读本文,希望能对你有所帮助...

C# string转unicode字符的实现

《C#string转unicode字符的实现》本文主要介绍了C#string转unicode字符的实现,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友们下面随... 目录1. 获取字符串中每个字符的 Unicode 值示例代码:输出:2. 将 Unicode 值格式化

python安装whl包并解决依赖关系的实现

《python安装whl包并解决依赖关系的实现》本文主要介绍了python安装whl包并解决依赖关系的实现,文中通过图文示例介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友们下面... 目录一、什么是whl文件?二、我们为什么需要使用whl文件来安装python库?三、我们应该去哪儿下

Python脚本实现图片文件批量命名

《Python脚本实现图片文件批量命名》这篇文章主要为大家详细介绍了一个用python第三方库pillow写的批量处理图片命名的脚本,文中的示例代码讲解详细,感兴趣的小伙伴可以了解下... 目录前言源码批量处理图片尺寸脚本源码GUI界面源码打包成.exe可执行文件前言本文介绍一个用python第三方库pi

Java中将异步调用转为同步的五种实现方法

《Java中将异步调用转为同步的五种实现方法》本文介绍了将异步调用转为同步阻塞模式的五种方法:wait/notify、ReentrantLock+Condition、Future、CountDownL... 目录异步与同步的核心区别方法一:使用wait/notify + synchronized代码示例关键

Nginx实现动态封禁IP的步骤指南

《Nginx实现动态封禁IP的步骤指南》在日常的生产环境中,网站可能会遭遇恶意请求、DDoS攻击或其他有害的访问行为,为了应对这些情况,动态封禁IP是一项十分重要的安全策略,本篇博客将介绍如何通过NG... 目录1、简述2、实现方式3、使用 fail2ban 动态封禁3.1 安装 fail2ban3.2 配