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

相关推荐
liruiqiang05几秒前
循环神经网络 - 长短期记忆网络
人工智能·rnn·深度学习·神经网络·机器学习·ai·lstm
小杨4043 分钟前
python入门系列十六(网络编程)
人工智能·python·网络协议
Elastic 中国社区官方博客3 分钟前
Elasticsearch 向量数据库,原生支持 Google Cloud Vertex AI 平台
大数据·数据库·人工智能·elasticsearch·搜索引擎·语言模型·自然语言处理
Ven%1 小时前
电脑的usb端口电压会大于开发板需要的电压吗
人工智能·单片机·嵌入式硬件
Jackilina_Stone4 小时前
transformers:打造的先进的自然语言处理
人工智能·自然语言处理·transformers
2401_897930064 小时前
BERT 模型是什么
人工智能·深度学习·bert
最新快讯6 小时前
科技快讯 | 阿里云百炼MCP服务上线;英伟达官宣:CUDA 工具链将全面原生支持 Python
人工智能
__Benco7 小时前
OpenHarmony子系统开发 - 热管理(一)
人工智能·harmonyos
吴法刚8 小时前
14-Hugging Face 模型微调训练(基于 BERT 的中文评价情感分析(二分类))
人工智能·深度学习·自然语言处理·分类·langchain·bert·langgraph
碳基学AI8 小时前
北京大学DeepSeek内部研讨系列:AI在新媒体运营中的应用与挑战|122页PPT下载方法
大数据·人工智能·python·算法·ai·新媒体运营·产品运营