[ODE] dBodyGetTorque & dBodyGetForce confusion

Nguyen Binh ngbinh at glassegg.com
Thu Jul 29 13:45:07 MST 2004


Hi Mark,

   So, please rephrase what exactly do you want.
   You wish to get a value of forces and torques that acted on each
   bodies instantly (or more precise, in previous step???).

   If that what you like, I'd suggest you modified ODE's source code.

   Here is original code in objects.h
   
struct dxBody : public dObject {
  dxJointNode *firstjoint;      // list of attached joints
  int flags;                    // some dxBodyFlagXXX flags
  dGeomID geom;                 // first collision geom associated with body
  dMass mass;                   // mass parameters about POR
  dMatrix3 invI;                // inverse of mass.I
  dReal invMass;                // 1 / mass.mass
  dVector3 pos;                 // position of POR (point of reference)
  dQuaternion q;                // orientation quaternion
  dMatrix3 R;                   // rotation matrix, always corresponds to q
  dVector3 lvel,avel;           // linear and angular velocity of POR
  dVector3 facc,tacc;           // force and torque accumulators
  dVector3 finite_rot_axis;     // finite rotation axis, unit length or 0=none

  // auto-disable information
  dxAutoDisable adis;           // auto-disable parameters
  dReal adis_timeleft;          // time left to be idle
  int adis_stepsleft;           // steps left to be idle
};

  Please take special care to the
  dVector3 facc,tacc;           // force and torque accumulators

  Those are well-known force and torque accumulators mentioned in many
  basic papers of physical simulation. They accumulate the external
  force (drag, gravity) and constraints forces (after solving
  joints,...) and be reset after each step. So you could just simply
  add two more variables
  dVector3 old_facc,old_tacc;  // old force and torque accumulators
  and before resetting facc and tacc, just save them to those new
  variables.

  And ofcourse , you could add some helper functions like

 const dReal * dBodyGetOldForce (dBodyID b)
 {
   dAASSERT (b);
   return b->old_facc;
 }

 const dReal * dBodyGetOldTorque (dBodyID b)
 {
   dAASSERT (b);
   return b->old_tacc;
 }

  Hope that helps.
  
MR> Thanks for the input,

MR> I've been looking around the user guide and it appears the only things
MR> that allow feedback functions are joints. Am I supposed to create a
MR> joint between my body (that I wish to acquire the force/torque) and
MR> the static world?

MR> I'm sorry I'm so clueless, hopefully I'm not bothering anyone by
MR> asking such silly questions.

MR> Mark



-- 
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