eProsima Fast DDS [7910]

eProsima Fast DDS是一个完整的开源DDS实现,适用于实时嵌入式架构和操作系统。参考链接:https://www.eprosima.com/index.php/products-all/eprosima-fast-dds [7911]

先决条件 [7877]

已安装 rosdep [7878]

安装软件包 [7879]

最简单的方式是从ROS 2的apt仓库安装。 [7880]

sudo apt install ros-humble-rmw-fastrtps-cpp

从源代码构建 [7881]

从源代码构建也是安装的另一种方式。 [7882]

首先,在ROS 2工作空间源目录中克隆Fast DDS和rmw_fastrtps。 [7912]

cd ros2_ws/src
git clone https://github.com/ros2/rmw_fastrtps ros2/rmw_fastrtps -b humble
git clone https://github.com/eProsima/Fast-DDS eProsima/fastrtps

然后,安装Fast DDS所需的必要软件包。 [7913]

cd ..
rosdep install --from src -i

最后,运行colcon build。 [7885]

colcon build --symlink-install

切换到rmw_fastrtps。 [7914]

可以通过指定环境变量来选择eProsima Fast DDS RMW: [7915]

export RMW_IMPLEMENTATION=rmw_fastrtps_cpp

参见:使用多个RMW实现 [7888]

运行发布者和订阅者 [7889]

现在运行``talker``和``listener``以测试Fast DDS。 [7916]

ros2 run demo_nodes_cpp talker
ros2 run demo_nodes_cpp listener