[ODE] AutoDisable optimization

Nguyen Binh ngbinh at glassegg.com
Wed May 26 16:26:45 MST 2004


Hi Russ,

   I saw a way to improve ODE's performance by implement a more
   correct way of auto-disable feature.

   1. We have a limit for a body to sleep so we should have a limit
   for a body to wake up.

   Now, in ODE:
       a) Check if bodies should be slept
       b) Update physics for enabled bodies and bodies connected to
       enabled bodies.
       c) Re-enable all bodies in the island

   The problem is with step c). Quote from the code:

    // what we've just done may have altered the body/joint tag values.
    // we must make sure that these tags are nonzero.
    // also make sure all bodies are in the enabled state.

    for (i=0; i<bcount; i++)
        {
      body[i]->tag = 1;
      body[i]->flags &= ~dxBodyDisabled;
    }
    
    So we enabled bodies that are "might" be changed in b). Actually
    we could know exactly what bodies are being changed, what are not
    (under a limit). We could easily do that in where we move bodies
    dxStepBody :

        Check if body avel and lvel are big enough
        If no
          if body is disable
            So that change is not enough, just early quit, don't
            bother update the body's state
          endif
        endif
        
        Continue to normal update...

    And we should remove the code
       body[i]->flags &= ~dxBodyDisabled;
    in original code and let the waking up decide by dxStepBody

    I had implemented this thing and it helps a lot, especially for
    the case where a small geom (sphere?) touches a huge stacks of
    geoms. With original code, all bodies in that huge stack are wake
    up and thus put a lot of work (that will result a very small
    change - actually should be left out) to the solver. But with the
    new code, just a small portion of bodies are re-enabled.


    To Russ, I could send you the code but I couldn't deal with the
    body's tag stuff so I get assert false in the checking code in
    dxProcessIslands(). Note: I had removed those check without any
    problem.

-- 
Best regards,

---------------------------------------------------------------------
   Nguyen Binh
   Software Engineer
   Glass Egg Digital Media
   
   E.Town Building  
   7th Floor, 364 CongHoa Street
   Tan Binh District,
   HoChiMinh City,
   VietNam,

   Phone : +84 8 8109018
   Fax   : +84 8 8109013

     www.glassegg.com
---------------------------------------------------------------------



More information about the ODE mailing list