# Mass matrix for use with Lagrange Multipliers

This topic is 5082 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Hi. I'm currently messing around with implementing an articulated multibody system using Lagrange multipliers like in this Baraff paper: http://www.pixar.com/companyinfo/research/deb/sig96.pdf The problem is that it doesn't specify how to calculate the mass matrix M so that the system Af=b can be solved (pg 141). Does anyone know of any good resources for doing this or think they could explain. I did find a section on this in "Kinematic and Dynamic Simulation of Multibody Systems" here: http://mat21.etsii.upm.es/mbs/bookPDFs/Chapter04.pdf The problem is though I'm not convinced this mass matrix would be compatible since I not sure its for a cartesian Lagrange method like in the Baraff paper. Does anyone know if this is the case?? Cheers

##### Share on other sites
The matrix A in Baraff's paper is:

A = J*inv(M)*J'

J is the constraint Jacobian and M is the mass matrix. For a system with s constraints, A is s-by-s. It does not matter what kind of coordinate system you use. M and J must be in consistent coordinates.

Erin

##### Share on other sites
Yup M and J have to be in consistent coords which is kinda my point. Since I'm getting them from different resources I wasn't convinced they were. And I'm still not sure on how to actually calculate the mass matrix. I tried working it out myself but whats bothering me is that in the baraff paper he states:

F = Ma
(actually he uses v dot but same thing)

Seems fair enough at first glance except in keeping with the notation used throughout (actually - that used in Game Programming Gems 4 but which directly quotes this paper and says they are compatible and hence I assume the same notation since the baraff paper doesn't specify):

(for a single body)
F is a vector containing the force and torque (Fx, Fy, Fz, Tx, Ty, Tz)
M is the mass matrix
a is a vector containing the linear and angular accelerations.

The problem now is that in order for the Mass matrix to comply with the above, it must contain the angular velocity, an unkown, which doesn't pan out with the rest of his workings in the paper. And if its the notation which I've missinterpreted then that means his constrained solution contains no angular parts at all which clearly can't be right. Obviously I'm missing something big which I guess has to do with the calculation of the mass matrix since its the bit the paper skips over. Any help muchly appreciated.

##### Share on other sites
For body coordinates the mass matrix is simply:

M = diag(m1*I_33, I1, m2*I_33, I2, ...)

where I_33 is the 3-by-3 identity matrix and I1, I2, etc, are the 3-by-3 inertia matrices in global coordinates.

You mention the angular velocity being part of the mass matrix. This never happens. Here are the equations of motion for a single rigid body:

m*a = f
I*omega_dot + cross(omega, I*omega) = tau

Everything is in world coordinates. tau is the vector-3 of external torques.
Putting this 6-by-6 notation:

[m*I_33 0][ a ] = [ f ]
[0 I][omega_dot] [tau - cross(omega, I*omega)]

This has the form Ma = F.

Erin

##### Share on other sites
Cheers for sticking with this but its still not gelling for me. In my mind Force and Torque are equal concepts except one applies to translation and the other rotation. However in the formulation of the mass matrix the force stands alone on its side of the equation whilst the torque does not. To me this seems like a hack since one equation has been rearranged and one not and yet only part of each used to form the mass matrix. Does this mean that I should also subtract that additional term from any accumulated torque regarding the constraints in later calculations??

Also another thing still bothering me is that the angular velocity is something we wish to determine. So all you've managed to do is move this extra unknown to the right hand side which still causes hiccups later since we end up with more unkowns than equations. Or is it that the old velocity is used to calculate the new acceleration which is then used to calc the new velocity?? Surely not. Reminds me of them algebra problems when after much rearranging you end up with 1=1 cause you've done something like that and undone your previous work.

Then again maybe I'm just reading into this too much and making it more complex than needs be. Now I know what to do with the mass matrix I can see how its done mathematically. Still not sure I totally agree with it all physically though.

Cheers

##### Share on other sites
You can consider the term -cross(omega, I*omega) to be an "inertial torque". If you use an explicit integrator, the inertial torque is computed from the old angular velocity. There's nothing wrong with this! For example, some external forces/torques might depend on the angular velocity. For instance, rotational damping. Those forces/torques get computed using the old angular velocity. The integrator doesn't know the difference between inertial forces and external forces. Its all the same to the integrator.

Note: people often ignore the inertial torque in game physics. I think Baraff ignores it in some of him writings.

Erin

##### Share on other sites
Inertial torque - that makes it easier for me to swollow. It's funny, its really not a difficult thing but if something doesn't sit quite right with me its like my brain completely rejects it. Then again how can you truely understand something unless you challenge it.

Wrt the angular velocity thing, my constraints will also include hard springs which need to be done implicitly. So for this to be done strictly right I should really be using the new ang vel as well as the new inertia tensor. This is something I'll have to figure for myself though.

1. 1
2. 2
Rutin
19
3. 3
khawk
18
4. 4
5. 5
A4L
11

• 9
• 12
• 16
• 26
• 10
• ### Forum Statistics

• Total Topics
633768
• Total Posts
3013753
×