[ODE] Important (new) info for saving sim state

Eric Froemling eric at ricore.net
Sun Aug 22 03:27:06 MST 2004


I recall seeing a person or two out there besides myself who was 
interested in perfectly restoring an ODE sim to a previous state so 
that it will arrive at the same results again.
Basically whats been said before is that for each body, its position, 
linear and angular velocities, and quaternion needs to be set to stored 
values.
Also, with quickstep and warm-starting, joint lambda values need to be 
saved/restored as well.  Theres no current api method to do this afaik. 
(warm starting can be disabled by commenting out the "#define 
WARM_STARTING 1" line in quickstep.cpp.
anyway thats old news...

I just found a new pitfall however..  (after a long and painful bug 
hunt ; P)
I'd found that though I was following all the above steps, my sims were 
still coming up with very slightly differing results depending on what 
saved point i reset them to.    I finally tracked this down to 
dBodySetQuaternion - it calls dNormalize4() on the values you provide.  
So if you plug a quaternion value into ODE that you'd pulled from 
dBodyGetQuaternion() earlier, the values that actually get stored might 
differ by a bit or two, making exact state restoration impossible.  For 
my own use I just commented out the dNormalize4 line.. I dont know if 
it would be useful to add a "dontNormalize" argument to the function or 
whatnot - I mainly just wanted to bring this to people's attention.

-Eric



More information about the ODE mailing list