The Robotic Operating System is quite effective as a software framework for building robotic applications. It is like a glue that holds everything together. But there were a couple of areas where I got stuck and I thought I should write a post about it.
ros_control : Some of the naming of controllers and packages could have been a tad better. For example, a joint_state_controller is actually not a controller but just publishes the joint states. And it took a good amount of time for me to become familiar with forward_command_controller and hardware_interface.
Also joint_position_controller and joint_velocity_controller are basically not controllers into themselves but derived classes from forward_command_controller which do as the name suggests i.e. pass on the commands to the hardware_interface.
Also ros_control veers towards a linear Single Input-Single Output system based on the traditional PID law. Sophisticated control techniques that require control values to be calculated from all other inputs (Multiple In-Multiple Output) are sparsely documented in the ROS Wiki.
So when I set out to write a computed torque controller for my six dof arm, I felt myself nonplussed. Computed torque is a classical non-linear MIMO control technique. Individual joint torques are calculated based on an inverse dynamics model for achieving trajectory execution.
A caveat here. No textbook or course tells you about what hardware or motors you require for implementing a particular control method. I went through an entire course of robotics without realizing on which motor can certain control techniques be implemented. So when I got down to writing my controller, I grasped that you need motors which can apply a “given torque” when you command them. Neither Steppers nor Brushed DC can. Only Brushless DC can. And they cost a bomb.
Controller implementation follows here:
If you want to know more, shoot me a mail at firstname.lastname@example.org ! Would love to connect and learn from you!