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

Add bullet-featherstone plugin #373

Merged
merged 50 commits into from
Oct 15, 2022
Merged

Conversation

mxgrey
Copy link
Contributor

@mxgrey mxgrey commented Jun 30, 2022

🎉 New feature

Summary

This PR adds a gz-physics-bullet-featherstone-plugin which wraps the Featherstone API of the bullet physics engine. This is created as a separate plugin from gz-physics-bullet-plugin because the API of Bullet's Featherstone dynamics is different enough that there isn't really feature parity or easy interchangeability between them. Users will need to choose whether they are willing to settle for fewer features in exchange for the better performance of Bullet's Featherstone implementation.

This PR depends on gazebosim/gz-sim#1560

Test it

I have been testing the plugin using the NAO demo world. Just download, unzip, and run

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

However, I have been noticing an inexplicable bug... The bullet-featherstone plugin works perfectly fine when gz-physics is compiled in Debug mode, but fails to respond to changing joint force commands when gz-physics is compiled in Release or RelWithDebInfo mode. I don't have an explanation for this at the moment. I've tried compiling bullet from source in both single and double precision mode, but the effect is the same either way.

The strangest part is that the initial joint force commands seem to be respected because the arms manage to remain pointing straight outward. Also if you adjust the position slider before starting the simulation, then the joint will manage to reach that position, but it stops responding to any changes after the simulation begins.

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.

chapulina and others added 9 commits June 7, 2022 18:44
Signed-off-by: Louise Poubel <louise@openrobotics.org>
Signed-off-by: Louise Poubel <louise@openrobotics.org>
Signed-off-by: Michael X. Grey <grey@openrobotics.org>
Signed-off-by: Michael X. Grey <grey@openrobotics.org>
Signed-off-by: Michael X. Grey <grey@openrobotics.org>
Signed-off-by: Michael X. Grey <grey@openrobotics.org>
Signed-off-by: Michael X. Grey <grey@openrobotics.org>
Signed-off-by: Michael X. Grey <grey@openrobotics.org>
@mxgrey mxgrey requested review from azeey and scpeters as code owners June 30, 2022 10:30
@github-actions github-actions bot added the 🌱 garden Ignition Garden label Jun 30, 2022
@mjcarroll mjcarroll requested a review from ahcorde June 30, 2022 12:11
@mjcarroll
Copy link
Contributor

However, I have been noticing an inexplicable bug... The bullet-featherstone plugin works perfectly fine when gz-physics is compiled in Debug mode, but fails to respond to changing joint force commands when gz-physics is compiled in Release or RelWithDebInfo mode. I don't have an explanation for this at the moment. I've tried compiling bullet from source in both single and double precision mode, but the effect is the same either way.

That's an exciting failure mode...

mxgrey and others added 2 commits July 1, 2022 00:48
Signed-off-by: Michael X. Grey <grey@openrobotics.org>
@ahcorde
Copy link
Contributor

ahcorde commented Jun 30, 2022

I compiled the code in Debug mode, but arms are crazy. is this expected ?

nao.mp4

@codecov
Copy link

codecov bot commented Jul 6, 2022

Codecov Report

Merging #373 (d7fd295) into gz-physics6 (09b3e44) will increase coverage by 1.66%.
The diff coverage is 65.83%.

@@               Coverage Diff               @@
##           gz-physics6     #373      +/-   ##
===============================================
+ Coverage        73.69%   75.36%   +1.66%     
===============================================
  Files              128      140      +12     
  Lines             5787     7068    +1281     
