ros2_controller_creation

Scaffolds ros2_control controllers and broadcasters with lifecycle, interfaces, and pluginlib export.

Updated Aug 16, 2026
One-click install
npx skills add https://github.com/three1324/yeonjinautomotive --skill ros2-controller-creation-three1324
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: ros2_controller_creation
Source: https://github.com/three1324/yeonjinautomotive/tree/main/.claude/skills/ros2_controller_creation
Command: npx skills add https://github.com/three1324/yeonjinautomotive --skill ros2-controller-creation-three1324

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Writing a ros2_control controller from scratch involves many framework-specific decisions—choosing between ControllerInterface and ChainableControllerInterface, configuring command/state interfaces, keeping update() real-time safe, generating parameters, and exporting the pluginlib plugin—and mistakes in any of these cause runtime failures that are hard to diagnose. ## Core Features & Use Cases - Base-class selection guidance: Decision table mapping your goal (command writer, chainable controller, read-only broadcaster) to the correct base class and overrides. - Complete package skeleton: Header, interface configuration, lifecycle callbacks, RT-safe update(), generate_parameter_library YAML, pluginlib XML, CMakeLists.txt, and the PLUGINLIB_EXPORT_CLASS macro. - Testing and pitfalls: Mock-interface unit test strategy plus a checklist of common errors like non-RT-safe work in update() or claiming interfaces in on_configure. - Use Case: You need a custom velocity controller for a new actuator. Follow the skeleton to produce a compilable plugin package with generated parameters, correct interface claims, and a passing unit test. ## Quick Start Ask the AI to create a new ros2_control controller package for your joint using the ros2_controller_creation skill.

Frequently Asked Questions about ros2_controller_creation

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I create a custom ros2_control controller?

Create a pluginlib plugin class deriving from ControllerInterface, implement command_interface_configuration, state_interface_configuration, the lifecycle callbacks, and update(). Generate parameters with generate_parameter_library, export the plugin via pluginlib XML, and register it with controller_manager.

When should I use ChainableControllerInterface instead of ControllerInterface?

Use ChainableControllerInterface when other controllers must chain into yours or when it exposes a reference interface, overriding update_reference_from_subscribers() and update_and_write_commands(). Plain command-writing controllers only need ControllerInterface with update().

What makes ros2_control update() real-time safe?

The update() loop must avoid memory allocation, locks, exceptions, and unthrottled logging like RCLCPP_INFO every cycle. Publish through realtime_tools RealtimePublisher and preallocate messages in on_configure instead of the hot path.

How do I test a ros2_control controller without hardware?

Construct the controller directly in a unit test, assign mock loaned command and state interfaces, drive the lifecycle through configure and activate, call update(), and assert on command-interface values or published messages. Avoid using sleep() for synchronization.

Why does my controller fail when accessing interfaces in on_configure?

Loaned command and state interfaces are only valid from on_activate onward. Cache references into command_interfaces_ and state_interfaces_ inside on_activate, not during on_configure, to avoid undefined behavior.