Token导航 LogoToken导航TokenDH.com
研究检索需要联网github未标认证来源可访问许可证需确认审计通过

ros2-engineering-skillsros2 工程技能

Agent Skill

ros2-engineering-skills 用于查找、检索和筛选相关信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要根据关键词、任务场景或来源线索快速定位候选结果时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

总安装

192

周安装

8

GitHub Stars

59

下载量

64
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

2

许可证

unknown

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:ros2-engineering-skills(ros2 工程技能)
来源仓库:https://github.com/dbwls99706/ros2-engineering-skills
仓库路径:skills/ros2-engineering-skills
安装命令:
npx skills add https://github.com/dbwls99706/ros2-engineering-skills --skill ros2-engineering-skills
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/dbwls99706/ros2-engineering-skills --skill ros2-engineering-skills

简介

ros2-engineering-skills 提供 ROS 2 开发 API 参考与代码模板,指导正确使用方法与常见误区。

  • 渐进式披露设计,从工作空间搭建到 fleet 部署全覆盖,但不涉及 CI/CD 或运维自动化。
  • 适用于机器人系统开发,强调单一职责原则,避免功能越界导致误用。
  • 使用前需确认 ROS 2 版本兼容性与 hook 执行权限,警惕自动代码执行带来的安全风险。
  • 适用宿主包括 Codex、Claude、Cursor、Gemini CLI,接入前应确认版本、权限和运行环境要求。

SKILL.md

ROS 2 Engineering Skills

Single responsibility: This skill is an API reference & code template guide for ROS 2 development. It tells you *how to use ROS 2 APIs correctly* and *what mistakes to avoid*. It does NOT do CI/CD orchestration, incident response, data analysis, or deployment automation — those are separate skill categories.

A progressive-disclosure skill for ROS 2 development — from first workspace to production fleet deployment. Each section below gives you the essential decision framework; detailed patterns, code templates, and anti-patterns live in the references/ directory. Read the relevant reference file before writing code.

How to use this skill

