[ros2_control] Is it bad practice to cascade controllers?
Would it be bad practice to cascade controllers using ros2_control?
For instance, if you had a legged robot, you may have a low level controller to command joint positions, and a higher level limb trajectory controller, and maybe an even higher level robot body controller.
+-----------------+ +-----------------+ +------------------+
| body controller | ----------->| limb controller | -----------> | joint controller |
+-----------------+ +-----------------+ +------------------+
Would it be reasonable to have each of these controllers as separate ros2_controller interfaces, publishing updates to each other?
Or would the additional publish-subscribe interfaces add to the control latency/jitter, and would it instead be preferable to write a single node that does all 3?
No, I wouldn't call that bad practice. But without a real-time / deterministic OS, together with an RT capable/compatible RMW and RT capable/compatible controllers, it's likely this setup will -- with the current state of
ros2_control
-- introduce jitter and delays.Ideally however, the setup you describe is how it all could be done. And IIRC, is also one of the goals of
ros2_control
. It's just that right now, the state of things like ROS 2's executors and a bunch of other parts of the infrastructure make this infeasible.