drake
drake copied to clipboard
Contact visualizer crashes when using animation with start time higher than 0
I believe that there is a bug related to Meshcat animation recorder. This line of hydroelastic_contact_visualizer.cc and this line of point_contact_visualizer.cc send a time = 0
, which, combined with a recording state, will force the animation to record this property. However, if we have used set_start_time() before, this line will crash the simulation.
How to reproduce
I am sorry that I don't have a ready to go example. Maybe I can build one soon, but I made a sequence that should probably crash:
- Start a simulation that contains an animation recording (spatula_slip_control?)
- Make the simulation run for some time and then call
set_start_time( t>0 )
- Make some contact trigger contact visualizer, so that it draws its lines
- It should crash
Possible solution
Of course this crash is not intended, but I believe that these lines were trying to set time equal to the animation start time, not exactly 0
. Hence, a solution would be:
- Getting the start_time() and then using that value in those lines.
- Treating time=0 as a possible input for
int Frame()
@@ -42,6 +42,7 @@ class MeshcatAnimation {
int frame(double time) const {
if (time == 0) { return 0; }
DRAKE_DEMAND(time >= start_time_);
return static_cast<int>(...);
What do you think?
Not sure who to assign this to -- @SeanCurtis-TRI for disposition, please.