
ROS 2 文档中文翻译RMW 实现与 DDS 实现 5 篇Jazzy Jalisco原文来源ROS 2 DocumentationJazzy—— Installation 章节下的 RMW implementations 部分。承接前三份译文本文件按文档侧边栏顺序翻译接下来的 5 个页面RMW 实现总览Eclipse Cyclone DDSGurumNetworks GurumDDSRTI Connext DDSeProsima Fast DDS命令中的版本占位符已按 Jazzy 版本代入jazzy。1. RMW 实现总览默认情况下ROS 2 使用 DDS 作为其中间件。它兼容多家 DDS 或 RTPSDDS 的线上传输协议厂商的实现目前支持 eProsima 的 Fast DDS、RTI 的 Connext DDS、Eclipse Cyclone DDS 以及 GurumNetworks GurumDDS。它也支持 Zenoh 等非 DDS 的 RMW 实现。各发行版支持的 RMW 厂商请参阅 REP-2000。默认的 RMW 厂商是 eProsima 的 Fast DDS。查看所有可选项DDS 实现介绍如何使用 DDS即本文第 2–5 篇。非 DDS 实现介绍如何使用非 DDS 实现如 Zenoh尚未翻译如需可继续。2. Eclipse Cyclone DDSEclipse Cyclone DDS 是一个性能出色且稳健的开源 DDS 实现。Cyclone DDS 作为一个 Eclipse IoT 项目完全公开开发。另请参阅https://projects.eclipse.org/projects/iot.cyclonedds前置条件已安装 rosdep参见 rosdep 使用教程。安装软件包最简单的方式是从 ROS 2 apt 仓库安装$ sudo apt install ros-jazzy-rmw-cyclonedds-cpp从源码构建从源码构建是另一种安装方式。首先在 ROS 2 工作区的源码目录中克隆 Cyclone DDS 和 rmw_cyclonedds。要确定应检出的正确分支你需要查看你的 ROS 发行版的 ros2.repos 文件中指定的版本。或者你也可以运行以下命令来获取 Cyclone DDS 所需的正确分支/标签$ CYCLONEDDS_BRANCH$(curl -s https://raw.githubusercontent.com/ros2/ros2/refs/heads/jazzy/ros2.repos | grep -A 3 eclipse-cyclonedds/cyclonedds: | grep version: | awk {print $2})然后克隆并检出代码$ cd ros2_ws/src $ git clone https://github.com/ros2/rmw_cyclonedds ros2/rmw_cyclonedds -b jazzy $ git clone https://github.com/eclipse-cyclonedds/cyclonedds eclipse-cyclonedds/cyclonedds -b ${CYCLONEDDS_BRANCH}接着安装 Cyclone DDS 所需的软件包$ cd .. $ rosdep install --from src -i最后运行 colcon 构建$ colcon build --symlink-install切换到 rmw_cyclonedds通过指定环境变量从其他 RMW 切换到 rmw_cyclonedds$ export RMW_IMPLEMENTATIONrmw_cyclonedds_cpp另请参阅使用多个 RMW 实现。运行 talker 和 listener现在运行talker和listener来测试 Cyclone DDS$ source /opt/ros/jazzy/setup.bash $ ros2 run demo_nodes_cpp talker$ source /opt/ros/jazzy/setup.bash $ ros2 run demo_nodes_cpp listener3. GurumNetworks GurumDDSrmw_gurumdds是使用 GurumNetworks GurumDDS 实现的 ROS 中间件接口。关于 GurumDDS 的更多信息请访问 GurumNetworks 官网。前置条件本指南假设你已经完成了 ROS 2 环境配置无论是通过 deb 软件包安装 ROS 2还是在 Ubuntu 上从源码构建 ROS 2均见本系列译文第一份文件。版本要求详见 READMEROS 2 发行版GurumDDS 版本rolling 3.2.0lyrical 3.2.0kilted 3.2.0jazzy 3.2.0humble3.1.xGurumDDS 的 deb 软件包已在 Ubuntu 的 ROS 2 apt 仓库中提供。GurumDDS 的 Windows 二进制安装程序即将推出。你可以从 GurumDDS 免费试用页面获取免费试用许可证。获取许可证后请将其放置在以下位置/etc/gurumnet安装方式一从 ROS 2 apt 仓库安装推荐$ sudo apt install ros-jazzy-rmw-gurumdds-cpp这会同时安装rmw_gurumdds_cpp和gurumdds。方式二从源码构建克隆仓库$ cd ros2_ws/src $ git clone https://github.com/ros2/rmw_gurumdds -b jazzy ros2/rmw_gurumdds安装依赖$ cd .. $ rosdep install --from src -i --rosdistro jazzy使用 colcon 构建工作区$ colcon build --symlink-install切换到 rmw_gurumdds通过设置环境变量从其他 RMW 实现切换到 rmw_gurumdds$ export RMW_IMPLEMENTATIONrmw_gurumdds_cpp关于使用多个 RMW 实现的更多信息请参阅使用多个 RMW 实现。测试安装运行talker和listener节点来验证安装$ source /opt/ros/jazzy/setup.bash $ ros2 run demo_nodes_cpp talker$ source /opt/ros/jazzy/setup.bash $ ros2 run demo_nodes_cpp listener如果两个节点通信成功说明你的安装工作正常。注意在运行这些命令之前记得先 source 你的 ROS 2 配置脚本。4. RTI Connext DDSRTI Connext DDS 在全球 2000 多个要求最苛刻的系统设计中备受信赖以最高水平的性能、可靠性和安全性分发关键的实时数据。它可免费用于原型开发、研究、非商业和学术用途。更多信息以及支持和商业许可的选项请访问 RTI 官网。前置条件安装 RTI Connext DDS要构建和使用rmw_connextdds需要一个与所使用的 ROS 2 发行版兼容的 Connext DDS 版本。使用 apt 安装rmw_connextdds时会包含 Connext DDS如果从源码构建则需要手动安装。下表列出了使用apt安装的 Connext DDS 版本以及从源码构建所需的版本ROS 2 发行版使用 apt 安装的版本从源码构建所需版本rolling不适用7.7.0lyrical7.7.07.7.0kilted7.3.07.3.0jazzy6.0.16.0.1humble6.0.16.0.1RTI Connext Pro 可通过多种渠道获取ROS 2 apt 仓库ROS 2 用户可以使用以下命令从 ROS apt 仓库安装适用于 x86_64 Linux 的 RTI Connext DDS 库非商业用途版本v7.3.0$ sudo apt update sudo apt install -q -y rti-connext-dds-7.3.0-rosv6.0.1Jazzy 对应版本$ sudo apt update sudo apt install -q -y rti-connext-dds-6.0.1该软件包仅包含 RTI Connext 核心 DDS 库不包含完整的 Connext Professional 工具套件和运行时服务。请注意使用 apt 安装rmw_connextdds时会自动安装这些 Connext 库。其他安装选项Connext Robotics Toolkit 包含完整的 Connext 工具套件和基础设施服务。它可以通过 apt 一步完成 ROS 和 Connext 的安装并可免费用于原型开发、研究、非商业和学术用途。关于在各种平台上构建和调优 RMW 与 ROS 2 应用、以及启用 DDS Security 的详细说明可在 RTI ROS 社区页面找到。安装 rmw_connextdds 二进制包要从 ROS 2 apt 仓库安装rmw_connextdds和 Connext 库的二进制包使用以下命令$ sudo apt update sudo apt install -q -y ros-jazzy-rmw-connextdds从源码构建 rmw_connextdds从源码构建可以确保 RMW 与你的系统匹配并正确安装。以下说明假设构建主机和目标平台均为 Linux x86_64面向其他平台和目标包括 Arm、Windows 和 macOS的构建说明请见 RTI ROS 社区页面。将rmw_connextdds仓库克隆到你的 ROS 2 工作区并选择与所使用的 ROS 2 发行版匹配的分支$ mkdir -p ros2_ws/src $ cd ros2_ws $ git clone -b jazzy https://github.com/ros2/rmw_connextdds src/rmw_connextdds配置环境帮助 colcon 找到 RTI Connext 的安装位置。可以手动把环境变量NDDSHOME设置为 RTI Connext 的安装位置也可以使用 RTI Connext 安装中自带的脚本$ source ${RTI_CONNEXT_INSTALL_LOCATION}/resource/scripts/rtisetenv_x64Linux4gcc7.3.0.bash确保你已经配置好 ROS 2 环境$ source /opt/ros/jazzy/setup.bash使用 colcon 构建该 RMW$ colcon build --symlink-install构建成功完成后记得 source 工作区的配置文件$ source install/setup.bash使用构建好的 rmw_connextdds设置环境变量RMW_IMPLEMENTATION告诉 ROS 2 使用哪个 RMW$ export RMW_IMPLEMENTATIONrmw_connextdds另请参阅使用多个 RMW 实现。运行 talker 和 listener现在运行talker和listener来测试 RTI Connext DDS$ source /opt/ros/jazzy/setup.bash $ ros2 run demo_nodes_cpp talker$ source /opt/ros/jazzy/setup.bash $ ros2 run demo_nodes_cpp listener5. eProsima Fast DDSeProsima Fast DDS 是一个面向实时嵌入式架构和操作系统的完整开源 DDS 实现。另请参阅https://www.eprosima.com/index.php/products-all/eprosima-fast-dds前置条件已安装 rosdep参见 rosdep 使用教程。安装软件包最简单的方式是从 ROS 2 apt 仓库安装$ sudo apt install ros-jazzy-rmw-fastrtps-cpp从源码构建从源码构建是另一种安装方式。首先在 ROS 2 工作区的源码目录中克隆 Fast DDS 和 rmw_fastrtps$ cd ros2_ws/src $ git clone https://github.com/ros2/rmw_fastrtps ros2/rmw_fastrtps -b jazzy $ git clone https://github.com/eProsima/Fast-DDS eProsima/fastrtps接着安装 Fast DDS 所需的软件包$ cd .. $ rosdep install --from src -i最后运行 colcon 构建$ colcon build --symlink-install切换到 rmw_fastrtps可以通过指定环境变量来选择 eProsima Fast DDS RMW$ export RMW_IMPLEMENTATIONrmw_fastrtps_cpp另请参阅使用多个 RMW 实现。运行 talker 和 listener现在运行talker和listener来测试 Fast DDS$ source /opt/ros/jazzy/setup.bash $ ros2 run demo_nodes_cpp talker$ source /opt/ros/jazzy/setup.bash $ ros2 run demo_nodes_cpp listener附注本译文基于 ROS 2 官方文档Jazzy分支命令中的版本占位符已替换为jazzy。Installation 章节剩余未译页面DDS 实现总览DDS-Implementations目录页、非 DDS 实现Non-DDS implementations含 Zenoh、ROS 2 镜像站Mirrors。如需继续可随时提出。