[ODE] ODE Source code vs. Baraff
Sergio Valverde
svalverde at barcelona.ubisoft.es
Wed Mar 19 02:39:01 2003
>> A*lamda = b (plus some stuff for the LCP solver to simulate friction and
>> limits..)
>> where:
>> invM = inverse of Mass matrix, Fext = external forces (and torques)
>> A = J * invM * J' (I got this one!)
>>b = -(J * invM * Fext + c) (here's my problem)
I think that it is not necessary to find the equivalence between ODE
and Baraff's formulation. I spent some efforts on that with little
success (of course, due to my limited mathematical abilities ;-)
>> Am I misinterpretting lamda, or is its definition
>> slightly different in your implementation? If so, how can I reformulate
>> the problem so that:
>> for i = 0 to iterations
>> for each joint in island (world for now)
>> (S1) calculate rhs = f(body->facc, body->tacc)...
>> (S2) dSolveLCP(A, lamda, rhs, lo, hi, other stuff)
>> (S3) add J * lamda to accumulators
>> next joint
>> next i
(S4) Integration
In fact, the simple solution we have outlined in past e-mails is
quite similar to your scheme. In fact, the same ODE source code gives
clues to formulating the "iterative" algorithm. Using dSolveLCP
simplifies a lot and also (because already performs some sort of
error reduction) limits the number of iterations until convergence.
Step S1 (PrepareLCP): The code for computing A and RHS for a single
joint can be adapted from the existing ODE source code for computing
A and RHS with (multiple) joints. Note that the single joint A matrix
is equivalent to computing the diagonal blocks of the multiple
joints A matrix.
Steps S2 (SolveLCP) and S3 (Acumulate): Don't need any adjustment at all.
Simply pass the right parameters for the single joint scenario.
Step S4 (Integration): Don't forget to integrate using MoveAndRotate
Also, I found useful to precompute the inertia matrices first (probably
along with the A matrices)
Sergi