ros_control interface vs Node that publishes topics (ROS2)
Hello,
I don’t know if this is the right place to talk about this but I have some design questions. I have a sensor board with:
- IMU (to be used for robot localisation and also terrain feedback)
- temperature
- pressure
- humidity
- addressable RGB LED strip
- Two LED headlights (controlled independently)
- 8 Time of Flight sensors
The board is interfaced via CAN into a Raspberry Pi Compute Module 4. Currently I am writing the driver to get it into the ROS2 network. Two of this boards will be interfaces into the system.
The dilemma that I have is if I should integrate it via a ros_control Interface and then a controller/broadcaster to expose it to the other components in the robot, or if I should make just a Node that reads the data and publishes it into topics and exposes some of the services.
From the development perspective I feel that making the Node directly is very straight forward. While making the ros_control interface (albeit I am a noob at it and might be doing things wrong) is very complex due to all the things that it needs to interface and expose (turning LEDs on/off, sending RGB strip modes, among others).
We made a ros_control interface for the the drive system (via CAN) and it turned out really good and robust. But it feels that for a system as the sensor board, it will be unnecessary complex. For example the LED strip mode is an uint8_t but I need to declare it as double so that the hardware_interface::StateInterface is happy with it. Instead I could just read the CAN messages and publish them in my custom message.
What do you guys think? Is the trouble of making the ros_control interface and a broadcaster is worth it? Or should I just make a node?
(Opinion) From what I understand about ros_control, it's intended to be used to control something in a feed back loop, (ie PID controllers, MPC, etc) Drive systems are great to use ros_control with because you want a low-level feedback system to adjust motor setpoints in order to ensure that the robot is moving at the right velocity or moving to the right position.
Things like lights, don't need feedback loops to ensure that the light is on. (okay, I guess there could be situations were that'd be needed, but from what you've described, not for your application.) If I were in your position, I'd write a node that exposes those sensors as ros2 topics and services. Then other nodes can just subscribe to the data they need or call the services to set the lights. But that's just me.