Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support mesh optimization when using AttachMeshShapeFeature #2417

Merged
merged 3 commits into from
May 30, 2024

Conversation

iche033
Copy link
Contributor

@iche033 iche033 commented May 29, 2024

🎉 New feature

Summary

Add mesh optimization support in dartsim.

Dartsim uses AttachMeshShapeFeature for constructing meshes. It expects a common::Mesh to already be loaded and passed to it. So we need to optimize the mesh first in gz-sim (instead of doing mesh optimization inside gz-physics dartsim plugin). To support this, this PR adds logic to perform mesh optimization whenever a mesh is being loaded (e.g. via loadMesh here in physics system).

Test it

You can test with the cordless drill simplified mesh. Here's a cordless_drill.sdf test world

Launch gz-sim with the optimized mesh

gz sim -v 4 cordless_drill.sdf

and you should see a debug msg like this:

[Dbg] [Util.cc:918] Optimizing mesh (convex_decomposition): <home>/.gz/fuel/fuel.gazebosim.org/iche033/models/cordless drill simplified/3/meshes/cordless_drill.stl

Mesh collision visualization support is in #2352. I'll refactor that PR to use the new optimizeMesh function introduced here once this PR gets in.

Checklist

  • Signed all commits for DCO
  • Added tests
  • Added example and/or tutorial
  • Updated documentation (as needed)
  • Updated migration guide (as needed)
  • Consider updating Python bindings (if the library has them)
  • codecheck passed (See contributing)
  • All tests passed (See test coverage)
  • While waiting for a review on your PR, please help review another open pull request to support the maintainers

Note to maintainers: Remember to use Squash-Merge and edit the commit message to match the pull request summary while retaining Signed-off-by messages.

@iche033 iche033 requested a review from mjcarroll as a code owner May 29, 2024 08:37
@github-actions github-actions bot added the 🎵 harmonic Gazebo Harmonic label May 29, 2024
src/Util.cc Show resolved Hide resolved
src/Util.cc Show resolved Hide resolved
Signed-off-by: Ian Chen <[email protected]>
@iche033 iche033 requested a review from ahcorde May 29, 2024 11:53
@iche033 iche033 merged commit ae68e81 into gz-sim8 May 30, 2024
7 of 8 checks passed
@iche033 iche033 deleted the attach_mesh_optimize branch May 30, 2024 15:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🎵 harmonic Gazebo Harmonic
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

2 participants