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

bullet-featherstone: Support convex decomposition for meshes #603

Closed
wants to merge 3 commits into from

Conversation

iche033
Copy link
Contributor

@iche033 iche033 commented Mar 13, 2024

🎉 New feature

Depends on

Summary

Supports convex decomposition on meshes. Bullet-featherstone implementation will parse the new mesh simplification attribute introduced in gazebosim/sdformat#1380, decompses the mesh into convex meshes, and builds btConvexHullShape collision shapes.

Compared to btGImpactMeshes (which is currently used for all meshes), the convex hulls seems to be more stable, do not have gaps between meshes (collision margins can be set to 1mm instead of 1cm), and some manual testing shows potentially faster performance (dependent on the number of submeshes generated)

Added test to verify that convex decomposition flag is parsed and valid collisions are generated.

Other changes:

  • the m_erp2 value is now only set when there are meshes in the scene. The param was reduced to improve stability in bullet-featherstone: Improve mesh collision stability #600. I think we do not need to do it globally when there are no meshes in the world as the instability seems to only come from meshes. The value is also bumped up a little to prevent to much penetration - This will likely need more tuning.

To Test

Together with gazebosim/gz-sim#2331, you can visualize the decomposed collision meshes.

Run gz sim with bullet-featherstone plugin and a world that has a model (e.g. Cordless Drill Simplified) that uses mesh decomposition:

gz sim -v 4 your_test_world.sdf --physics-engine gz-physics-bullet-featherstone-plugin

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.

Signed-off-by: Ian Chen <ichen@openrobotics.org>
Signed-off-by: Ian Chen <ichen@openrobotics.org>
Signed-off-by: Ian Chen <ichen@openrobotics.org>
@github-actions github-actions bot added the 🎵 harmonic Gazebo Harmonic label Mar 13, 2024
@iche033 iche033 added the needs upstream release Blocked by a release of an upstream library label Mar 13, 2024
convertedVerts.reserve(static_cast<int>(vertexCount));
for (unsigned int i = 0; i < vertexCount; i++)
bool meshCreated = false;
if (meshSdf->Simplification() == "convex_decomposition")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

would it be possible to also handle the convex_hull case in this pull request? I would think that would be simpler than the convex_decomposition case, but would still be useful in cases where users know that a mesh is already convex

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yep I was going to add it as a followup PR but I'll bundle it together.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

addressed in new PR #606 that targets main. Supported by telling MeshManager to generate 1 convex hull.

Alternative is to feed all vertices to btConvexHullShape and let bullet do the convex hull generation (intead of MeshManager) but that mean it'll be difficult for gz-sim visualize the generated collision. So I opted to let MeshManager create the convex hull instead so we can use the same function in the gui plugin to generate the collision visuals

@iche033
Copy link
Contributor Author

iche033 commented Mar 14, 2024

replaced by #606 - > main

@iche033 iche033 closed this Mar 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🎵 harmonic Gazebo Harmonic needs upstream release Blocked by a release of an upstream library
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

2 participants