Skip to content

Automated Mesh Generation Toolchain & New SDF Worlds#24

Closed
thippeswammy wants to merge 22 commits intonaturerobots:mainfrom
thippeswammy:main
Closed

Automated Mesh Generation Toolchain & New SDF Worlds#24
thippeswammy wants to merge 22 commits intonaturerobots:mainfrom
thippeswammy:main

Conversation

@thippeswammy
Copy link

Summary

This PR introduces a comprehensive toolchain to automate the generation of navigation meshes from Gazebo SDF world files. It streamlines the workflow for creating complex terrains for mesh_navigation, allowing for direct conversion of SDF geometries (including primitives and includes) into high-quality PLY and H5 map files.

Key Changes

1. New Tool: generate_mesh_env.py

A new Python script located in mesh_navigation_tutorials/launch/ that handles the entire pipeline:

  • SDF Parsing: Recursively parses SDF files, including nested <include> models and geometric primitives (Box, Cylinder, Sphere, Plane, Polyline).
  • Mesh Generation: Converts primitives to high-resolution meshes and extracts existing meshes.
  • Optimization: Includes a --single-layer flag that optimizes meshes for navigation by:
    • Aligning and flattening ground surfaces.
    • Filtering steep faces (navigable surfaces).
    • Iteratively cleaning mesh topology (removing duplicates, degenerate faces).
  • Attribute Injection: Automatically injects vertex/face attributes (roughness, quality) into the final .h5 files using lvr2 tools if available.
  • Validation: Includes methods to compare generated meshes against reference files.

2. World Files

  • New SDFs: Added uneven_terrain.sdf and uneven_terrain_big.sdf to test and run the pipeline.

3. Documentation

  • Updated README.md with instructions on how to use the generation script.

How to Test

Once you have cloned the repository, you can directly build and launch the simulation.

1. Build the Workspace

Rebuild the packages to ensure the new maps and models are installed correctly.

colcon build --packages-select mesh_navigation_tutorials_sim mesh_navigation_tutorials --allow-overriding mesh_navigation_tutorials mesh_navigation_tutorials_sim

2. Launch the Simulation

Launch the tutorial to see the result.

ros2 launch mesh_navigation_tutorials mesh_navigation_tutorials_launch.py world_name:=uneven_terrain_big

Note: Initializing the mesh environment in the simulation might take a few seconds. If the robot spawns in the air or the map isn't visible immediately, wait for ~10 seconds for the systems to synchronize and the mesh to load.

Optional: Test Mesh Generation Tool

If you want to regenerate the mesh or test the tool manually:

python3 src/mesh_navigation_tutorials/mesh_navigation_tutorials/launch/generate_mesh_env.py src/mesh_navigation_tutorials/mesh_navigation_tutorials_sim/worlds/uneven_terrain.sdf --single-layer

… path, need to fix the gap, addin all the cmd and files required for running.
…cript

- Added `--single-layer` flag to automatically configure density, flattening, and filtering for high-quality navigation meshes.
- Implemented `clean_mesh_iterative` for robust topological repair (removing duplicates, degenerate faces, and non-manifold edges).
- Added `--exclude` argument to filter out specific models (e.g., ceilings) by name.
- Added `Stopwatch` class for precise timing of generation stages.
- Improved memory management with explicit garbage collection and smart subdivision limits to prevent OOM errors.
- Enhanced `find_lvr2_tool` to search more common workspace paths.
- Exposed new parameters as ROS 2 launch arguments.
…h files, and refactor the mesh generation script for handeling the polyline geometry type.
@amock
Copy link
Collaborator

amock commented Jan 21, 2026

Hi @thippeswammy ,

Am I correct to assume your PR #25 is replacing this one?

@thippeswammy
Copy link
Author

Hi @amock,

Yes, that’s correct 👍
PR #25 is the cleaned-up and final version of this work.

PR #24 can be considered superseded, and I’m happy to close it to avoid confusion.
Thank you for checking!

@amock
Copy link
Collaborator

amock commented Jan 21, 2026

Alright, thanks for the clarification! Then I will go to the other PR now

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants