Understanding pr2_mechanism packages
The pr2_mechanism stack contain packages for writing ROS real-time controllers. The first package that we are going to discuss is the pr2_controller_interface package.
pr2_controller_interface package
A basic ROS real-time controller must inherit a base class called pr2_controller_interface::Controller from this package. This base class contains four important functions: init() , start(), update(), and stop(). The basic structure of the Controller class is given as follows:
namespace pr2_controller_interface
{
class Controller
{
public:
virtual bool init(pr2_mechanism_model::RobotState *robot,
ros::NodeHandle &n);
virtual void starting();
virtual void update();
virtual void stopping();
};
}The workflow of the controller class is shown as follows.

Figure 1: Workflow of the controller
Initialization of the controller
The first function executing when a controller is loaded is init(). The init() function will not...