===============================================
+ Hits              4265     5327    +1062     
- Misses            1522     1741     +219     
Impacted Files Coverage Δ
bullet-featherstone/src/FreeGroupFeatures.cc 0.00% <0.00%> (ø)
bullet/src/SDFFeatures.cc 51.03% <0.00%> (+51.03%) ⬆️
dartsim/src/SDFFeatures.cc 61.47% <0.00%> (-1.09%) ⬇️
sdf/include/gz/physics/sdf/ConstructCollision.hh 100.00% <ø> (ø)
tpe/plugin/src/SDFFeatures.cc 78.85% <0.00%> (-5.81%) ⬇️
...ullet-featherstone/src/EntityManagementFeatures.cc 30.92% <30.92%> (ø)
bullet-featherstone/src/JointFeatures.cc 43.20% <43.20%> (ø)
bullet-featherstone/src/LinkFeatures.cc 66.66% <66.66%> (ø)
bullet-featherstone/src/SDFFeatures.cc 70.94% <70.94%> (ø)
bullet-featherstone/src/KinematicsFeatures.cc 83.33% <83.33%> (ø)
... and 12 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@mjcarroll mjcarroll changed the base branch from main to gz-physics6 September 8, 2022 20:42
Signed-off-by: Michael Carroll <michael@openrobotics.org>
ahcorde and others added 8 commits September 16, 2022 12:55
* Added Shapes Features to bullet-featherstone
* make linters happy
* Improve implementation
* make linters happy
* Fix bullet-featherstone collisions (#387)
* Fixed collision issues
* Improved joints in bullet featherstone

Signed-off-by: ahcorde <ahcorde@gmail.com>
Signed-off-by: Michael X. Grey <grey@openrobotics.org>
Signed-off-by: Michael Carroll <michael@openrobotics.org>
Co-authored-by: Michael X. Grey <grey@openrobotics.org>
Co-authored-by: Michael Carroll <michael@openrobotics.org>
* Improved joints in bullet featherstone (#404)
* Fixed ExamplesBuild
* Fixed world test
* Fixed joint test
* Fixed kinematic features common test
* Fixed kinematic test

Signed-off-by: ahcorde <ahcorde@gmail.com>
Signed-off-by: ahcorde <ahcorde@gmail.com>
Signed-off-by: Michael Carroll <michael@openrobotics.org>
Co-authored-by: ahcorde <ahcorde@gmail.com>
* Fixed bullet-featherstone mesh collisions

Signed-off-by: ahcorde <ahcorde@gmail.com>
Signed-off-by: ahcorde <ahcorde@gmail.com>
* Bullet-featherstone Added detachable joints
* decrease expectation joint_features attach/detacth

Signed-off-by: ahcorde <ahcorde@gmail.com>
ahcorde and others added 7 commits October 6, 2022 16:23
Signed-off-by: ahcorde <ahcorde@gmail.com>
Bullet featherstone: Added contacts and improved simulation tests

Signed-off-by: ahcorde <ahcorde@gmail.com>
* Added FreeGroupWorld Velocities and minor fixes
* If there is no CMD commands then I don't attach the motor to move the joint, because this will block the joint.

Signed-off-by: ahcorde <ahcorde@gmail.com>
Co-authored-by: Michael Carroll <michael@openrobotics.org>
* Add infrastructure for LinkFeatures
* fix some issues
* Added test
* Fix joint attach test and tighten test constraints
* Initialize to something to suppress compiler

Signed-off-by: Michael Carroll <michael@openrobotics.org>
Signed-off-by: ahcorde <ahcorde@gmail.com>
Co-authored-by: ahcorde <ahcorde@gmail.com>
* Add some debug output for focal
* Comment out flaky test

Signed-off-by: Michael Carroll <michael@openrobotics.org>
@mjcarroll mjcarroll requested a review from ahcorde October 14, 2022 21:55
@mjcarroll mjcarroll merged commit cd40651 into gz-physics6 Oct 15, 2022
@mjcarroll mjcarroll deleted the add-bullet-featherstone branch October 15, 2022 12:00
@@ -34,13 +36,18 @@ class ConstructSdfCollision : public virtual Feature
public: using ShapePtrType = ShapePtr<PolicyT, FeaturesT>;

public: ShapePtrType ConstructCollision(const ::sdf::Collision &_collision);

public: ShapePtrType GetCollision(const std::string &_collisionName);
Copy link
Member

Choose a reason for hiding this comment

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

why was this API added instead of using GetShapeFromLink::GetShape?

@ahcorde ahcorde mentioned this pull request Nov 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bullet Bullet engine enhancement New feature or request
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

7 participants