[ODE] Bug in slider joint, sliderGetInfo2()?

David Black dblack at fastmail.fm
Sat May 14 10:51:01 MST 2005


[oops, not to list first time...]

Hi,

Yes, the comment certainly isnt very rigerous, but...

J1 = [ax  r2%ax  -ax  ax%d-r1%ax]
J2 = [ay  r2%ay  -ay  ay%d-r1%ay]


If we take r1 to be zero, then we get:

J1 = [ax  -(p2-p1)%ax  -ax  ax%(p2-p1)]
J2 = [ay  -(p2-p1)%ay  -ay  ay%(p2-p1)]

J1 = [ax  ax%(p2-p1)  -ax  ax%(p2-p1)]
J2 = [ay  ay%(p2-p1)  -ay  ay%(p2-p1)]


Which is the same as the ODE code(except for a factor of 0.5, which I 
didnt have in my own slider joint either). But it doesnt seem to make 
much difference either way(because the values are small), I have tried 
using 0.5(and turning error correction off). The result are almost 
completely identical.

But my concern with the code was that currently it actually sets the 
jacobian(despite what it may intend) to:

J1 = [ax  0  -ax  0]
J2 = [ay  .5*ay%(p2-p1)  -ay  .5*ay%(p2-p1)]


Which is clearly incorrect.

David



Erin Catto wrote:

>I don't agree with that formulation. It seems to be based on a velocity
>intuition. I think it is cleaner and more accurate to begin with a position
>constraint and then differentiate by time.
>
>For a slider joint you have points in each body that have no relative
>translation in two directions:
>
>(p2 - p1)*ax = 0
>(p2 - p1)*ay = 0
>
>where ax and ay are orthogonal axes embedded in either body. They are also
>orthogonal to the axis of translation. Let's say they are embedded in body
>1. Then take the derivative:
>
>(vp2 - vp1)*ax + (p2 - p1)*(w1 % ax) = 0
>(vp2 - vp1)*ay + (p2 - p1)*(w1 % ay) = 0
>
>Here I use * for dot and % for cross. w1 and w2 are the angular velocities.
>
>Now p1 and p2 are body fixed points located by the center of mass positions
>and radius vectors:
>
>p1 = x1 + r1
>p2 = x2 + r2
>
>The velocity of p1 and p2 is:
>
>vp1 = v1 + w1 % r1
>vp2 = v2 + w2 % r2
>
>Substitute these into the velocity constraints:
>
>v2*ax + ax * w2 % r2 - v1*ax - ax * w1 % r1 + d * (w1 % ax) = 0
>v2*ay + ay * w2 % r2 - v2*ay - ay * w2 % r2 + d * (w1 % ay) = 0
>
>where d = p2 - p1.
>
>To form the Jacobian we need to isolate v1, w1, v2, and w2. Using the scalar
>triple product identity a * b % x == b * x % a, we get:
>
>J1 = [ax  r2%ax  -ax  ax%d-r1%ax]
>J2 = [ay  r2%ay  -ay  ay%d-r1%ay]
>
>This needs to be combined with the rotational constraint from my earlier
>post. This gives a total of 5 constraints for a slider joint.
>
>Erin
>
>-----Original Message-----
>From: ode-bounces at q12.org [mailto:ode-bounces at q12.org] On Behalf Of David
>Black
>Sent: Friday, May 13, 2005 9:23 AM
>To: ode at q12.org
>Subject: [ODE] Bug in slider joint, sliderGetInfo2()?
>
>Hi,
>
>I was browsing joint.cpp and I think I noticed a small problem with 
>sliderGetInfo2(), ie in
>
>  // remaining two rows. we want: vel2 = vel1 + w1 x c ... but this would
>  // result in three equations, so we project along the planespace vectors
>  // so that sliding along the slider axis is disregarded. for symmetry we
>  // also substitute (w1+w2)/2 for w1, as w1 is supposed to equal w2.
>
>  [SNIP]
>
>    dCROSS (tmp, = REAL(0.5) * ,c,p);
>    for (i=0; i<3; i++) info->J2a[s3+i] = tmp[i];
>    for (i=0; i<3; i++) info->J2a[s3+i] = tmp[i];
>    dCROSS (tmp, = REAL(0.5) * ,c,q);
>    for (i=0; i<3; i++) info->J2a[s4+i] = tmp[i];
>    for (i=0; i<3; i++) info->J2a[s4+i] = tmp[i];
>    for (i=0; i<3; i++) info->J2l[s3+i] = -p[i];
>    for (i=0; i<3; i++) info->J2l[s4+i] = -q[i];
>  }
>
>Shouldnt:
>    dCROSS (tmp, = REAL(0.5) * ,c,p);
>    for (i=0; i<3; i++) info->J2a[s3+i] = tmp[i];
>    for (i=0; i<3; i++) info->J2a[s3+i] = tmp[i];
>    dCROSS (tmp, = REAL(0.5) * ,c,q);
>    for (i=0; i<3; i++) info->J2a[s4+i] = tmp[i];
>    for (i=0; i<3; i++) info->J2a[s4+i] = tmp[i];
>
>be (if the comment is to be believed and we are "substitute (w1+w2)/2 
>for w1")
>   
>    dCROSS (tmp, = REAL(0.5) * ,c,p);
>    for (i=0; i<3; i++) info->J1a[s3+i] = tmp[i];/*<<<<<<<<<<<<*/
>    for (i=0; i<3; i++) info->J2a[s3+i] = tmp[i];
>    dCROSS (tmp, = REAL(0.5) * ,c,q);
>    for (i=0; i<3; i++) info->J1a[s4+i] = tmp[i];/*<<<<<<<<<<<<*/
>    for (i=0; i<3; i++) info->J2a[s4+i] = tmp[i];
>
>Hope this helps someone with there slider2 joints a little... Or am I 
>misunderstanding this bit?
>
>David
>
>_______________________________________________
>ODE mailing list
>ODE at q12.org
>http://q12.org/mailman/listinfo/ode
>
>
>_______________________________________________
>ODE mailing list
>ODE at q12.org
>http://q12.org/mailman/listinfo/ode
>  
>



More information about the ODE mailing list