How to generate a production-ready ROS2 node from a spec
언제 쓸까: You're about to write a new node and want clean lifecycle + tests from the start.
사전 조건
- Skill installed — git clone https://github.com/arpitg1304/robotics-agent-skills ~/.claude/skills/robotics-agent-skills
- ROS2 Humble+ on PATH — Follow docs.ros.org install
흐름
-
Describe the nodeCreate a ROS2 Humble node that subscribes to /scan (LaserScan), filters obstacles, and publishes /cmd_vel using a state machine.✓ 복사됨→ Node with clear class separation, lifecycle hooks, param declarations
-
Ask for testsWrite pytest unit tests for the filter logic and a launch_test for the integration.✓ 복사됨→ Tests runnable via colcon test
-
PackageProduce package.xml and CMakeLists.txt with correct dependencies.✓ 복사됨→ colcon build succeeds
결과: A ROS2 package that passes colcon build + test with meaningful coverage.
함정
- Claude mixes ROS1 and ROS2 APIs — State version explicitly in the prompt every time — 'ROS2 Humble'
- Node lacks shutdown handling — Ask for on_shutdown hooks and SIGTERM cleanup specifically