Skip to content

Enable/disable: gravity and static#764

Open
ahcorde wants to merge 17 commits intogz-physics7from
ahcorde/7/gravity_static
Open

Enable/disable: gravity and static#764
ahcorde wants to merge 17 commits intogz-physics7from
ahcorde/7/gravity_static

Conversation

@ahcorde
Copy link
Contributor

@ahcorde ahcorde commented Jul 29, 2025

🎉 New feature

Summary

Allow to enable/disable gravity and static state

Test it

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
  • Was GenAI used to generate this PR? If so, make sure to add "Generated-by" to your commits. (See this policy for more info.)

Generated-by: Remove this if GenAI was not used.

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

ahcorde added 2 commits July 27, 2025 19:47
Signed-off-by: Alejandro Hernandez Cordero <ahcorde@gmail.com>
Signed-off-by: Alejandro Hernandez Cordero <ahcorde@gmail.com>
Signed-off-by: Alejandro Hernandez Cordero <ahcorde@gmail.com>
@azeey azeey mentioned this pull request Aug 7, 2025
Signed-off-by: Alejandro Hernandez Cordero <ahcorde@gmail.com>
Signed-off-by: Alejandro Hernandez Cordero <ahcorde@gmail.com>
@ahcorde ahcorde requested a review from caguero November 25, 2025 10:08
@ahcorde
Copy link
Contributor Author

ahcorde commented Nov 25, 2025

@scpeters and/or @azeey do you have some time to review this one ?

@azeey
Copy link
Contributor

azeey commented Nov 25, 2025

gazebosim/gz-sim#3189 added the ability to change gravity at runtime. Is it still necessary to add aa feature to enable/disable gravity? What's the expected behavior when gravity is disabled, but then it's changed to be a non-zero value with the API in gazebosim/gz-sim#3189?

@ahcorde
Copy link
Contributor Author

ahcorde commented Feb 24, 2026

gazebosim/gz-sim#3189 added the ability to change gravity at runtime. Is it still necessary to add aa feature to enable/disable gravity? What's the expected behavior when gravity is disabled, but then it's changed to be a non-zero value with the API in gazebosim/gz-sim#3189?

If there is no need to calculate gravety, It's more clear to disable it than set to zero. Probrably internally in the physics engines are less calculations.

@ahcorde
Copy link
Contributor Author

ahcorde commented Feb 24, 2026

@scpeters or @caguero opinions here ?

Copy link
Member

@scpeters scpeters left a comment

Choose a reason for hiding this comment

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

gazebosim/gz-sim#3189 added the ability to change gravity at runtime. Is it still necessary to add aa feature to enable/disable gravity? What's the expected behavior when gravity is disabled, but then it's changed to be a non-zero value with the API in gazebosim/gz-sim#3189?

If there is no need to calculate gravety, It's more clear to disable it than set to zero. Probrably internally in the physics engines are less calculations.

gazebosim/gz-sim#3189 uses the World Get/Set Gravity feature from #275, while this is adding the equivalent of Model::SetGravityMode from gazebo-classic. Is there a particular use case motivating this, or is it mainly to improve feature parity with gazebo-classic?

Signed-off-by: Alejandro Hernandez Cordero <ahcorde@gmail.com>
@ahcorde ahcorde requested a review from scpeters February 25, 2026 10:45
Signed-off-by: Alejandro Hernandez Cordero <ahcorde@gmail.com>
Signed-off-by: Alejandro Hernandez Cordero <ahcorde@gmail.com>
Signed-off-by: Alejandro Hernandez Cordero <ahcorde@gmail.com>
@ahcorde
Copy link
Contributor Author

ahcorde commented Feb 25, 2026

@azeey @scpeters and @caguero ready for another pass

@ahcorde
Copy link
Contributor Author

ahcorde commented Mar 2, 2026

friendly ping @azeey @scpeters and @caguero

Copy link
Contributor

@caguero caguero left a comment

Choose a reason for hiding this comment

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

Is this functionality working with nested models? This might be a good pattern if not. Consider to add tests using nested models as well.

Signed-off-by: Alejandro Hernandez Cordero <ahcorde@gmail.com>
@ahcorde
Copy link
Contributor Author

ahcorde commented Mar 3, 2026

Is this functionality working with nested models? This might be a good pattern if not. Consider to add tests using nested models as well.

I will take a look to the nested models. I was testing some ideas and it's not working. I can do this in a follow up PR

ahcorde added 3 commits March 4, 2026 10:52
Signed-off-by: Alejandro Hernandez Cordero <ahcorde@gmail.com>
Signed-off-by: Alejandro Hernandez Cordero <ahcorde@gmail.com>
Signed-off-by: Alejandro Hernandez Cordero <ahcorde@gmail.com>
@ahcorde ahcorde requested a review from caguero March 4, 2026 14:38
Signed-off-by: Alejandro Hernandez Cordero <ahcorde@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🎵 harmonic Gazebo Harmonic

Projects

Status: Inbox

Development

Successfully merging this pull request may close these issues.

4 participants