Exporting Textured Models from Blender for Gazebo / ROS

PUBLISHED ON OCT 24, 2019

Exporting textured models from Blender and importing into Gazebo for use in ROS is something which seems like it should be very trivial but can end up being a bit of a headache. Here I talk a bit about how to deal with that.

Choose the right export file format

Gazebo can import a few different model formats, including .stl and .obj. However, you should always use .dae (Collada) for Gazebo. Collada has the best support for textures and materials.

For non-basic materials, use UV textures

For basic colors on objects, you can just use Blender's default materials settings. This information will properly show up in Gazebo. However, if you try to do anything remotely complex, it will not be rendered as expeced. So, instead we should bake the textures to a UV image after unwrapping (using Smart UV Project).

The material editor in Gazebo will add an extra material that you should delete!

You can create your .sdf files on your own that include your .dae file. But I can be a little lazy so I tend to test things out using Gazebo's model editor. One caveat is that using it will end up giving your object a gazebo Gray color. Open the generated .sdf file (usually located in ~/model_editor_models) and find the <material> section. Delete it! Then, reload Gazebo and your materials should come out nicely.

Happy Roboting!