Tutorials/1.9/build robot/simple gripper


 * 1) Tutorial: Make a Simple Gripper#


 * Prerequisites:** Model Database

This tutorial describes how to make a simple two-bar pinching gripper.


 * 1) Setup your model directory

Reference Model Database documentation and SDF documentation for this tutorial.


 * 1) Make the model

1. Create a directory for the world file.

mkdir ~/simple_gripper_tutorial; cd ~/simple_gripper_tutorial

1. We will begin with a simple empty world. Create a world file: gedit ~/simple_gripper_tutorial/gripper.world

Copy the following SDF into `gripper.world`:  

model://ground_plane

model://sun

model://my_gripper

1. Create a model directory inside ~/.gazebo. This is where we'll put the model files:

mkdir -p ~/.gazebo/models/my_gripper cd ~/.gazebo/models/my_gripper

1. Let's layout the basic structure of our gripper. The easiest way to accomplish this is to make a `static` model and add in the links one at a time. A static model means the links will not move when the simulator starts. This will allow you to start the simulator, and visually inspect the link placement before adding joints.

1. Create a `model.config` file

gedit ~/.gazebo/models/my_gripper/model.config

1. Fill `model.config` with the following contents:



My Gripper 1.0          simple_gripper.sdf

My Name me@my.email

My awesome robot.

1. Make a new file for the model:

gedit ~/.gazebo/models/my_gripper/simple_gripper.sdf

1. Copy the following code in the `simple_gripper.sdf` file.

   -0.15 0.0 0.5 0 0 0                0 0 -0.5 0 0 0                     0.01                     0                     0                     0.01                     0                     0.01                 10.0                         0.2 0.2 1.0                         0.2 0.2 1.0                     Gazebo/Purple 0.0 0.0 0.05 0 0 0                    0.01                     0                     0                     0.01                     0                     0.01                 0.5                         0.1 0.2 0.1                         0.1 0.2 0.1                     Gazebo/Red  0.1 0.2 0.05 0 0 -0.78539                    0.01                     0                     0                     0.01                     0                     0.01                 0.1                         0.1 0.3 0.1                         0.1 0.3 0.1                     Gazebo/Blue  0.336 0.3 0.05 0 0 1.5707                    0.01                     0                     0                     0.01                     0                     0.01                 0.1                         0.1 0.2 0.1                         0.1 0.2 0.1                     gedit ~/.gazebo/models/my_gripper/simple_gripper.sdf Gazebo/Blue  0.1 -0.2 0.05 0 0 .78539                    0.01                     0                     0                     0.01                     0                     0.01                 0.1                         0.1 0.3 0.1                         0.1 0.3 0.1                     Gazebo/Green  0.336 -0.3 0.05 0 0 1.5707                    0.01                     0                     0                     0.01                     0                     0.01                 0.1                         0.1 0.2 0.1                         0.1 0.2 0.1                     Gazebo/Green true

1. Run the world file to visualize what we have created up to this point. gazebo ~/simple_gripper_tutorial/gripper.world You should see something like this:



1. Once we are happy with the layout of the links, we can add in the joints, by copying the following code into the `simple_gripper.sdf` file before the ` ` line. gedit ~/.gazebo/models/my_gripper/simple_gripper.sdf

 0 -0.15 0 0 0 0            left_finger palm -0.4                    0.4                 0 0 1          0 0.1 0 0 0 0            left_finger_tip left_finger -0.4                    0.4                 0 0 1          0 0.15 0 0 0 0            right_finger palm -0.4                    0.4                 0 0 1          0 0.1 0 0 0 0            right_finger_tip right_finger -0.4                    0.4                 0 0 1          palm riser 0                    0.9                 0 0 1 And make the model non-static:

...       false ...

1. Start Gazebo again:

gazebo ~/simple_gripper_tutorial/gripper.world

The model should look similar to:



1. Right-click on the model and select "View->Joints". The newly created joints will be displayed:



1. You can also control the forces on each joint using the Joint Control widget. Click on the gripper model. Then expand this widget by clicking on the vertical handle on the right side of the GUI and dragging it to the left. The widget displays a list of sliders, one for each joint. Select the Force tab and use the sliders to apply forces to each joint, and you should see the gripper move. E.g., set the force on `palm_riser` to 10 (Newtons), and you should see something like:



1. Optional:

1. Add a small box or cylinder to the world, and position it in the gripper. 1. Try to use the joint control GUI interface to pick up the object.

Tip: You may need to adjust reasonable inertia to the object.


 * 1) Next

Next: Attach Gripper to Robot