[ODE] Joint forces

Russ Smith russ at q12.org
Wed Aug 28 17:26:02 2002


your point about contact joints is a good one - we dont want to be
automatically allocating and deallocating many 64 byte structures every
time step. so i suggest the following API:

    typedef struct dJointFeedback {
      dVector3 f1;                // force applied to body 1
      dVector3 t1;                // torque applied to body 1
      dVector3 f2;                // force applied to body 2
      dVector3 t2;                // torque applied to body 2
    } dJointFeedback;

    void dJointSetFeedback (dJointID, dJointFeedback *);
    dJointFeedback *dJointGetFeedback (dJointID);

this simply sets and gets a joint pointer to the feedback memory block. if
the pointer is 0, nothing special is done during the step, else the
feedback data is filled in. the point here is that it's the USER that
allocates the memory. for constant joints it's not a problem to make the
extra blocks, and for contacts you can allocate them yourself out of a
fixed array. this put a bit more work on the user, but keeps ODE simple
and avoids callbacks.

another reason to avoid callbacks here (beyond those stated
already) is that this would introduce a place in ODE where the user can
change the system structure in the *middle* of a step. this would have bad
consequeces if it happened. of course you could say "don't do this" in the
documentation, or add system locking, but both of these solutions are
poor.

> The main reason for the option to disable a joint's effect on the
> current step is to fix LCP errors.

can you give details? i dont see how this could avoid any problems as the
joint forces are added *after* the LCP computation (i.e. it would be too
late).

russ.

--
Russ Smith
http://www.q12.org/