-
Notifications
You must be signed in to change notification settings - Fork 285
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
Feature request: ability to updating link mass during runtime. #2733
Comments
There is no API to do update the mass of a link at runtime. The pattern of using components to update values typically starts with creating a
gz-sim/src/systems/joint_controller/JointController.cc Lines 327 to 338 in 1739bdb
Physics system takes care of applying the force in the physics engine gz-sim/src/systems/physics/Physics.cc Lines 2317 to 2335 in 1739bdb
So, if you're interested in working on this, I'd recommend starting by creating |
Thank you for your response and guidance. From what I understand, updating a link’s mass at runtime requires an InertialCmd component, similar to JointForceCmd. However, since the Physics system doesn’t process InertialCmd by default, I’d need to modify it to apply these updates to the physics engine. This is why changes to the Physics system are necessary, and I assume that's why this issue was moved to Core development. Essentially, inertial data remains static after being loaded, so modifying Physics is required to enable runtime updates. I appreciate your insights and would love to hear your thoughts. |
This problem also reminds me when I tried to move a model's position that I set to be static in sdf, as I changing its position, the changes did reflect in the gui (even when I set to show the collider of the model) but the actual collider that was registered to the physics system did not update the position and the the invisible static object stayed in the same place and other models would collide with it. So I guess the same solution is needed for this problem too, to make a Cmd that updates the Component values in Physics System. |
Yes, that is all correct. I've thought about this some more, and I believe we'll also need to add an API in gz-physics to allow setting link inertias similar to gazebosim/gz-physics#462.
You'll need to use the gz-sim/include/gz/sim/components/PoseCmd.hh Lines 36 to 40 in 0e02d36
|
I need change the link's mass during runtime. This was possible in gazebo classic through SetMass and UpdateMass functions but I can't find such ability in gz sim.
https://stackoverflow.com/questions/70864861/gazebo-how-can-i-change-model-weigth-during-runtime
https://answers.gazebosim.org/question/19201/
Additionally I tried to make a plugin for this purpose that updates the link's mass from ros topic but it doesn't work...
CMakeLists.txt:
LinkMassChanger.hh:
LinkMassChanger.cc:
package.xml:
The text was updated successfully, but these errors were encountered: