DDS
DDS 通信示例
1 概述
ROS 2 默认中间件即 DDS(自动发现、无中心、UDP 传输), 你只需关心话题名、消息类型和 QoS.
DDS 实现.
实现 | 常见 RMW 标识 | 备注 |
---|---|---|
eProsima Fast DDS(旧称 Fast RTPS) | rmw_fastrtps_cpp / rmw_fastrtps_dynamic_cpp |
官方文档列为默认实现;各版均可用。([docs.ros.org][1]) |
Eclipse Cyclone DDS | rmw_cyclonedds_cpp |
Galactic 中被选为默认,其余版本可选。([docs.ros.org][2]) |
RTI Connext DDS | rmw_connextdds |
专业版/付费为主;可选 RMW。([GitHub][3]) |
GurumDDS | rmw_gurumdds_cpp |
可选 RMW |
ADLINK OpenSplice(已停更) | rmw_opensplice_cpp |
早期支持,现已归档停用。([GitHub][4]) |
各 ROS 2 版本的默认 DDS.
发行版 | 默认 DDS / RMW |
---|---|
Ardent (2017) | Fast RTPS(eProsima) |
Bouncy (2018) | Fast RTPS(eProsima) |
Crystal (2018) | Fast RTPS(eProsima) |
Dashing (2019) | Fast RTPS(eProsima) |
Eloquent (2019) | Fast RTPS/Fast DDS(eProsima) |
Foxy (2020) | Fast DDS(eProsima) |
Galactic (2021) | Cyclone DDS(Eclipse) |
Humble (2022, LTS) | Fast DDS(eProsima) |
Iron (2023) | Fast DDS(eProsima) |
Jazzy (2024) | Fast DDS(eProsima) |
2 安装
1 | sudo apt install ros-${ROS_DISTRO}-rmw-fastrtps-dynamic-cpp |
3 使用
切换不同的 DDS.
临时切换.
1 | export RMW_IMPLEMENTATION=rmw_fastrtps_cpp # 或 rmw_cyclonedds_cpp / rmw_connextdds / rmw_gurumdds_cpp |
永久切换.
1 | echo 'export RMW_IMPLEMENTATION=rmw_cyclonedds_cpp' >> ~/.bashrc |
检查中间件.
1 | printenv RMW_IMPLEMENTATION |
4 配置局域网通信
在 DDS 中, 不同逻辑网络共享物理网络的主要机制被称为 Domain ID. 同一域中的 ROS2 节点可以自由地发现和相互发送消息, 而不同域中的 ROS2 节点则不能. 所有 ROS2 节点默认使用 Domain ID 为 0(一般为 0-101).
1 | # 这里例子设置为 1 |
5 修改 DDS 配置
TODO
6 DDS 共享内存
TODO
All articles on this blog are licensed under CC BY-NC-SA 4.0 unless otherwise stated.