项目摘要
一句话总结
面向AI编码代理的ROS2工程技能包,覆盖从工作区搭建到测试、部署和多机器人场景。
项目描述
这是一个基于SKILL.md的ROS2知识模块,为ClaudeCode、Codex、Cursor、GeminiCLI等支持AgentSkills的代理提供决策框架、参考资料和辅助脚本。它适合使用AI辅助开发ROS2应用、驱动、仿真与部署流程的机器人软件工程师和团队。
项目详细信息
ros2-工程技能
生产级 ROS 2 开发的代理技能 - 从第一个工作区到队列部署。
适用于 Claude Code、Codex、Cursor、Gemini CLI 以及任何支持 Agent Skills 标准的代理。
之前/之后
提示: “我的 ROS 2 订阅者没有收到任何传感器消息。帮我修复它。”
| 没有此技能 | 加载此技能 | |
|---|---|---|
| ```python # "Check your topic name and make sure # the publisher is running" sub = node.create_subscription( Image, '/camera/image_raw', callback, 10) ``` 笼统的建议——忽略了真正的问题。 |
```python
# Diagnoses QoS mismatch (DDS RxO rules):
# Sensor drivers default to BEST_EFFORT,
# but queue depth "10" implies RELIABLE.
from rclpy.qos import qos_profile_sensor_data
sub = node.create_subscription( Image, '/camera/image_raw', callback, qos_profile_sensor_data) ^^^^^^^^^^^^^^^^^^^^^^BEST_EFFORT + VOLATILE — matches sensor pub
裸 | ```text my_lidar_driver/ ├── include/my_lidar_driver/ │ └── my_lidar_driver_node.hpp # LifecycleNode ├── src/ │ ├── my_lidar_driver_node.cpp # on_configure/activate/… │ └── main.cpp ├── launch/bringup.launch.py # auto-configure + activate ├── config/params.yaml ├── test/test_my_lidar_driver.cpp # gtest ├── CMakeLists.txt # target_link_libraries └── package.xml # format 3, Apache-2.0 ``` 具有托管转换的 LifecycleNode、具有自动激活功能的启动文件、gtest 脚手架、现代 CMake(`target_link_libraries` 而非已弃用的 `ament_target_dependencies`)以及发行版感知默认值。 |
这是什么
基于 SKILL.md 的知识模块,为 AI 编码代理提供深厚的 ROS 2 工程专业知识。 它提供的不是浅薄的备忘单,而是:
- 决策框架 — 何时使用 rclcpp 与 rclpy,哪种 QoS 配置文件、生命周期与普通节点
- 渐进式披露 -
SKILL.md中的紧凑路由,references/中的详细模式 - 全谱 — 通过实时调整、Nav2、MoveIt 2、ros2_control、DDS 配置、交叉编译和 CI/CD 进行工作区设置
- 发行版感知 — 与迁移路径的显式 Humble / Jazzy / Kilted / Rolling 差异
- 反模式文档 — 生产中出现的问题以及原因
它与现有 ROS 2 技能有何不同
| 方面 | ROS 2 典型技能 | 这个项目 |
|---|---|---|
| 深度 | 基本 QoS + 生命周期介绍 | DDS 供应商调整、自定义执行器、进程内零拷贝、类型适配器 |
| 范围 | 单个 SKILL.md 文件 | 通过渐进披露的 20 个参考文件 |
| 硬件 | 顺便提到 | ros2_control 硬件接口模式、串行/CAN/EtherCAT、控制器链接 |
| 实时 | 未涵盖 | PREEMPT_RT、realtime_tools、内存分配、回调组策略 |
| 模拟 | 顺便提到 | Gazebo 版本矩阵,gz_ros2_control,Isaac Sim,sim-to-real |
| 安全 | 未涵盖 | SROS2、DDS 安全插件、证书管理、供应链 |
| 嵌入式 | 未涵盖 | 微型 ROS、rclc、XRCE-DDS、ESP32/STM32/RP2040 |
| 多机器人 | 未涵盖 | 开放 RMF、队列适配器、大规模 DDS 发现、NTP/PTP 同步 |
| 测试 | “使用 pytest” | launch_testing、gtest、industrial_ci、循环仿真 CI |
| 部署 | 未涵盖 | Docker 多阶段、交叉编译、fleet OTA、Zenoh 路由 |
安装
克劳德·代码
# From plugin marketplace (terminal)
claude plugin marketplace add dbwls99706/ros2-engineering-skills
claude plugin install ros2-engineering@ros2-engineering-skills
# Or use slash commands (inside Claude Code)
/plugin marketplace add dbwls99706/ros2-engineering-skills
/plugin install ros2-engineering@ros2-engineering-skills
# Or clone directly
git clone https://github.com/dbwls99706/ros2-engineering-skills.git ~/.claude/skills/ros2-engineering-skills
Codex / Gemini CLI / OpenCode
git clone https://github.com/dbwls99706/ros2-engineering-skills.git ~/.agents/skills/ros2-engineering-skills
### 光标
git clone https://github.com/dbwls99706/ros2-engineering-skills.git
# Add to .cursor/rules/ros2-engineering-skills
任何项目(符号链接)
ln -s /path/to/ros2-engineering-skills .claude/skills/ros2-engineering-skills
## 结构
ros2-engineering-skills/
├── SKILL.md # Entry point — decision router + core principles
├── references/ # 20 reference files (13,000+ lines)
│ ├── workspace-build.md # colcon, ament_cmake, package.xml, overlays
│ ├── nodes-executors.md # rclcpp/rclpy nodes, executors, callback groups
│ ├── communication.md # Topics, services, actions, QoS, type adapters, DDS tuning
│ ├── lifecycle-components.md # Managed nodes, component loading, composition
│ ├── launch-system.md # Python launch API, conditions, events, large systems
│ ├── tf2-urdf.md # Transforms, URDF, xacro, robot_state_publisher
│ ├── hardware-interface.md # ros2_control, HW interfaces, controller chaining, EtherCAT
│ ├── realtime.md # RT kernel, realtime_tools, jitter, deterministic execution
│ ├── navigation.md # Nav2, SLAM, costmaps, BT navigator, collision monitor
│ ├── manipulation.md # MoveIt 2, MTC, planning scene, grasp pipelines
│ ├── perception.md # image_transport, PCL, cv_bridge, depth, Isaac ROS
│ ├── simulation.md # Gazebo, Isaac Sim, gz_ros2_control, sim-to-real
│ ├── security.md # SROS2, DDS security plugins, certificates, supply chain
│ ├── micro-ros.md # micro-ROS, rclc, XRCE-DDS, ESP32/STM32/RP2040
│ ├── multi-robot.md # Fleet management, Open-RMF, DDS discovery at scale
│ ├── testing.md # gtest, pytest, launch_testing, industrial_ci, CI/CD
│ ├── debugging.md # ros2 doctor, tracing, Foxglove, MCAP, rosbag2
│ ├── deployment.md # Docker, cross-compile, fleet management, Zenoh routing
│ ├── message-types.md # Message conventions, units, covariance, diagnostics
│ └── migration-ros1.md # ROS 1 → ROS 2 strategy, ros1_bridge
├── scripts/
│ ├── create_package.py # Scaffold a package with best-practice structure (cpp/python/interfaces)
│ ├── qos_checker.py # Verify QoS compatibility between pub/sub pairs with fix suggestions
│ └── launch_validator.py # AST-based static analysis for Python launch files
├── tests/
│ ├── test_create_package.py # 40 tests — scaffolding, validation, copyright, direct + CLI
│ ├── test_launch_validator.py # 38 tests — AST visitors, patterns, CLI, main()
│ ├── test_qos_checker.py # 46 tests — parsing, compatibility, presets, CLI, main()
│ ├── test_qos_property.py # 13 tests — Hypothesis property-based DDS RxO verification
│ └── Dockerfile.ros2-test # Multi-stage Docker test (build + validate across distros)
├── setup.cfg # flake8 + mypy configuration
├── pytest.ini # pytest configuration
├── LICENSE
└── README.md
当前状态
完整且经过验证。 20 个参考文件、13,000 多行生产级指南、3 个实用程序脚本 — 所有这些都在实时 ROS 2 Jazzy 环境中进行了测试和验证。**
| 398 项测试 | 单元+基于属性(假设)+CLI+集成 |
| 94% 覆盖率 | 所有脚本均使用 flake8 + mypy clean 进行验证 |
| 真实世界评估 | **在 WSL (Ubuntu 24.04 + ROS 2 Jazzy) 上针对 SROS2、微型 ROS rclc 和多机器人车队场景进行了验证 |
| 4 个 CI 职位 | Lint、单元测试、ros2 集成、lint 脚本 |
支持的 ROS 2 发行版
- Jazzy Jalisco(LTS,推荐)——主要目标
- Kilted Kaiju(非 LTS,2025 年 5 月)— Zenoh Tier 1,EventsExecutor 稳定
- 谦卑玳瑁 (LTS) — 完全支持
- Foxy Fitzroy(LTS,2023 年 6 月 EOL)— 遗留迁移参考
- Rolling Ridley — 最新功能,指出它们的分歧之处
贡献
欢迎贡献。 请:
- 将
SKILL.md控制在 500 行以下 — 在references/中添加深度 - 包含工作代码示例,而不是伪代码
- 记录反模式和正确模式
- 注意您的更改适用于哪个 ROS 2 发行版
- 提交前运行
flake8 scripts/ tests/和mypy scripts/ - 确保
pytest tests/ --cov=scripts --cov-fail-under=90通过 - 使用至少一种代理进行测试(Claude Code、Codex 等)
许可证
Apache-2.0 — 参见 LICENSE。
