After creating the controller launch files, we have to test it on PR2. We can launch the PR2 robot simulation using following command:
$roslaunch pr2_gazebo pr2_empty_world.launch
When we launch the PR2 simulation, all controllers associated with PR2 also get started. The purpose of our controller is to move the r_shoulder_pan_joint of PR2. If there are existing controllers handling this same joint, our controller can't work properly. To avoid this situation, we need to stop the controller that is handling the right arm of PR2. The following command tells you which are the controllers that are associated with PR2:
$ rosrun pr2_controller_manager pr2_controller_manager list
The output of this command is given as follows:
Stop the r_arm_controller using the following command:
$ rosrun pr2_controller_manager pr2_controller_manager stop
r_arm_controller
After stopping this controller, we can start our own controller using the following command:
$ roslaunch my_controller_pkg my_controller.launch
We can see the right arm of PR2 start moving, and a screenshot of the PR2 pose is given in the following: