[ROS2系列] ORBBEC(奥比中光)AstraPro相机在ROS2进行rtabmap 3D建图

目录

背景:

一、驱动AstraPro摄像头

二、安装rtabmap

error1:缺包

三、尝试

四、参数讲解

五、运行

[error2: Did not receive data since 5 seconds!](#error2: Did not receive data since 5 seconds!)

六、效果​编辑

error4:


背景:

1、设备:pc;jeston agx orin

2、环境:Ubuntu20.04;ROS2(Foxy)

3、主从机配置,jeston agx orin为主机

4、 jeston agx orin含有:AstraPro、激光雷达驱动,刑天底盘控制,语音交互

5、目前已实现激光雷达2D建图,AstraPro驱动,刑天底盘控制,语音交互

一、驱动AstraPro摄像头

https://github.com/orbbec/ros_astra_camera

复制代码
启动摄像头:
ros2 launch astra_camera astra_pro.launch.py

warning:

复制代码
[component_container-1] [WARN] [1697708402.794392173] [camera.point_cloud_xyz]: [image_transport] Topics '/camera/depth/image_raw' and '/camera/depth/camera_info' do not appear to be synchronized. In the last 10s:
[component_container-1] 	Image messages received:      5
[component_container-1] 	CameraInfo messages received: 5
[component_container-1] 	Synchronized pairs:           0

二、安装rtabmap

https://github.com/introlab/rtabmap_ros

具体操作看[ROS2系列] ubuntu 20.04测试rtabmap-CSDN博客

但是我在jeston agx orin 使用

复制代码
rosdep update && rosdep install --from-paths src --ignore-src -r -y
error1:缺包
复制代码
sudo apt-get ros-foxy-
注意:后面跟的包的"_"都需要改成"-"

三、尝试

由于我用的是奥比中光摄像头,官方也并没有例子,在issue中我也问了维护者:

复制代码
这有一个zed的例子:
ros2 launch zed_wrapper zed.launch.py

ros2 launch rtabmap_launch rtabmap.launch.py \
    rtabmap_args:="--delete_db_on_start" \
    rgb_topic:=/zed/zed_node/rgb/image_rect_color \
    depth_topic:=/zed/zed_node/depth/depth_registered \
    camera_info_topic:=/zed/zed_node/rgb/camera_info \
    frame_id:=base_link \
    approx_sync:=false \
    wait_imu_to_init:=true \
    imu_topic:=/zed/zed_node/imu/data \
    qos:=1 \
    rviz:=true

qos (Quality of Service) argument should match the published topics QoS (1=RELIABLE, 2=BEST EFFORT). ROS1 was always RELIABLE.

所以这里我选择用qos=2。

四、参数讲解

复制代码
args:="-d --Mem/UseOdomGravity true --Optimizer/GravitySigma 0.3": 这个参数用于指定RTAB-Map的命令行参数。具体地,它包括了以下命令行参数:

-d:表示RTAB-Map在启动时删除(清空)先前的数据库,以重新开始构建地图。
--Mem/UseOdomGravity true:启用RTAB-Map使用里程计信息进行重力校正。
--Optimizer/GravitySigma 0.3:设置RTAB-Map优化中的重力方向方差为0.3。
odom_topic:=/t265/odom/sample: 这个选项指定里程计信息的话题,通常用于融合定位和地图构建。

frame_id:=t265_link: 这个选项指定RTAB-Map使用的坐标系,通常是相机或机器人的坐标系。在这里,它被设置为t265_link。

rgbd_sync:=true: 这个选项表示启用RGB-D数据的同步,确保RGB图像和深度图像具有相同的时间戳。

depth_topic:=/d400/aligned_depth_to_color/image_raw: 这个选项指定深度图像的话题。

rgb_topic:=/d400/color/image_raw: 这个选项指定RGB图像的话题。

camera_info_topic:=/d400/color/camera_info: 这个选项指定相机信息的话题,包含了相机的参数和标定信息。

approx_rgbd_sync:=false: 这个选项表示禁用RGB-D数据的近似同步。

visual_odometry:=false: 这个选项表示禁用视觉里程计(Visual Odometry)。

queue_size:=30: 这个选项指定RTAB-Map节点使用的消息队列大小。增加队列大小可以容纳更多的消息,以应对消息发布频率不一致的情况。
frame_id:=base_link: 这个选项指定RTAB-Map节点使用的坐标系,通常是相机或机器人的坐标系。在这里,它被设置为base_link。

approx_sync:=false: 这个选项用于控制RGB和深度图像的同步。当设置为false时,RGB和深度图像不会强制同步。

五、运行

进入ubuntu,查看摄像头话题

复制代码
ros2 topic list

          ('rgb/image', '/camera/color/image_raw'),
          #('rgb/camera_info', '/camera/color/camera_info'),
          ('rgb/camera_info', '/camera/color/camera_info'),
          #('depth/image', '/camera/aligned_depth_to_color/image_raw'),
          ('depth/image', '/camera/depth/image_raw')]

