ROS2 Style Guide

Use the declared ROS distribution, compiler and package build type. Preserve workspace and package layout; do not mix incompatible distributions.

  • Declare runtime, build and test dependencies in package.xml and CMakeLists.txt or the appropriate Python manifest.
  • Use ament conventions for package names, installation paths and test registration.
  • Keep nodes focused, use explicit parameters and meaningful topic/service names; select QoS according to the data contract.
  • Use ROS logging and handle lifecycle and shutdown cleanly.
  • Document hardware dependencies and keep configuration and launch files reproducible.

Build with colcon, execute colcon test and inspect colcon test-result. Validate node behavior with isolated fixtures or simulation. Never execute hardware motion or deploy as part of routine CI.