-
Notifications
You must be signed in to change notification settings - Fork 338
Allow to enable/disable static and gravity #3007
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
base: gz-sim8
Are you sure you want to change the base?
Conversation
Signed-off-by: Alejandro Hernandez Cordero <[email protected]>
Signed-off-by: Alejandro Hernández Cordero <[email protected]>
@@ -41,6 +41,10 @@ namespace components | |||
using GravityEnabled = Component<bool, class GravityEnabledTag>; | |||
GZ_SIM_REGISTER_COMPONENT( | |||
"gz_sim_components.GravityEnabled", GravityEnabled) | |||
|
|||
/// \brief Store the gravity acceleration. |
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.
Nit: Update indentation. Also, is the comment correct? I'd expect something about store whether we want to enable gravity or not.
|
||
/// \brief Set a new state to change the model's gravity. | ||
/// \param[in] _ecm Entity-component manager. | ||
/// \param[in] _gravity New model state. |
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.
Replace _gravity
with _enabled
?
/// deleted the following iteration. | ||
public: std::unordered_set<Entity> staticStateCmdsToRemove; | ||
|
||
public: std::unordered_set<Entity> gravityEnabledCmdsToRemove; |
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.
Add doxygen.
|
||
////////////////////////////////////////////////// | ||
// enabled gravity | ||
/// \brief Feature list for model static state. |
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.
Update comment.
@@ -2101,6 +2122,30 @@ void PhysicsPrivate::RemovePhysicsEntities(const EntityComponentManager &_ecm) | |||
void PhysicsPrivate::UpdatePhysics(EntityComponentManager &_ecm) | |||
{ | |||
GZ_PROFILE("PhysicsPrivate::UpdatePhysics"); | |||
|
|||
// _ecm.Each<components::Model, components::Name, components::Static>( |
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.
Remove this block?
@@ -2743,6 +2923,7 @@ void PhysicsPrivate::ResetPhysics(EntityComponentManager &_ecm) | |||
this->canonicalLinkModelTracker = CanonicalLinkModelTracker(); | |||
this->modelWorldPoses.clear(); | |||
this->worldPoseCmdsToRemove.clear(); | |||
this->staticStateCmdsToRemove.clear(); |
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.
Should we also clear gravityEnabledCmdStoreremove
?
void Model::SetStaticStateCmd(EntityComponentManager &_ecm, | ||
bool _state) | ||
{ | ||
std::cout << "SetStaticState " << std::endl; |
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.
Remove?
@@ -219,6 +220,44 @@ void Model::SetWorldPoseCmd(EntityComponentManager &_ecm, | |||
} | |||
} | |||
|
|||
void Model::SetStaticStateCmd(EntityComponentManager &_ecm, |
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.
Nit: Add //////////////////////////////////////////////////
} | ||
} | ||
|
||
void Model::SetGravityEnabledCmd(EntityComponentManager &_ecm, |
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.
Nit: Add //////////////////////////////////////////////////
void Model::SetGravityEnabledCmd(EntityComponentManager &_ecm, | ||
bool _enabled) | ||
{ | ||
std::cout << "SetGravityEnabledCmd " << std::endl; |
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.
Remove?
🎉 New feature
Summary
Requires gazebosim/gz-physics#764
Allow to enable/disable gravity and static state
Test it
Checklist
codecheck
passed (See contributing)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
andGenerated-by
messages.