ros2-distributed-communication
ROS2 分布式通讯技能 - DDS/RMW 配置、多机器通讯、网络优化、跨域配置
от MIUAV★ 30 звёзд на GitHub
Установить ros2-distributed-communication в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Об этом скилле
ROS2 Distributed Communication Skill
ROS2 DDS/RMW 分布式通讯完整指南
何时使用
当需要以下帮助时使用此技能:
- 多机器机器人通讯
- DDS 中间件配置
- 网络优化和 QoS
- 跨域通讯配置
- 通讯诊断和调试
快速参考
RMW 实现
| 实现 | 包 | 特性 |
|---|---|---|
| CycloneDDS | rclcpp | 高性能,默认 |
| FastRTPS | fastrtps | 低延迟 |
| Connext | rti-connext | 企业级(收费) |
架构
┌─────────────┐ ┌─────────────┐
│ Node A │ │ Node B │
│ (机器 A) │ │ (机器 B) │
└──────┬──────┘ └──────┬──────┘
│ │
└────────┬──────────┘
│
┌──────┴──────┐
│ RMW │
│ (DDS层) │
└──────┬──────┘
│
┌──────┴──────┐
│ Network │
│ (UDP/TCP) │
└─────────────┘
RMW 配置
切换中间件
# 使用 FastRTPS
export RMW_IMPLEMENTATION=rmw_fastrtps_cpp
# 使用 CycloneDDS
export RMW_IMPLEMENTATION=rmw_cyclonedds_cpp
# 使用 Connext (如已安装)
export RMW_IMPLEMENTATION=rmw_connext_cpp
# 验证
ros2 doctor -r
运行时切换
// 代码中切换
rclcpp::init(argc, argv,
rclcpp::InitOptions::from_raw_arguments(
"--rmw", "rmw_fastrtps_cpp"));
多机器通讯
网络发现配置
<!-- fastrtps.xml -->
<?xml version="1.0" ?>
<profiles>
<participant name="participant_name">
<rtps>
<discoveryProtocol>SIMPLE</discoveryProtocol>
<discoveryServers>
<RemoteServer prefix="uuid">
<metatrafficUnicastLocatorList>
<locator>
<udpv4>
<address>192.168.1.100</address>
<port>11811</port>
</udpv4>
</locator>
</metatrafficUnicastLocatorList>
</RemoteServer>
</discoveryServers>
</rtps>
</participant>
</profiles>
设置环境变量
# 机器 A (服务器)
export ROS_LOCALHOST_ONLY=0
export RMW_FASTRTPS_DEFAULT_PROFILES_FILE=/path/to/fastrtps.xml
export FASTRTPS_DEFAULT_PROFILE=file:///path/to/fastrtps.xml
# 或者使用域 ID
export ROS_DOMAIN_ID=42
通讯测试
# 机器 A
ros2 run demo_nodes_cpp listener
# 机器 B
ros2 run demo_nodes_cpp talker
# 查看话题
ros2 topic list
QoS 网络配置
可靠传输配置
// 高可靠性配置
rclcpp::QoS reliable_qos(10);
reliable_qos.reliability(RMW_QOS_POLICY_RELIABILITY_RELIABLE)
.durability(RMW_QOS_POLICY_DURABILITY_VOLATILE);
auto sub = node->create_subscription<MyMsg>(
"/topic", reliable_qos, callback);
跨域配置
<!-- cyclonedds.xml -->
<?xml version="1.0" encoding="UTF-8"?>
<cyclonedds xmlns="https://cdds.io/config"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="https://cdds.io/config
https://raw.githubusercontent.com/eclipse-cyclonedds/cyclonedds/master/etc/cyclonedds.xsd">
<domain id="0">
<discovery>
<ParticipantIndex>auto</ParticipantIndex>
<MaxAutoParticipantIndex>50</MaxAutoParticipantIndex>
</discovery>
<internal>
<NetworkInterfaceAddress>auto</NetworkInterfaceAddress>
</internal>
</domain>
<domain id="1">
<discovery>
<ParticipantIndex>auto</ParticipantIndex>
</discovery>
</domain>
</cyclonedds>
性能优化
网络绑定
<!-- 指定网络接口 -->
<profiles>
<participant name="participant_name">
<rtps>
<transport>
<sendSocketBufferSize>
<size>1048576</size>
</sendSocketBufferSize>
<receiveSocketBufferSize>
<size>1048576</size>
</receiveSocketBufferSize>
</transport>
<metatrafficUnicastLocatorList>
<locator>
<udpv4>
<address>192.168.1.10</address>
<port>7400</port>
</udpv4>
</locator>
</metatrafficUnicastLocatorList>
</rtps>
</participant>
</profiles>
缓冲区配置
// 增加队列深度处理高吞吐
rclcpp::QoS high_throughput_qos(100); // 深度100
high_throughput_qos.best_effort()
.durability_volatile();
auto pub = node->create_publisher<sensor_msgs::msg::PointCloud2>(
"/points", high_throughput_qos);
跨域通讯 (Domain)
域 ID 配置
# 使用不同域隔离通讯
export ROS_DOMAIN_ID=0 # 主系统
export ROS_DOMAIN_ID=1 # 测试系统
export ROS_DOMAIN_ID=2 # 开发系统
域过滤
<!-- 只订阅特定域的数据 -->
<dataReader name="my_reader">
<topic>
<name>robot/chassis</name>
<dataType>MyType</dataType>
<domainId>0</domainId>
</topic>
</dataReader>
常见问题排查
节点不可见
# 检查网络
ping other_machine
# 检查域 ID
echo $ROS_DOMAIN_ID
# 查看 ROS 诊断
ros2 doctor
# 列出所有节点
ros2 node list
# 查看节点信息
ros2 node info /talker
话题不通
# 检查话题列表
ros2 topic list
# 查看话题类型
ros2 topic type /ch
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
FAQ
Что делает скилл ros2-distributed-communication?
ROS2 分布式通讯技能 - DDS/RMW 配置、多机器通讯、网络优化、跨域配置
Как установить скилл ros2-distributed-communication?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл ros2-distributed-communication запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
theme-factory
AnthropicToolkit for styling artifacts with a theme. These artifacts can be slides, docs, reportings, HTML landing pages, etc. There are 10 pre-set themes with…
access
AnthropicManage Discord channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
configure
AnthropicSet up the Discord channel — save the bot token and review access policy. Use when the user pastes a Discord bot token, asks to configure Discord, asks "how…
access
AnthropicManage iMessage channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…