Table of Contents

Setting our Executive

We will now create a package to hold our executive trigging the various arm motion controllers.

Creating the Package

First, you need to create an empty package called iai_seminar_manipulation_executive. Note: As we'll be using roscpp our new executive has to depend on roscpp. Don't forget to also add proper links to your documentation.

Setting up the ROS node

Before adding any functionality, you should set up an empty ROS node.

Note: Almost all information necessary to complete this step can be found here.

Adding a Launch-File

As a next step, add a launch-file to start our executive once in a launch sub-dir of the package. Please note that it is considered good-practice to provide users with launch-files for your nodes. This way, you can make sure that people know how to run your applications.

Moving the Arms (a first glance)

In this sub-task you will use existing ROS functionality to move both arms of our PR2. The interface used for this is action. Please re-visit the actionlib documentation and tutorials as actionlib is a very essential and powerful interface in ROS. Afterwards, have a look at the following tutorial – the solution to this sub-task looks similar to it.

Step-by-step instructions:

If everything compiles, you are ready to get your hands dirty:

$rostopic list
< some topics>
/my_node/arm_action/goal
/my_node/arm_action/feedback
/my_node/arm_action/status
/my_node/arm_action/cancel
< some other topics>
$

As a last step, update your launch-file for your users:

Hints: You can peek here to know how to use the controller, and this page shows how to remap topics in a launch-file.

Moving the Arms (revisited)

Now that we have the code to make one arm move, let's try to make it more convenient and reusable:

$ rosparam list | grep goal
<bla>
/your_executive/first_goal_configuration/execution_time
/your_executive/first_goal_configuration/joints
/your_executive/first_goal_configuration/positions
/your_executive/first_goal_configuration/velocities
<blub>
$ rosparam get /your_executive/first_goal_configuration/joints
[l_shoulder_pan_joint, l_shoulder_lift_joint, l_upper_arm_roll_joint, l_elbow_flex_joint, l_forearm_roll_joint, l_wrist_flex_joint, l_wrist_roll_joint]

Your next assignment is to load and use these parameters from the parameter server. We will do this in a new library package. This package will not contain any executable but just library code to be used by other packages.

NOTE: ROS libraries are a great thing that basically offer two advantages. (1) They help you re-use code in various of your ROS application. (2) If you provide some generic algorithm as library as a pure c/c++ library, you even allow non-ROS-users to use your algorithm in their work. This is hard to achieve but the ultimate design goal: A clean cut between functionality/algorithm and meta-OS, i.e. ROS.

Using parameters from the server instead of hard-coded values the way we just did has several tremendous advantages:

Moving the Arms (re-using code)

Finally, we will re-use our code to move both arms:

That's it. We have just completely re-used our code to control another arm! Imagine how much time you could save on a spider… ;)