gz-sim icon indicating copy to clipboard operation
gz-sim copied to clipboard

Inspect forces on a body

Open adityapande-1995 opened this issue 2 years ago • 4 comments

Desired behavior

It would be helpful to have a topic and later a GUI plugin that can visualize forces on a selected body. Currently there is no way to do that except fr adding debug prints in the plugins. This feature has been requested before : https://discourse.ros.org/t/why-is-robotics-simulation-hard/15888/3

Implementation suggestion

We could have an additional plugin or make Physics plugin publish net forces on a topic. Ideally it would be nice to have a breakdown of the forces, (say due to gravity, hydrodynamics, normal reaction, actuators, etc) with the net force on the body.

adityapande-1995 avatar Jun 22 '22 17:06 adityapande-1995

There's some work started here to visualize forces:

  • https://github.com/gazebosim/gz-sim/pull/1184

The implementation needs a bit more thought though. Ideally the server wouldn't be publishing markers directly. Instead, it could publish the wrenches applied by each plugin, and a GUI plugin is the one which aggregates that and publishes markers according to a configuration set by the user (color, marker scale, etc).

Another thing that is missing from that PR is the possibility of visualizing forces internal to the physics engine, like gravity. I don't have a clear idea on how to expose that though.

chapulina avatar Jun 23 '22 18:06 chapulina

Yeah this is something thats been on my backlog for some time. I agree with whatever @chapulina has said. I have not had time to work on this to refine it in any way shape or form.

arjo129 avatar Aug 24 '22 09:08 arjo129

Even if we do not have the breakdown of forces, we can still have a topic published by a "ForceInspector" plugin, that can publish the net forces and torques on links. It can use the linear and angular velocity data from the ecm, which would also include gravity, since these velocities are the result of all forces.

adityapande-1995 avatar Aug 31 '22 21:08 adityapande-1995

So I had tried this method earlier, its not particularly performant. Perhaps I will get time to work on it soon.

arjo129 avatar Sep 28 '22 01:09 arjo129