PR2/Execution of Trajectories with MoveIt!

As far as the code in MoveIt! is concerned, executing trajectories for the PR2 is no different from executing trajectories for any other robot.
 * The Executing Trajectories with MoveIt! page provides explanations of how execution of trajectories works in general.
 * For the PR2 in particular, we provide a MoveIt! Controller Manager plugin that communicates with the pr2_controller_manager to provide the needed functionality. The plugin exists in the pr2_moveit_plugins package and is named pr2_moveit_controller_manager/Pr2MoveItControllerManager.

The PR2 MoveIt! Controller Manager plugin is a wrapper for the ROS API offered for the PR2 for switching controllers, listing, loading and activating controllers. In addition to using these services, the plugin is configured using the pr2_execution_controllers.yaml file from the pr2_moveit_config package. This yaml file contains a list of controllers under the namespace controller_list. For example:

The reason for this file existing is that the pr2 controller manager does not report controllers that could possibly be loaded -- only ones that are loaded (and those may be active or inactive). With this file, we can declare additional controllers. Each controller must specify a string name. It is expected that the controllers implement a JointTrajectoryAction interface under a specified namespace (which is usually follow_joint_trajectory). The only exception to this is made for grippers: the names l_gripper_controller and r_gripper_controller are hard-coded in the plugin and an interface to the Pr2GripperCommandAction is used.

Furthermore, and very importantly, each controller must report the joints it operates on, as shown in the example above. The default parameter is optional. If not specified, it is assumed to be false. This parameter is used to give priority to certain controllers over others when different ones could be used.