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

相关推荐
胡耀超20 分钟前
标签体系设计与管理:从理论基础到智能化实践的综合指南
人工智能·python·深度学习·数据挖掘·大模型·用户画像·语义分析
开-悟24 分钟前
嵌入式编程-使用AI查找BUG的启发
c语言·人工智能·嵌入式硬件·bug
Ailerx25 分钟前
YOLOv13震撼发布:超图增强引领目标检测新纪元
人工智能·yolo·目标检测
大咖分享课1 小时前
开源模型与商用模型协同开发机制设计
人工智能·开源·ai模型
你不知道我是谁?1 小时前
AI 应用于进攻性安全
人工智能·安全
reddingtons1 小时前
Adobe高阶技巧与设计师创意思维的进阶指南
人工智能·adobe·illustrator·设计师·photoshop·创意设计·aftereffects
机器之心1 小时前
刚刚,Grok4跑分曝光:「人类最后考试」拿下45%,是Gemini 2.5两倍,但网友不信
人工智能
蹦蹦跳跳真可爱5892 小时前
Python----大模型(使用api接口调用大模型)
人工智能·python·microsoft·语言模型
小爷毛毛_卓寿杰2 小时前
突破政务文档理解瓶颈:基于多模态大模型的智能解析系统详解
人工智能·llm
Mr.Winter`2 小时前
障碍感知 | 基于3D激光雷达的三维膨胀栅格地图构建(附ROS C++仿真)
人工智能·机器人·自动驾驶·ros·具身智能·环境感知