RobotLocomotion / drake

Model-based design and verification for robotics.
https://drake.mit.edu
Other
3.35k stars 1.27k forks source link

DrakeVisualizer: Cannot Toggle Hydroelastic Contact Visualizer #16841

Closed rcory closed 2 years ago

rcory commented 2 years ago

When toggling off hydroelastic contact visualization in Drake Visualizer through the tools menu (Tools->Hydroelastic Contact Visualizer), there is no way to toggle it back on. That is, once the hydro visualization is toggled off, it remains off until Drake Visualizer is re-started again.

DamrongGuoy commented 2 years ago

I can reproduce the problem as shown in these pictures.

image image image image

DamrongGuoy commented 2 years ago

I think it's related to these two functions: add_subscriber and remove_subscriber, and the way __init__ works.

This example is good for testing because it makes hydroelastic contact all the time:

bazel run //examples/hydroelastic/spatula_slip_control:spatula_slip_control

The other thing to help is to use lcm-logger to record and lcm-logplayer-gui to playback.

bazel-bin/external/lcm/lcm-logplayer-gui lcmlog-yyyy-mm-dd
DamrongGuoy commented 2 years ago

CC: @rpoyner-tri do you see something obviously wrong?

The ability to toggle hydroelastic visualizer on and off would be very handy. I hope we can fix it easily.

rpoyner-tri commented 2 years ago

It's probably worth a look, but don't forget that drake-visualizer is reaching end-of-life soon. So it's only worth effort until the replacement meshcat solution becomes available.

DamrongGuoy commented 2 years ago

I agree. We should fix it only if it's easy.

I ask for high priority for the Onsite demo next week.

It's also another case of the absence of unit testing?

rpoyner-tri commented 2 years ago

Had a f2f with @joemasterjohn . I think he will be able to offer some useful advice before too long. I will bow out for now. :)

joemasterjohn commented 2 years ago

One question I had before digging deep into a solution for this is: do you just want to hide all of the hydroelastic contact visualizations, or is there a need to disable the plugin itself? Because if all you need to do is hide the visuals, you can just toggle the eye icon for "Hydroelastic Contact" in the Scene Browser:

bubble_off

DamrongGuoy commented 2 years ago

That's a very good question, @joemasterjohn. I let @rcory answer that.

I add that the eye works for one snapshot of LCM message. In the next publish step, the next hydroelastic contact result will show up again. In other words, the eye opens itself for the next message.

The eye does work if we pause the simulation and toggle on and off, so it could be a workaround. However, it reactivates in the next publish.

UX code is never easy. :sweat:

joemasterjohn commented 2 years ago

Yeah the fact that the eye button re-enables for each new LCM message is frustrating.

Regardless, I have a fix for the original problem with #16852. @rcory @DamrongGuoy could you please verify that this fixes the problem for you? Thanks.

rcory commented 2 years ago

Verified that the associated PR fixes the issue for me. Thanks!