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

相关推荐
Abdullah al-Sa19 分钟前
Docker教程(喂饭级!)
c++·人工智能·docker·容器
神经星星23 分钟前
无机材料逆合成效率飙升,韩国团队推出Retrieval-Retro,成果入选NeurIPS 2024
人工智能·深度学习·机器学习
大数据追光猿27 分钟前
【深度学习】Pytorch项目实战-基于协同过滤实现物品推荐系统
人工智能·pytorch·python·深度学习·ai编程·推荐算法
CodeJourney.36 分钟前
EndNote与Word关联:科研写作的高效助力
数据库·人工智能·算法·架构
jingwang-cs43 分钟前
内外网文件传输 安全、可控、便捷的跨网数据传输方案
人工智能·后端·安全
乐享数科1 小时前
乐享数科:供应链金融—三个不同阶段的融资模式
大数据·人工智能·金融
幻想趾于现实1 小时前
视觉应用工程师(面试)
人工智能·数码相机·计算机视觉
简简单单做算法1 小时前
基于PSO粒子群优化的BiLSTM双向长短期记忆网络序列预测算法matlab仿真,对比BiLSTM和LSTM
人工智能·lstm·bilstm·pso-bilstm·pso·双向长短期记忆网络·序列预测
Felaim2 小时前
基于模仿学习(IL)的端到端自动驾驶发展路径
人工智能·深度学习·自动驾驶
量子-Alex3 小时前
【目标检测】【PANet】Path Aggregation Network for Instance Segmentation
人工智能·目标检测·计算机视觉