| name | concurrency-ros2 |
| description | ROS 2 (rclcpp/rclpy) concurrency guidance: executors, callback groups, services/actions/timers, and deadlock-safe patterns. Use when modifying ROS nodes or callbacks. |
| metadata | {"short-description":"ROS 2 concurrency patterns","requires":["references/concurrency-ros2.md"]} |
Purpose
Make ROS callbacks safe, non-blocking where needed, and deadlock-resistant.
When to use
Use this skill when touching:
- rclcpp/rclpy nodes or executors
- callback groups
- services, actions, or timers
How to use
- Open
references/concurrency-ros2.md.
- Choose executor strategy (SingleThreaded vs MultiThreaded) and justify.
- Choose callback group layout; explicitly separate blocking/synchronous paths.
- Identify synchronous service/client calls inside callbacks; apply deadlock rules.
- Move heavy work off callback threads when needed (worker thread / queue).
- Add observability hooks for callbacks and queues (length, latency).
- Define verification (stress + race tooling if multi-threaded).
Output expectation
- Add a ROS2 Concurrency Notes section to the Concurrency Plan.