当我尝试命令时候,会出现延时错误

error2: Did not receive data since 5 seconds!
复制代码
rtabmap_viz-3] [WARN] [1697700727.832576678] [rtabmap.rtabmap_viz]: rtabmap_viz: Did not receive data since 5 seconds! Make sure the input topics are published ("$ ros2 topic hz my_topic") and the timestamps in their header are set. If topics are coming from different computers, make sure the clocks of the computers are synchronized ("ntpdate"). If topics are not published at the same rate, you could increase "queue_size" parameter (current=20). 

这个错误有很多,github issue里面相关的解决方法我都看完了,但不是我需要的,最后我的可执行命令是:

复制代码
ros2 launch rtabmap_launch rtabmap.launch.py \
    rtabmap_args:="--delete_db_on_start" \
    rgb_topic:=/camera/color/image_raw \
    depth_topic:=/camera/depth/image_raw \
    camera_info_topic:=/camera/color/camera_info \
    frame_id:=camera_link \
    use_sim_time:=true \
    approx_sync:=true \
    qos:=2 \
    rviz:=true \
    queue_size:=30

六、效果

至少3个界面都有图像了。

当我操作我的机器人时,图像同步的过于慢,终端有报错

error4:
复制代码
[rtabmap_viz-3] [INFO] [1697708400.611813528] [rtabmap.rtabmap_viz]: rtabmap_viz stopping spinner...
[rtabmap-2] [ERROR] (2023-10-19 17:39:10.449) Rtabmap.cpp:1343::process() RGB-D SLAM mode is enabled, memory is incremental but no odometry is provided. Image 0 is ignored!
[rtabmap-2] [ERROR] (2023-10-19 17:39:11.367) Rtabmap.cpp:1343::process() RGB-D SLAM mode is enabled, memory is incremental but no odometry is provided. Image 0 is ignored!

后续再更吧,尊的累了,搞的想吐。我的intel D435i 为什么不显示点云!!!

相关推荐
格林威12 分钟前
常规线扫描镜头有哪些类型?能做什么?
人工智能·深度学习·数码相机·算法·计算机视觉·视觉检测·工业镜头
倔强青铜三1 小时前
苦练Python第63天:零基础玩转TOML配置读写,tomllib模块实战
人工智能·python·面试
B站计算机毕业设计之家1 小时前
智慧交通项目:Python+YOLOv8 实时交通标志系统 深度学习实战(TT100K+PySide6 源码+文档)✅
人工智能·python·深度学习·yolo·计算机视觉·智慧交通·交通标志
高工智能汽车1 小时前
棱镜观察|极氪销量遇阻?千里智驾左手服务吉利、右手对标华为
人工智能·华为
txwtech1 小时前
第6篇 OpenCV RotatedRect如何判断矩形的角度
人工智能·opencv·计算机视觉
正牌强哥1 小时前
Futures_ML——机器学习在期货量化交易中的应用与实践
人工智能·python·机器学习·ai·交易·akshare
倔强青铜三2 小时前
苦练Python第62天:零基础玩转CSV文件读写,csv模块实战
人工智能·python·面试
大模型真好玩2 小时前
低代码Agent开发框架使用指南(二)—Coze平台核心功能概览
人工智能·coze·deepseek
jerryinwuhan3 小时前
最短路径问题总结
开发语言·人工智能·python
wanhengidc3 小时前
云手机能够做些什么?
运维·服务器·人工智能·智能手机·云计算