gazebosim / gz-physics

Abstract physics interface designed to support simulation and rapid development of robot applications.
https://gazebosim.org
Apache License 2.0
65 stars 40 forks source link

bullet-featurestore: Enable auto deactivation #630

Closed iche033 closed 5 months ago

iche033 commented 5 months ago

🎉 New feature

Summary

bullet supports auto deactivation of bodies after certain period if there's no motion (velocity < some threshold). This feature should be enabled by default by bullet but it looks like we were overriding this by looping through all models and setting them to active after every step. I think this may have been done because free group / joint cmds were not working after objects were deactivated.

This PR removes that logic for activating all bodies after every step. Instead, an explicit call to wake up the bodies when setting free group / joint commands.

Test it

The effect is most obvious with mesh-to-mesh collisions which are less stable. When 2 meshes collide and come to a rest, they should now stop drifting.

I tested with the box meshes from https://github.com/gazebosim/gz-physics/pull/600 (under To Test section). Expand the Component Inspector to see more decimal points, let the 2 box meshes collide. After a couple of seconds, the box pose values should settle and stop updating. Before these changes, the pose values would continue to drift over time.

bullet_auto_disable

Checklist

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.

azeey commented 5 months ago

Do we need to do the same for applying external forces to links? You can test this with the "Mouse Drag" GUI plugin in gz-sim.

iche033 commented 5 months ago

Do we need to do the same for applying external forces to links? You can test this with the "Mouse Drag" GUI plugin in gz-sim.

oh yes, missed LinkFeatures. Added in 457578d.

codecov[bot] commented 5 months ago

Codecov Report

Attention: Patch coverage is 80.00000% with 2 lines in your changes are missing coverage. Please review.

Project coverage is 78.32%. Comparing base (92e02c3) to head (457578d). Report is 12 commits behind head on gz-physics7.

:exclamation: Current head 457578d differs from pull request most recent head d2e86b6. Consider uploading reports for the commit d2e86b6 to get more accurate results

Files Patch % Lines
bullet-featherstone/src/JointFeatures.cc 60.00% 2 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## gz-physics7 #630 +/- ## ============================================ Coverage 78.32% 78.32% ============================================ Files 140 140 Lines 8069 8079 +10 ============================================ + Hits 6320 6328 +8 - Misses 1749 1751 +2 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.