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

WorldAngularVelocityCmd and WorldLinearVelocityCmd are ignored by Physics system #2266

Open
scpeters opened this issue Dec 12, 2023 · 4 comments
Assignees
Labels
enhancement New feature or request

Comments

@scpeters
Copy link
Member

Desired behavior

Currently the AngularVelocityCmd and LinearVelocityCmd components can be added to a model or link to set body-fixed velocity components (see Physics.cc:2406-2608. Components are also defined for WorldAngularVelocityCmd and WorldLinearVelocityCmd, but the Physics system ignores these components.

The Physics system should use these components so that velocities can be set in the world frame as an alternative to a body-fixed frame.

Alternatives considered

Implementation suggestion

This does raise a question what to do if an entity has both a *VelocityCmd and a World*VelocityCmd set; which one should be honored? Or should neither be honored?

I would suggest defining an order of precedence, perhaps preferring the body-fixed components since they were the first to be supported by the Physics system.

Additional context

@scpeters scpeters added the enhancement New feature or request label Dec 12, 2023
@arjo129
Copy link
Contributor

arjo129 commented Dec 14, 2023

I suspect we should warn users if two plugins are setting VelocityCmd and World*VelocityCmd. My guess is the end user would be confused by the behavior if we don't warn them. We should have a defined ordering but at the very least by warning users, we would be preventing some degree of confusion.

On a related note, what happens if we set LinearVelocity* then try to apply a force? Or for instance the user sets a linear velocity and then tries to apply a force (it may be nice to support his at some point as it could clean up some of our tests)?

@azeey
Copy link
Contributor

azeey commented Jan 8, 2024

Let's discuss whether we should be encouraging the use of VelocityCmd or creating a new component specifically for setting initial velocities.

@azeey azeey moved this from Inbox to To do in Core development Jan 8, 2024
@scpeters
Copy link
Member Author

Let's discuss whether we should be encouraging the use of VelocityCmd or creating a new component specifically for setting initial velocities.

We currently use JointPositionReset and JointVelocityReset to change joint states for a single timestep; so I suppose we could do the same with WorldLinearVelocityReset and WorldAngularVelocityReset.

@traversaro
Copy link
Contributor

traversaro commented Jan 19, 2024

Let's discuss whether we should be encouraging the use of VelocityCmd or creating a new component specifically for setting initial velocities.

We currently use JointPositionReset and JointVelocityReset to change joint states for a single timestep; so I suppose we could do the same with WorldLinearVelocityReset and WorldAngularVelocityReset.

My two cents: I recently started contributing to a project that uses ros2_control + Gazebo/gz, and the use of control/cmd naming for operations that are actually fiddling with the physics engine in a way that has no direct relation in the real world has been indeed a major source of confusion (see also https://discord.com/channels/1077825543698927656/1080763334384697430/1196933980252029099). So I am super in favor of using Reset as opposed to Cmd in this context.

fyi @AleTarsi @pattacini

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: To do
Development

No branches or pull requests

4 participants