Tutorials/beginner/mesh import

This tutorial describes how to import 3D meshes into Gazebo.


 * 1) Prepare the Mesh

Gazebo uses a right-hand coordinate system where +Z is up (vertical), +X is forward (into the screen), and +Y is to the left.


 * Reduce Complexity**

Many meshes can be overly complex. A mesh with many thousands of triangles should be reduced or split into separate meshes for efficiency. Look at the documentation of your 3D mesh editor for information about reducing triangle count or splitting up a mesh.


 * Center the mesh**

The first step is to center the mesh at (0,0,0) and orient the front (which can be subjective) along the x-axis.


 * Scale the mesh**

Gazebo uses the metric system. Many meshes (especially those from 3D warehouse), use English units. Use your favorite 3D editor to scale the mesh to a metric size.


 * 1) Export the Mesh ###

Once the mesh has been properly prepared, export it as a Collada file. This format will contain all the 3D information and the materials.


 * 1) Tell Gazebo about the Mesh ###

Gazebo will automatically find meshes with its search path. The search path is an environment variable called GAZEBO_RESOURCE_PATH. Use the following command to get the current value of GAZEBO_RESOURCE_PATH

printenv | grep GAZEBO_RESOURCE_PATH

Mesh files are located within a subdirectory called `Media/models`. Place your collada mesh file in the `Media/models` subdirectory of one of the paths specified by the GAZEBO_RESOURCE_PATH environment variable.


 * 1) Test the Mesh ###

The easiest way to test a mesh is to create a simple world file that loads the mesh. Copy the following code into a world file, and replace `name_of_my_mesh.dae` with the actual filename of the mesh.

   

 

Then just launch Gazebo

gazebo world_file_i_just_created.world