[ODE] amotor bugfix

Geoff Carlton gcarlton at iinet.net.au
Sun Oct 23 13:43:01 MST 2005


Actually, the bug has been found before, on 30/9/04.  The result of the 
discussion was apparently the patch file committed into cvs, so I'm not 
sure why the bug is still there now, a year later.

[ODE] bug in amotorComputeGlobalAxes:

@@ -2301,20 +2301,20 @@
    // relative to b1
    dMULTIPLY0_331 (ax[i],joint->node[0].body->R,joint->axis[i]);
      }
-      if (joint->rel[i] == 2) {
+      else if (joint->rel[i] == 2) {
    // relative to b2
    if (joint->node[1].body) {   // jds: don't assert, just ignore
    dMULTIPLY0_331 (ax[i],joint->node[1].body->R,joint->axis[i]);



Nagymáthé Dénes wrote:

> Hi,
>  
> I've just realized a bug in amotor; it might be responsible for 
> confusion of many people recently:
> In amotorComputeGlobalAxes(), when mode is dAMotorUser (the else 
> case), there's an else statement missing, causing the use of _global_ 
> axis if the axis is set relative to b1!
> The code looks like this:
>  
>       if (joint->rel[i] == 1) {
>  // relative to b1
>  dMULTIPLY0_331 (ax[i],joint->node[0].body->R,joint->axis[i]);
>       } else  <----THIS WAS MISSING **********
>       if (joint->rel[i] == 2) {
>  // relative to b2
>         dIASSERT(joint->node[1].body);
>  dMULTIPLY0_331 (ax[i],joint->node[1].body->R,joint->axis[i]);
>       }
>       else {
>  // global - just copy it
>  ax[i][0] = joint->axis[i][0];
>  ax[i][1] = joint->axis[i][1];
>  ax[i][2] = joint->axis[i][2];
>       }
> I can't believe no one has realized it before. :o)
>  
> Denes
>  
>
>------------------------------------------------------------------------
>
>_______________________________________________
>ODE mailing list
>ODE at q12.org
>http://q12.org/mailman/listinfo/ode
>  
>


More information about the ODE mailing list