-
Notifications
You must be signed in to change notification settings - Fork 41
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
Conversation
Signed-off-by: Ian Chen <[email protected]>
Signed-off-by: Ian Chen <[email protected]>
Signed-off-by: Ian Chen <[email protected]>
convertedVerts.reserve(static_cast<int>(vertexCount)); | ||
for (unsigned int i = 0; i < vertexCount; i++) | ||
bool meshCreated = false; | ||
if (meshSdf->Simplification() == "convex_decomposition") |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
replaced by #606 - > |
🎉 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:
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:
Checklist
codecheck
passed (See contributing)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.