Question about Joint Limit

Please don't post Bullet support questions here, use the above forums instead.
fishboy82
Posts: 91
Joined: Wed Jun 10, 2009 4:01 am

Question about Joint Limit

Post by fishboy82 »

Hi every one:
When I read Kenny Erleben 's paper "Stable, Robust, and Versatile Multibody Dynamics Animation" .In the chapter about Joint limit, when Kenny describe the slider joint limit 's Jacobian the Angular Part of the first body is 0.5*(C X (Axis)) ,the Angular Part of the second body is -0.5*(C X (Axis)), where the X meanse Cross Product and Axis is the Silde Axis in World coordinate System. Note the two Part 's value is the same only in opposite of the sign,But when I read Bullet's btOdeTypedJoint in it's limit Jacobian part ,the first body's Jacobian part is the exactly the same as the second Part(even the sign is the same),this is apperaently totally opposite to the Kenny's Paper .So I am wondering who is right all I miss something. In my comperhension about Joint limit is that: it is just like a constraint which has a constraint point and the point will exert force and torque to every connected body, and when exceeded the limits the constraint point will have a velocity constraint just like the contact constraints to prevent exceeded limit.So any one please help me for this.
Dirk Gregorius
Posts: 861
Joined: Sun Jul 03, 2005 4:06 pm
Location: Kirkland, WA

Re: Question about Joint Limit

Post by Dirk Gregorius »

The velocity constraint should be C_dot = (omega2 - omega1) * axis and the resulting Jacobian is J = ( 0 -axis 0 axis ). The Jacobian is used in two cases. First to compute the effective mass me = ( J * M^-1 * JT ) ^-1 and second to compute the veloctiy error dv = J * v. For the effective mass the sign is bacially canceled out since it is "quadratic". In the second case I assume that Bullet uses the sign implicitely somewhere when the solver computes the velocity error. Did you check this?
fishboy82
Posts: 91
Joined: Wed Jun 10, 2009 4:01 am

Re: Question about Joint Limit

Post by fishboy82 »

Thanks Dirk Gregorius :
But I think I am not expressing my problem clearly. My problem is Joint Limits ,,take slider joint for example as mentioned by Kenny, "in Real world the slide dist in a slider Joint can not be infinitly long",so we should add addtional constraint in addtion to the velocity constraint to prevent the slide distance be too long. If we detect the Relative slide distance between the two body of joints exceeded the UpperLimit of the distance the additional constraint should be applied. So I am not mention the velocity constraint nor the velocity error. Just the Joint limit of a slider joint which is a bit different in the Jacobian Part as mentioned in Kenny's paper and the bullet's implementation. So strange because the sign of the Jacobian's angular part is just the opposite of them ,In my person opinion, I think the bullet is write because if use Kenny's method. The limit constraint force will introduce a relative angular acceleration which should not be introduce by the limit constraint force I think:)
Dirk Gregorius
Posts: 861
Joined: Sun Jul 03, 2005 4:06 pm
Location: Kirkland, WA

Re: Question about Joint Limit

Post by Dirk Gregorius »

Limits work like this, e.g. angular constraints:

float current_angle = ComputeRelAngleBetweenBodies();
if ( current_angle < lo )
{
// Apply limit
}
else
{
// Do nothing
}


The force/impulse direction is defined through the Jacobian F = JT * lambda. The impulse is also clamped since it can only push away from the limit but does not attract to the limit. This is the correct way and I am sure that Bullet does it like this.

Note that the thesis you are reading uses a slightly different, but mathematically equivalent formulation. Projected Gauss-Seidel and sequential impulses are the same.

Cheers,
-Dirk
fishboy82
Posts: 91
Joined: Wed Jun 10, 2009 4:01 am

Re: Question about Joint Limit

Post by fishboy82 »

That's Greate:
I although think bullet does the right thing " The impulse is also clamped since it can only push away from the limit but does not attract to the limit". excellent cocluision, so the limit force perform similar to a contact constraint.This convinced me that the limit constraint 's angular Jacobian of slide joint's shoudl not introduce relative angular acceleration. because F = JT * lambda .so in the slider joint case the Jacobian should like
Axis , -Axis, 0.5*(C X (Axis)) , 0.5*(C X (Axis)) rather than
Axis , -Axis, 0.5*(C X (Axis)) , -0.5*(C X (Axis)) because in the second case the Torque introduced by the limit force of the first and second body will be 0.5*(C X (Axis)) *lambda ,
-0.5*(C X (Axis)) *lambda respectively and this will introduce relative Angular impluse
leromi
Posts: 6
Joined: Thu Oct 07, 2010 8:27 pm

Re: Question about Joint Limit

Post by leromi »

fishboy82 wrote: because F = JT * lambda .so in the slider joint case the Jacobian should like
Axis , -Axis, 0.5*(C X (Axis)) , 0.5*(C X (Axis)) rather than
Axis , -Axis, 0.5*(C X (Axis)) , -0.5*(C X (Axis)) because in the second case the Torque introduced by the limit force of the first and second body will be 0.5*(C X (Axis)) *lambda ,
-0.5*(C X (Axis)) *lambda respectively and this will introduce relative Angular impluse
I think that Erleben's formulation of limit Jacobian is correct:
Axis , -Axis, 0.5*(C X (Axis)) , -0.5*(C X (Axis))

We should think about it as corrective impulses to remove any angular difference between two bodies.
For example, during the iterative solving ( SI ) it is easy to have w2-w1 != 0. So, to correct this difference we need to apply opposite impulses, that is why we have opposite signs. Besides this intuitive explanation Erleben mathematically proved this.
Dirk Gregorius
Posts: 861
Joined: Sun Jul 03, 2005 4:06 pm
Location: Kirkland, WA

Re: Question about Joint Limit

Post by Dirk Gregorius »

IIRC the slider joint Jacobians in Erleben are actually wrong. The constraint equation looks like this:

C = (x2 + r2 - x1 - r1) * n
dC/dt = v2 + cross(omega2, r2) - v1 - cross(omega1, r1) * axis + (x2 + r2 - x1 - r1) + dn / dt

The time derivative of the slider axis n depends on how you store it. E.g. if you store it locally in body1 dn1/dt = cross(w1, n1) where n1 is R1 * n1'. And the prime denotes that n1' is in local coordinates of the body.

I would not use the Jacobians derived in Erleben to model joints. In particular not the angular constraints. Look at Shabana for a proper joint formulation.

HTH,
-Dirk