[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 为什么不显示点云!!!

相关推荐
后端小肥肠3 分钟前
躺赚必备!RPA+Coze+豆包:公众号自动发文,AI率0%亲测有效(附AI率0%提示词)
人工智能·aigc·coze
摘星编程15 分钟前
CloudBase AI ToolKit实战:从0到1开发一个智能医疗网站
人工智能·腾讯云·ai代码远征季#h5应用·ai医疗应用·cloudbase开发
锅挤20 分钟前
深度学习5(深层神经网络 + 参数和超参数)
人工智能·深度学习·神经网络
一支烟一朵花24 分钟前
630,百度文心大模型4.5系列开源!真香
人工智能·百度·开源·文心一言
网安INF26 分钟前
深层神经网络:原理与传播机制详解
人工智能·深度学习·神经网络·机器学习
AIbase20241 小时前
国内MCP服务平台推荐!aibase.cn上线MCP服务器集合平台
运维·服务器·人工智能
喜欢吃豆2 小时前
快速手搓一个MCP服务指南(九): FastMCP 服务器组合技术:构建模块化AI应用的终极方案
服务器·人工智能·python·深度学习·大模型·github·fastmcp
星融元asterfusion2 小时前
基于路径质量的AI负载均衡异常路径检测与恢复策略
人工智能·负载均衡·异常路径
zskj_zhyl2 小时前
智慧养老丨从依赖式养老到自主式养老:如何重构晚年生活新范式
大数据·人工智能·物联网