PluginBench
Rule

ros ros2

via PatrickJS/awesome-cursorrules

ROS/ROS2 package structure, node design, interfaces, timing, and testing best practices.

What is ros ros2?

Guides development of ROS and ROS2 packages, nodes, and inter-process communication. Use this rule when building robot software with launch files, messages, services, actions, and multi-node systems to ensure composability, proper frame handling, and repeatable testing.

  • Enforce package structure conventions: launch/, config/, msg/, srv/, action/ directories and consistent build files
  • Design small, composable nodes with explicit parameters and standard message types over custom interfaces
  • Apply timing best practices: ROS time for simulation, tf2 for frame transforms, non-blocking callbacks, and intentional QoS profiles
  • Validate commands for frame, units, and timestamp correctness before publishing
  • Establish multi-node integration tests using launch tests, bags, and recorded fixtures with failure case coverage
  • Prevent common mistakes: hardcoded paths, QoS mismatches, non-standard messages, and missing transform/sensor validation

Applies to

File patterns this rule matches.

["**/*.py"
**/*.cpp
**/*.hpp
**/*.h
package.xml
CMakeLists.txt
**/*.launch.py
**/*.msg
**/*.srv
**/*.action
**/*.urdf
"**/*.xacro"]
Rule definition (reference)

Source of truth, from the repository.

ROS and ROS2 Rules

Package Structure

  • Keep packages focused on one robot capability or integration boundary.
  • Use package.xml and CMakeLists.txt or setup.py consistently with the package type.
  • Keep launch files under launch/, configs under config/, messages under msg/, services under srv/, and actions under action/.
  • Use namespaces and remapping instead of hardcoded topic names when nodes may be reused.

Nodes and Interfaces

  • Keep nodes small and composable.
  • Use parameters for tunable behavior; declare ROS2 parameters explicitly.
  • Prefer messages for state streams, services for quick request/response operations, and actions for long-running goals with feedback.
  • Use standard message types before creating custom interfaces.
  • Document topic, service, action, frame, and parameter contracts.

Timing and Frames

  • Use ROS time when simulation or bag replay matters.
  • Use tf2 for frame transforms and document frame names.
  • Avoid blocking callbacks; move long work to timers, worker threads, or actions.
  • Set QoS profiles intentionally for sensor data, latched-like config, and reliable command paths.

Build and Test

  • Use colcon build and keep package dependencies explicit.
  • Run linters and formatters used by the workspace.
  • Add launch tests or integration tests for multi-node behavior.
  • Use simulation, bags, or recorded fixtures for repeatable sensor scenarios.
  • Test failure cases such as missing transforms, stale sensor data, and unavailable services.

Common Mistakes

  • Do not hardcode absolute paths; use package share directories.
  • Do not publish commands without validating frame, units, and timestamp assumptions.
  • Do not create custom messages when a standard message fits.
  • Do not ignore QoS mismatches between publishers and subscribers.

Related rules

Senior full-stack TypeScript, React, Node.js guidance with clean architecture, testing, and WHY-oriented reasoning.

**/*
41k
via PatrickJS/awesome-cursorrules

Quantitative factor research skills for designing, evaluating, and mining alpha factors in equities markets.

**/*
41k
via PatrickJS/awesome-cursorrules

Android development with Jetpack Compose, clean architecture, and Material Design 3.

**/*
41k
via PatrickJS/awesome-cursorrules

Angular development with Novo Elements UI library using standalone components.

**/*
41k
via PatrickJS/awesome-cursorrules

Expert Angular 18 + TypeScript development with Jest, emphasizing clean code and performance.

**/*
41k
via PatrickJS/awesome-cursorrules

Manage Kubernetes clusters, add-ons, stacks, and credentials via the Ankra CLI platform.

**/*.sh +5
41k
via PatrickJS/awesome-cursorrules