Build a Robot

From Lofaro Lab Wiki
Revision as of 22:02, 3 November 2014 by Nhkim (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Make a model

This tutorial is based off of the tutorial from this page. SDF models can be something as basic as simple shapes or as complex as intricate robots.

Components of SDF Models --Links, Collision, Visual, Inertial, Sensor, Joints, Plugins

Building a Model

1) Collect your meshes Simple shapes are provided in Gazebo (box, sphere, cylinder). Meshes are most commonly used to make your model look realistic. You can look for meshes in Google's 3D warehouse. Or you can create your own meshes using Blender / Sketchup. STL/Collada format is required for mesh files.

2) Make your model SDF file Start with something simple so that if you need to debug, it will be easier than debugging a model you are not familiar with.

First create the model file

   gedit box.sdf

Copy the contents below into box.sdf

   <?xml version='1.0'?>
<sdf version="1.4">
<model name="my_model">
  <pose>0 0 0.5 0 0 0</pose>
  <static>true</static>
    <link name="link">
      <inertial>
        <mass>1.0</mass>
        <inertia> <!-- interias are tricky to compute -->
          <!-- http://answers.gazebosim.org/question/4372/the-inertia-matrix-explained/ -->
          <ixx>0.083</ixx>       <!-- for a box: ixx = 0.083 * mass * (y*y + z*z) -->
          <ixy>0.0</ixy>         <!-- for a box: ixy = 0 -->
          <ixz>0.0</ixz>         <!-- for a box: ixz = 0 -->
          <iyy>0.083</iyy>       <!-- for a box: iyy = 0.083 * mass * (x*x + z*z) -->
          <iyz>0.0</iyz>         <!-- for a box: iyz = 0 -->
          <izz>0.083</izz>       <!-- for a box: izz = 0.083 * mass * (x*x + y*y) -->
        </inertia>
      </inertial>
      <collision name="collision">
        <geometry>
          <box>
            <size>1 1 1</size>
          </box>
        </geometry>
      </collision>
      <visual name="visual">
        <geometry>
          <box>
            <size>1 1 1</size>
          </box>
        </geometry>
      </visual>
    </link>
  </model>
</sdf

3) Add to model SDF file After each addition, load the model to make sure it is displayed correctly. In what order to add features (suggested, from gazebosim.org tutorials): 1.Add a link. 2.Set the collision element. 3.Set the visual element. 4.Set the inertial properties. 5.Go to #1 until all links have been added. 6.Add all joints (if any). 7.Add all plugins (if any)