-
Notifications
You must be signed in to change notification settings - Fork 767
Working With Meshes in Gazebo
This tutorial describes how to convert point cloud files to meshes that can be loaded in the Gazebo robot simulator for ROS using MeshLab. It is intended for first time-users of mesh processing software.
You will need to download MeshLab for your operating system. At the time of writing, the most recent stable version is v1.3.3. This version has some known bugs - for example, there is a crashing issue with the 'Selection' tool for Intel graphics cards. If v1.3.3 is too buggy on your platform, you might consider downloading the v1.3.4 BETA or trying another operating system. Generally, MeshLab is an open-source software prone to unexpected crashes, so remember to save your work regularly.
- Open MeshLab. Go to 'File → Import Mesh...' and navigate to the point cloud file that you wish to convert. This tutorial uses an example of a maize field, maize.ply.
- Go to 'Filters → Point Sets → Compute Normals for Point Sets', then press 'Apply'. If you go to 'Render → Show Normal/Curvature', you should now see normals emanating from the points in the cloud.
- Go to 'Filters → Remeshing → Poisson Surface Reconstruction', then press 'Apply' to create the mesh. Increasing the 'Octree depth' parameter will produce meshes of finer resolution, but require longer processing time (approx. twice the rendering time for every step increment). A value of 10 is used in the example of this tutorial.
Tip: Press CTRL+L to navigate between the different layers in the project.
- Go to 'Filters → Sampling → Vertex Attribute Transfer'. Make sure the 'Transfer Color' option is checked and press 'Apply' to transfer the colour of the points onto the mesh.
-
Go to 'Filters → Texture → Parametrization: Trivial Per-Triangle'. Press 'Apply' to generate the faces from which the mesh texture will be created. If you receive an error about the inter-triangle border being too much, try increasing the texture dimension.
-
Go to 'Filters → Texture → Vertex Color to Texture'. Specify the texture file name and resolution for the mesh, then press 'Apply' to create it. The texture in the example is called maize.png.
- [Optional] You can highlight and delete unnecessary vertices/faces of the mesh using 'Filters → Selection'. This will allow the file to load faster in Gazebo.
- [Optional] You can apply rigid-body transformations to the mesh using the 'Filters → Normals, Curvatures, and Orientation → Transform' options.
Tip 1: You can go to 'Renders → Show Axis' to show the position of the mesh in the co-ordinate frame used for the transformations.
Tip 2: The 'Measuring Tool' is useful to compute the distance between points on the mesh. This option is located on the toolbar of the main MeshLab screen.
Tip 3: If your mesh is rotated wrongly, the option 'Rotate to a fit to a plane' is useful to align it to a selected pair of axes.
- Go to 'File → Export Mesh As...' to save the mesh and the texture. For Gazebo, select '.dae' Collada file format. Make sure all the checkboxes are ticked when saving the file, and that the texture file name on the right is correct.
- Follow the Gazebo tutorial to import the mesh into the simulator.