[ODE] More save/restore issues
Eric Froemling
eric at ricore.net
Tue Aug 24 23:59:31 MST 2004
In my never-ending quest to get numerically-perfect save/restore
working with ODE, i've come across a few more issues - I thought I'd
throw them out and see if anyone had any suggestions or comments in
case im missing something or misintepreting something...
The first problem applies to simple or hash spaces - i havnt tested
with quadtree but at a glance it looks to be ok.
When a dxGeom is added to a space, it is placed on a list in the space.
The space's list is sorted such that "dirty" geoms (ones needing
bounding boxes updated or whatnot) are first in the list. Thus when a
geom is dirtied, it is re-added to the list at the beginning. Thus
when i run my simulation from frame 0 up to frame x, at frame x the
geoms are all shuffled around from being dirtied many times up to that
point, but if i recreate the simulation to start at frame x, the geoms
appear on the list in the order they were just added. This means the
order they are returned in for collisions and other such things will be
totally different and in the end the sim doesn't come out the same.
As a quick workaround for myself, I removed the reordering code in
dxSpace::dirty() and modified dxSimpleSpace::cleanGeoms() and
dxHashSpace::cleanGeoms() to scan through all geoms instead of
stopping when it finds a non-dirty one. (since they are no longer
grouped at the beginning of the list) I realize this reduces
efficiency a bit, but it fixes the problem for me. It looks like the
quadtree space keeps a seperate list for dirty geoms - maybe that would
be a good way to go for hash and simple?
The second bug is a bit simpler - I found that retrieving aMotor angles
for an aMotor constraint i've just created gave incorrect values - Upon
examination, I noticed that dJointGetAMotorAngle simply returns
joint->angle[anum], which is computed during amotorGetInfo1, so the
returned values are accurate only after a simulation step has been run.
To fix this I just added the
amotorComputeGlobalAxes()/amotorComputeEulerAngles() call into
dJointGetAMotorAngle().
-Eric
More information about the ODE
mailing list