| Note: This tutorial assumes that you have completed the previous tutorials: Writing a Stiffness Controller. |
Running the Controller
Description: Explains how to download the action server and controller and how to run a force controlled trajectory.Keywords: force, compliance, stiffness, controller, pr2 arms
Tutorial Level: INTERMEDIATE
Next Tutorial: Writing a Force Controller
Contents
If you have not already, you must first download the ee_cart_imped stack.
Updating the Controller and Action Files
Since the controller and action are not kept within the ROS stacks, you should update them manually to ensure you have the most recent version:
roscd ee_cart_imped_control svn update roscd ee_cart_imped_action svn update
Compiling
First, open a new shell and change to the directory you created in the last tutorial:
roscd ee_cart_imped_tutorial
When you created the package, the default CMakeLists.txt was created. Open it up and add the following line at the bottom
rosbuild_add_executable(stiffness_control src/stiffness_control.cpp)
Now rosmake the package
rosmake ee_cart_imped_tutorial
This should also compile the ee_cart_imped_control and ee_cart_imped_action packages.
Starting the Controller and Action Server
If you are working in simulation, open a new shell and run
roslaunch pr2_gazebo pr2_empty_world.launch
If you are working on the PR2, restart the robot using the -e option
sudo robot start -e
This option assumes the environment is set and therefore does not overwrite your environment. It is essential when using a non-standard controller. If you fail to start the robot with the -e option, ROS will be unable to find the controller type.
Once the simulator is up or the robot is restarted, in a new shell type
roslaunch ee_cart_imped_action r_arm_cart_imped_action.launch
This stops the usual controller for the right arm and starts the ee_cart_imped controller and action server for the right arm. To use the controller for the left arm, look at the ee_cart_imped_action/launch/l_arm_cart_imped.launch file. To launch the controller for both arms, you can use the ee_cart_imped_action/launch/ee_cart_imped_action.launch file.
The ee_cart_imped controller is now running in the right arm. At present, the controller is attempting to hold the end effector at a constant Cartesian point. If you are working with the PR2, you can test if the new controller is indeed controlling the right arm by manipulating the arm joints without moving the end effector. Unlike under the standard controller (which should still be running on the left arm for comparison), so long as the end effector does not move, there should not be much resistance to moving the other joints:
Running the Trajectory
Now you can try running the example we created. In a new shell type
rosrun ee_cart_imped_tutorial stiffness_control
You should see the trajectory execute.
If you are working on the PR2, the last point will be held. This means there will still be a light stiffness in the x direction. This should be very noticeable if you attempt to move the PR2 gripper. It will be easy to move it in the x direction (towards or away from the robot), but hard to move in any other direction or to turn.
Force Control
Now that we have written and run a stiffness controller, we can use the ee_cart_imped_control package to also run a force-controlled trajectory.






