Writing a Custom ros2_control Controller: Lifecycle, Real-Time Rules and Design

How to design a custom ros2_control controller: declare interfaces, use the lifecycle correctly, keep update() real-time safe, limit commands and test against mock hardware.

In this article

  • What a controller actually is
  • The contract in five questions
  • The lifecycle, and where each job belongs
  • The update loop is a real-time function
  • A minimal skeleton
  • Design choices that separate a toy from a tool
  • What changes across releases
  • Do you even need a plugin?
  • Common mistakes
  • A checklist before you ship one