소스 정보
- 저장소
- MIUAV/vibe-coding-ros2
- 최근 소스 활동
- 2026년 4월 3일 16:37
- 감지된 SKILL.md 언어
- 중국어
- 스타
- 26
- 포크
- 2
설치 방법
기본적으로 소스를 먼저 확인하는 Prompt가 선택됩니다. 직접 명령으로 전환하거나 로컬 사본을 다운로드할 수도 있습니다.
소스 파일 검토
설치 여부를 결정하기 전에 SKILL.md와 SkillsMP에 표시된 보조 파일을 읽어 보세요.
메뉴
기본적으로 소스를 먼저 확인하는 Prompt가 선택됩니다. 직접 명령으로 전환하거나 로컬 사본을 다운로드할 수도 있습니다.
설치 여부를 결정하기 전에 SKILL.md와 SkillsMP에 표시된 보조 파일을 읽어 보세요.
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
직접 명령은 검토 Prompt를 거치지 않습니다. 실행하기 전에 소스를 확인하세요.
npx skills add https://github.com/MIUAV/vibe-coding-ros2 --skill ros2-distributed-communication명령은 한 줄로 유지됩니다. 복사하기 전에 가로로 스크롤해 전체 내용을 확인하세요.
로컬 사본을 원하시나요? SkillsMP에서 현재 제공할 수 있는 파일을 다운로드하세요.
SOC 직업 분류 기준
SKILL.md 표시 중
| name | ros2-distributed-communication |
| description | ROS2 分布式通讯技能 - DDS/RMW 配置、多机器通讯、网络优化、跨域配置 |
| user-invocable | true |
| argument-hint | 分布式通讯 OR dds OR rmw OR 多机器 OR 跨域 OR network |
ROS2 DDS/RMW 分布式通讯完整指南
当需要以下帮助时使用此技能:
| 实现 | 包 | 特性 |
|---|---|---|
| CycloneDDS | rclcpp | 高性能,默认 |
| FastRTPS | fastrtps | 低延迟 |
| Connext | rti-connext | 企业级(收费) |
┌─────────────┐ ┌─────────────┐
│ Node A │ │ Node B │
│ (机器 A) │ │ (机器 B) │
└──────┬──────┘ └──────┬──────┘
│ │
└────────┬──────────┘
│
┌──────┴──────┐
│ RMW │
│ (DDS层) │
└──────┬──────┘
│
┌──────┴──────┐
│ Network │
│ (UDP/TCP) │
└─────────────┘
# 使用 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
// 高可靠性配置
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);
# 使用不同域隔离通讯
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 /chatter
# 手动发布测试
ros2 topic pub /chatter std_msgs/msg/String "data: test"
# 查看实时数据
ros2 topic echo /chatter
# 诊断工具
ros2 daemon start
ros2 doctor --report
# 查看当前 RMW
ros2 pkg list | grep rmw
# 查看话题通讯
ros2 topic hz /chatter
ros2 topic bw /chatter
# 网络诊断
ros2 network_scanner
# 启用日志调试
export RCUTILS_CONSOLE_OUTPUT_FORMAT="[{severity}] [{name}]: {message}"
export RCUTILS_LOGGING_BUFFER_OUTPUT_STRING=0
# RMW 调试
export RMW_IMPLEMENTATION=rmw_fastrtps_cpp
export FASTRTPS_DEFAULT_PROFILE=file://fastrtps_debug.xml