Progressive disclosure — do NOT read everything at once. This skill is structured in layers. Only load what you need for the current task:

  1. This file (SKILL.md) — always loaded. Contains decision routing, core principles, pitfalls, and anti-patterns. Sufficient for answering quick questions and making architectural decisions.
  2. **references/*.md** — load on demand. Use the Decision Router below to pick the 1–2 files relevant to the user's current task. Do NOT read all 20 reference files — that wastes context and causes confusion.
  3. scripts/ — run only when the user needs code generation, QoS checking, or launch validation. These are tools, not reading material.

Steps:

  1. If .skill-runs.log exists in the workspace, read the last few lines to understand what was done and what issues occurred in previous sessions.
  2. Identify what the user is building (see Decision Router below).
  3. Read only the matching references/*.md file(s) for detailed guidance.
  4. Check the AI pitfalls table before generating any code.
  5. Apply the Core Engineering Principles in every artifact you produce.
  6. When multiple domains intersect (e.g. Nav2 + ros2_control), read both files but favor safety > determinism > simplicity when recommendations conflict.

Execution log: The Stop hook automatically appends a session summary to .skill-runs.log in the workspace. This lets you see what was validated last time and what issues were found — check it to avoid repeating past mistakes.

Decision router

User is doing...Read
Creating a workspace, package, or build configreferences/workspace-build.md
Writing nodes, executors, callback groupsreferences/nodes-executors.md
Topics, services, actions, custom interfaces, QoSreferences/communication.md
Lifecycle nodes, component loading, compositionreferences/lifecycle-components.md
Launch files, conditional logic, event handlersreferences/launch-system.md
tf2, URDF, xacro, robot_state_publisherreferences/tf2-urdf.md
ros2_control, hardware interfaces, controllersreferences/hardware-interface.md
Real-time constraints, PREEMPT_RT, memory, jitterreferences/realtime.md
Nav2, SLAM, costmaps, behavior treesreferences/navigation.md
MoveIt 2, planning scene, grasp pipelinesreferences/manipulation.md
Camera, LiDAR, PCL, cv_bridge, depth processingreferences/perception.md
Unit tests, integration tests, launch_testing, CIreferences/testing.md
ros2 doctor, tracing, profiling, rosbag2references/debugging.md
Docker, cross-compile, fleet deployment, OTAreferences/deployment.md
Gazebo, Isaac Sim, sim-to-real, use_sim_timereferences/simulation.md
SROS2, DDS security, certificates, supply chainreferences/security.md
micro-ROS, MCU/RTOS, XRCE-DDS, rclcreferences/micro-ros.md
Multi-robot fleet, Open-RMF, DDS discovery scalereferences/multi-robot.md
Message types, units, covariance, frame conventionsreferences/message-types.md
ROS 1 migration, ros1_bridge, hybrid operationreferences/migration-ros1.md

Cross-cutting concerns: Security, error handling, and QoS are not isolated to single reference files — apply them whenever the data path crosses a trust boundary, a node owns hardware, or communication reliability matters. Use your judgment about which cross-cutting concerns apply to the user's specific situation.

Core engineering principles

These apply to every ROS 2 artifact you produce, regardless of domain.

1. Distro awareness

Staleness warning: The table below was last verified on 2026-03-30. If the current date is more than 6 months past that, re-verify EOL dates and feature support against https://docs.ros.org/en/rolling/Releases.html before relying on this table. When you update it, change both LAST_UPDATED and NEXT_REVIEW comments above.

Always ask which ROS 2 distribution the user targets. Key differences:

FeatureFoxy (EOL)Humble (LTS)Jazzy (LTS)Kilted (non-LTS)Rolling
EOLJun 2023 (ended)May 2027May 2029Nov 2025Rolling
Ubuntu20.0422.0424.0424.04Latest
Default DDSFast DDSFast DDSFast DDSFast DDSFast DDS
Zenoh supportTier 1Tier 1
Type description supportNoNoYesYesYes
Service introspectionNoNoYesYesYes
EventsExecutorNoNoExperimentalStable (+ rclpy)Stable (+ rclpy)
Default bag formatsqlite3sqlite3MCAPMCAPMCAP
ros2_control interfaceN/A (separate)2.x4.x4.xLatest
CMake recommendationament_target_depsament_target_depseithertarget_link_libstarget_link_libs

When the user does not specify, default to the latest LTS (Jazzy). Pin the exact distro in Dockerfile, CI, and documentation so builds are reproducible.

2. C++ vs Python decision

Choose the language based on the node's role, not personal preference.

Use rclcpp (C++) when:

  • The node sits in a control loop running ≥100 Hz
  • Deterministic memory allocation matters (real-time path)
  • The node is a hardware driver or controller plugin
  • Intra-process zero-copy communication is required

Use rclpy (Python) when:

  • The node is orchestration, monitoring, or parameter management
  • Rapid prototyping with frequent iteration
  • Heavy use of ML frameworks (PyTorch, TensorFlow) that are Python-native
  • The node does not sit in a latency-critical path

Mixed stacks are normal. A typical robot has C++ drivers/controllers and Python orchestration/monitoring. Note: component_container (composition) only loads C++ components via pluginlib. Python nodes run as separate processes, but can share a launch file and communicate via zero-overhead intra-host DDS.

Intra-process communication works for any nodes sharing a process — not only composable components. Any nodes instantiated in the same process with use_intra_process_comms(true) can use zero-copy transfer.

3. Package structure conventions

Every package should follow this layout. Consistency across a workspace reduces onboarding time and makes CI scripts portable.

my_package/
├── CMakeLists.txt          # or setup.py for pure Python
├── package.xml             # format 3, with <depend> tags
├── config/
│   └── params.yaml         # default parameters
├── launch/
│   └── bringup.launch.py   # Python launch file
├── include/my_package/     # C++ public headers (if library)
├── src/                    # C++ source files
├── my_package/             # Python modules (if ament_python or mixed)
├── test/                   # gtest, pytest, launch_testing
├── urdf/                   # URDF/xacro (if applicable)
├── msg/ srv/ action/       # custom interfaces (dedicated _interfaces package preferred)
└── README.md

Separate interface definitions into a *_interfaces package so downstream packages can depend on interfaces without pulling in implementation.

4. Parameter discipline

  • Declare every parameter with a type, description, range, and default in the node constructor — never use undeclared parameters.
  • Use ParameterDescriptor with FloatingPointRange or IntegerRange for numeric bounds. The parameter server rejects out-of-range values at set time.
  • Group related parameters under a namespace prefix: controller.kp, controller.ki, controller.kd.
  • Load defaults from a config/params.yaml; allow launch-time overrides.
  • For dynamic reconfiguration, register a set_parameters_callback and validate new values atomically before accepting.

5. Error handling philosophy

  • Nodes must not silently swallow errors. Log at the appropriate severity, then take a safe action (stop motion, request help, transition to error state).
  • Prefer lifecycle node error transitions over ad-hoc boolean flags.
  • When calling a service, always handle the "service not available" and "future timed out" cases explicitly.
  • For hardware drivers, distinguish transient errors (retry with backoff) from fatal errors (transition to FINALIZED and alert the operator).

6. Quality of Service defaults

Start from these profiles and adjust per use case:

Use caseReliabilityDurabilityHistoryDepthDeadlineLifespan
Sensor streamBEST_EFFORTVOLATILEKEEP_LAST5
Command velocityRELIABLEVOLATILEKEEP_LAST1100 ms200 ms
Map (latched)RELIABLETRANSIENT_LOCALKEEP_LAST1
DiagnosticsRELIABLEVOLATILEKEEP_LAST10
Parameter eventsRELIABLEVOLATILEKEEP_LAST1000
Action feedbackRELIABLEVOLATILEKEEP_LAST1
Safety heartbeatRELIABLEVOLATILEKEEP_LAST1500 ms1 s

QoS mismatches are the #1 cause of "I published but nobody receives." Always check compatibility with ros2 topic info -v when debugging.

DEADLINE and LIFESPAN are critical for safety-critical systems. DEADLINE fires an event when no message arrives within the specified period (detect stale data). LIFESPAN discards messages older than the specified duration before delivery (prevent acting on stale data). See references/communication.md section 9 for full API and examples.

7. Naming conventions

EntityConventionExample
Packagesnake_casearm_controller
Nodesnake_casejoint_state_broadcaster
Topic/snake_case with ns/arm/joint_states
Service/snake_case/arm/set_mode
Action/snake_case/arm/follow_joint_trajectory
Parametersnake_case with dot nscontroller.publish_rate
Framesnake_casebase_link, camera_optical
InterfacePascalCase.msg/srv/actionJointState.msg

8. Thread safety and callbacks

  • A MutuallyExclusiveCallbackGroup serializes its callbacks — safe for shared state without locks, but limits throughput.
  • A ReentrantCallbackGroup allows parallel execution — you must protect shared state with std::mutex (C++) or threading.Lock (Python).
  • Calling a service from a callback: The service client must be in a separate MutuallyExclusiveCallbackGroup from the calling callback. Otherwise the executor deadlocks — the callback waits for the response while the executor cannot deliver it. Always use async_send_request with a response callback; never use spin_until_future_complete inside an executor callback.
  • Never do blocking work (file I/O, long computation, sleep) inside a timer or subscription callback on the default executor. Offload to a dedicated thread or use a MultiThreadedExecutor with a reentrant group.
  • In rclcpp, prefer std::shared_ptr<const MessageT> in subscription callbacks to avoid unnecessary copies and enable zero-copy intra-process.

9. Lifecycle-first design

Default to lifecycle (managed) nodes for anything that owns resources: hardware drivers, sensor pipelines, planners, controllers.

                 ┌──────────────┐
  create() ──►  │  Unconfigured │
                 └──────┬───────┘
            on_configure │
                 ┌──────▼───────┐
                 │   Inactive    │
                 └──────┬───────┘
            on_activate  │
                 ┌──────▼───────┐
                 │    Active     │
                 └──────┬───────┘
           on_deactivate │
                 ┌──────▼───────┐
                 │   Inactive    │
                 └──────┬───────┘
            on_cleanup   │
                 ┌──────▼───────┐
                 │  Unconfigured │
                 └──────┬───────┘
           on_shutdown   │
                 ┌──────▼───────┐
                 │   Finalized   │
                 └───────────────┘

This gives the system manager (launch file, orchestrator, or operator) explicit control over when resources are allocated, when the node starts processing, and how it shuts down. It also makes error recovery predictable.

10. Build and CI hygiene

  • Use colcon build --cmake-args -DCMAKE_BUILD_TYPE=RelWithDebInfo for development; Release for deployment.
  • Enable -Wall -Wextra -Wpedantic and treat warnings as errors in CI.
  • Run colcon test with --event-handlers console_cohesion+ so test output groups by package.
  • Pin rosdep keys in rosdep.yaml for reproducible dependency resolution.
  • Cache /opt/ros/, .ccache/, and build//install/ in CI to cut build times by 60–80%.

Common anti-patterns

Anti-patternWhy it hurtsFix
Global variables for node stateBreaks composition, untestableStore state as class members
spin() in main() for multi-node processesStarves other nodesUse MultiThreadedExecutor or component composition
Hardcoded topic namesBreaks reuse across robotsUse relative names + namespace remapping
KEEP_ALL history with no boundMemory grows unbounded on slow subscribersUse KEEP_LAST with explicit depth
Using time.sleep() / std::this_thread::sleep_forBlocks the executor threadUse create_wall_timer or a dedicated thread
Monolithic launch file for everythingUnmanageable past 10 nodesCompose launch files with IncludeLaunchDescription
Skipping package.xml dependenciesBuilds locally, breaks CI and DockerDeclare every dependency explicitly
Publishing in constructorSubscribers may not be ready, messages lostPublish in on_activate or after a short timer
Ignoring QoS compatibilitySilent communication failureMatch publisher/subscriber QoS or check with ros2 topic info -v
Creating timers/subs in callbacksResource leak, unpredictable behaviorCreate all entities in constructor or on_configure
Synchronous service call in callbackDeadlocks the executor threadUse async_send_request with a callback or dedicated thread
Service client in same callback group as callerDeadlocks even with async in MultiThreadedExecutorPut service client in a separate MutuallyExclusiveCallbackGroup
No safe command on shutdownMotors hold last velocity after node exitsSend zero-velocity in on_deactivate AND destructor (see references/hardware-interface.md)
Dynamic subscriptions with StaticSingleThreadedExecutorNew subs are never picked up after spin()Use SingleThreadedExecutor or MultiThreadedExecutor for dynamic entities
CPU frequency governor left on powersave/ondemand10-100 ms latency spikes in RT pathSet performance governor, disable turbo boost (see references/realtime.md)

AI pitfalls — traps this skill has learned from

These are mistakes AI agents repeatedly make when generating ROS 2 code. Add a new line here every time a failure is discovered in practice.

#PitfallWhat goes wrongCorrect approach
1Using spin_until_future_complete inside a callbackDeadlocks the executor — the callback blocks waiting for a response that can never be deliveredUse async_send_request with a response callback; put the service client in a separate MutuallyExclusiveCallbackGroup
2Generating Foxy-era API for Jazzy/Kiltednode_executable is deprecated, export_state_interfaces() signature changed in ros2_control 4.xAlways check the distro feature matrix above before generating code
3Omitting QoS in publisher/subscriber creationDefaults silently mismatch — publisher sends but subscriber receives nothingAlways specify QoS explicitly; use the QoS defaults table in Principle 6
4Creating a msg/ directory inside a non-interfaces packageBuilds locally but fails in CI — interface packages need rosidl_generate_interfacesPut messages in a dedicated *_interfaces package
5Hardcoding /opt/ros/humble/ paths in launch filesBreaks on any other distro or install prefixUse FindPackageShare, PathJoinSubstitution, or environment substitutions
6Forgetting <depend> tags in package.xmlcolcon build works in overlay but rosdep install and Docker builds failDeclare every find_package() / import as <depend> in package.xml
7Using time.sleep() for rate control in rclpyBlocks the executor thread; timers and subscriptions stop firingUse create_timer() or Rate with a MultiThreadedExecutor
8Not sending zero-velocity on deactivate/shutdownRobot holds last commanded velocity when the node crashesSend zero-command in both on_deactivate and the destructor
9Mixing ament_target_dependencies() and target_link_libraries()Kilted deprecated ament_target_dependencies — mixing causes link errorsUse target_link_libraries() with modern CMake targets for Kilted+; ament_target_dependencies() for Humble/Jazzy
10Generating rospy / roscpp code instead of rclpy / rclcppROS 1 patterns in a ROS 2 context — nothing compilesThis skill is ROS 2 only — always use rclpy/rclcpp APIs
11Ignoring use_sim_time parameter in simulationReal clock diverges from Gazebo clock — tf lookups fail, controllers driftSet use_sim_time:=true in launch and pass --clock to ros2 bag play
12Publishing before subscribers connect (no TRANSIENT_LOCAL)First N messages lost — map, URDF, or initial config never receivedUse TRANSIENT_LOCAL durability for latched-style data, or publish in on_activate with a startup delay
Maintenance rule: When you encounter a new AI failure pattern while using this skill, append it to this table with the next sequential number. The pitfall list is the single most valuable section for preventing repeated mistakes.

Distro-specific migration notes

When upgrading between distributions, check these breaking changes first:

Foxy → Humble:

  • Complete API overhaul. Foxy packages require significant rework.
  • ros2_control was not bundled in Foxy — must be built separately.
  • Lifecycle node API stabilized in Humble.
  • Action server/client API changed significantly.

Humble → Jazzy:

  • ros2_control API changed from 2.x to 4.x — export_state_interfaces() and export_command_interfaces() are now auto-generated by the framework. Manual overrides use on_export_state_interfaces(). See references/hardware-interface.md.
  • Handle get_value() deprecated → use get_optional<T>() on LoanedStateInterface / LoanedCommandInterface (controller side). Hardware interfaces use set_state() / get_state() / set_command() / get_command() helpers with fully qualified names.
  • All joints in <ros2_control> tag must exist in the URDF.
  • Controller parameter loading changed — use --param-file with spawner.
  • Default bag format changed from sqlite3 to MCAP. Use storage_id='mcap'.
  • Default middleware changed internal config paths. Regenerate DDS profiles.
  • nav2_params.yaml schema changes — recoveries_server renamed to behavior_server.
  • ROS_AUTOMATIC_DISCOVERY_RANGE replaces ROS_LOCALHOST_ONLY (values: LOCALHOST, SUBNET, OFF, SYSTEM_DEFAULT).
  • launch_ros actions have new parameter handling — test launch files explicitly.

Jazzy → Kilted (non-LTS):

  • Zenoh promoted to Tier 1 middlewarermw_zenoh is production-ready. Install: sudo apt install ros-kilted-rmw-zenoh-cpp, set RMW_IMPLEMENTATION=rmw_zenoh_cpp. Supports router/peer/client modes.
  • EventsExecutor graduated from experimental — available in rclcpp::executors (no experimental namespace). Also ported to rclpy.
  • ament_target_dependencies() deprecated — use target_link_libraries() with modern CMake targets (e.g. rclcpp::rclcpp, std_msgs::std_msgs__rosidl_typesupport_cpp).
  • Multi-bag replay support in ros2 bag play.
  • Gazebo Ionic is the paired simulator (Harmonic was Jazzy; Ionic is the Kilted pairing).

ROS 1 → ROS 2:

  • See references/migration-ros1.md for a step-by-step strategy.

Quick reference — ros2 CLI

# Workspace
colcon build --symlink-install --packages-select my_pkg
colcon test --packages-select my_pkg
colcon graph --dot                       # dependency graph (DOT format)
source install/setup.bash

# Introspection
ros2 node list
ros2 topic list -t
ros2 topic info /topic_name -v          # shows QoS details
ros2 topic hz /topic_name
ros2 topic bw /topic_name
ros2 service list -t
ros2 action list -t
ros2 param list /node_name
ros2 param describe /node_name param
ros2 interface show std_msgs/msg/String

# ros2_control
ros2 control list_controllers
ros2 control list_hardware_interfaces
ros2 control list_hardware_components

# Debugging
ros2 doctor --report                    # alias: ros2 wtf
ros2 run tf2_tools view_frames
ros2 bag record -a -o my_bag
ros2 bag info my_bag
ros2 bag play my_bag --clock

# Lifecycle
ros2 lifecycle list /node_name
ros2 lifecycle set /node_name configure
ros2 lifecycle set /node_name activate

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

Codex

33.66%
按下载量换算22

Claude

30.36%
按下载量换算19

Cursor

19.45%
按下载量换算12

Gemini CLI

8.79%
按下载量换算6

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

需要联网

该 Skill 可能需要联网访问来源站点、仓库或外部 API;具体网络访问范围需要结合源码和 README 复核。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。当前只有一个来源,正式发布前建议补源仓库或其他目录站核验。

来源信息

继续浏览同类 Skills