Skip to content

Grasping with Jaco in Gazebo

Jennifer Buehler edited this page Jun 28, 2021 · 22 revisions

This is a simple example to grasp a cube at a predefined position, using the Jaco arm on the table which you can find in package jaco_on_table (part of repository jaco-arm-pkgs). There is alread a simple tutorial similar to this one which you may want to try first.

The cube is spawned at a fixed predefined position. Then, the arm moves to a pre-defined state to grasp the cube. There is no motion planner, so there will be no smooth trajectory execution, and it will only work for the exact cube pose used in this tutorial. The grasp tutorial with MoveIt! will use the MoveIt! motion planner.

It is recommended to use the Gazebo "grasp fix" plugin the first time you run this tutorial (the plugin is in package gazebo_grasp_plugin, which is part of repository gazebo-pkgs). You will have to use a command line argument in the instruction below to enable it. Then, you may try the tutorial again without the grasp fix, and see whether the cube slips off the robot hand, or if the robot displays strange behaviour when grasping.

Step 1. Start up Jaco arm

roslaunch grasp_execution_jaco_tutorial jaco_on_table_gazebo_objects_controlled.launch

Or, if you would like to load the arm using the Gazebo grasp plugin, use the additional argument:

roslaunch grasp_execution_jaco_tutorial jaco_on_table_gazebo_objects_controlled.launch load_grasp_fix:=true

Step 2. Spawn the cube and move the arm

The arm will move to the pre-defined state in two steps: First, it will move in pre-grasp state, then it will move to to the grasp state, but without doing the grasp yet. The two steps are required because there is no real motion planning, and not using the pre-grasp state would make it sweep the cube off the table.

roslaunch grasp_execution_jaco_tutorial spawn_and_reach_test_cube.launch

Or do both steps separately:

rosrun gazebo_test_tools cube_spawner cube1 0.2 0 0.76 robot_base
rosrun jaco_on_table set_arm_to_cube

Step 3. Grasp the cube

Now, you can grasp the cube. If you are using the Gazebo grasp plugin, a notice that the cube has been attached should be printed in the terminal where you launched Gazebo.

rosrun jaco_on_table grasp_cube

Alternatively, try the full action server command to grasp the cube. While the last command just closes the grippers, this generates a full Grasp.action request. This is also described on this wiki page.

roslaunch grasp_execution test_grasp.launch object_name:=cube1 robot_namespace:=jaco

Step 4. "Home" the arm

Move the arm to the default pose (or it could be any other pose) so that it lifts the cube:

rosrun jaco_on_table set_arm_to_cube --home --no-fingers

The last argument is required so the arm moves into the "Home" position but leaves the finger joints as they are now.

Step 5. [optional] Move the arm again

You can optionally re-place the object where the arm originally picked it up from. So the arm will need to move back into the initial grasp pose, except this time with the fingers still closed, as the object is only released/ungrasped in the next step.

If you are doing this the first time, it is recommended to skip this step to see how the cube is being dropped in the next step.

To move the arm back to the initial grasp pose:

rosrun jaco_on_table set_arm_to_cube --no-fingers

Step 6. Ungrasp the cube

Now, you may ungrasp the cube again and observe how it falls down.

rosrun jaco_on_table grasp_cube --ungrasp

If you are using the Gazebo grasp plugin, a notice should be printed that the object was detached.

Step 7 [optional]. Try it with MoveIt

You may now do the grasp tutorial with MoveIt! which essentially does the same, but using MoveIt! in order to include motion planning.