Realtime control with ros_control vs a dedicated microcontroller
If you have a control application that needs realtime control (eg: two-wheel balancing robot), I can think of two ways you might do this:
- Implement the control system with ROS on ubuntu using ros_control. The joints have an effort interface, and accept pwm commands. (eg: Sending goal PWM for dynamixel motors).
- Have a dedicated microcontroller for executing the control loop. ROS can send high level commands, such as a desired velocity. (eg: OpenCR board used by turtlebot)
Are both these approaches equally valid, or is one preferred over the other?
I've been doing some reading on realtime control, and this mostly discusses: patching real-time support into ubuntu with rt preempt, using xenomai, using orocos and/or giving the control loop a dedicated core.
All these topics focus on supporting realtime control on a general purpose operating system like ubuntu, so I was wondering why I hadn't seen much of the other approach.
A follow on question is: why would you use "effort_controllers/joint_position_controller" from ros_control? As I understand, this uses a PID loop to set a joint position with a effort interface. When would you have this interface, instead of the joint accepting a position command and using PID itself?
Quick note:
the micro-controller will not allow you to reuse (fi) the
JointTrajectoryController
(nor any of the actual controllers inros_controllers
(ie: not forward-command controllers)) or community-contributed controllers.Whether that's a disadvantage will depend on the requirements and constraints you're working with/inside of.