Tutorials/1.3/build robot/add laser


 * 1) Tutorial: Add a Sensor to a Robot#


 * Prerequisites:** Attach a Mesh as Visual

This tutorials demonstrates how the user can create composite models directly from other models in the Gazebo Model Database by using the ` ` tags and ` ` to connect different components of a composite model.


 * 1) Adding a Laser

Adding a laser to a robot, or any model, is simply a matter of including the sensor in the model.

1. Go into your model directory from the previous tutorial:

cd ~/.gazebo/models/my_robot

1. Open `model.sdf` in your favorite editor. 1. Add the following lines directly before the ` ` tag near the end of the file.

model://hokuyo 0.2 0 0.2 0 0 0     hokuyo::link chassis 0 0 1          0           0

The ` ` block tells Gazebo to find a model, and insert it at a given ` ` relative to the parent model. In this case we place the hokuyo laser forward and above the robot. The ` ` block tells gazebo where to find the model inside its model database (note, you can see a listing of the model database uri used by these tutorials at here, and the corresponding mercurial repository).

The new ` ` connects the inserted hokuyo laser onto the chassis of the robot. The joint has and ` ` and ` ` limit of zero to prevent it from moving.

The ` ` name in the joint is derived from the hokuyo model's SDF, which begins with:

  

When the hokuyo model is inserted, the hokuyo's links are namespaced with their model name. In this case the model name is `hokuyo`, so each link in the hokuyo model is prefaced with `hokuyo::`.

1. Now start gazebo, and add the robot to the simulation using the Insert tab on the GUI. You should see the robot with a laser attached.



1. (Optional)  Try adding a camera to the robot. The camera's model URI is `model://camera`, it should have been locally caches for you in:

ls ~/.gazebo/models/camera/

For reference, the Gazebo SDF 1.3 documentation can be found here, click on "all" to expand all items.


 * 1) Next

Next: Make a Simple Gripper