> Why dJointFeedback structure contains fields for different forces and
> torques
> for two bodies?
>> As far as I can tell from my memory on mechanical problems, reaction
> forces
> that are caused by joint are equal in absolute value and the only
> difference
> is that they have opposite direction.
You betcha. However this is true only under the assumption that the
forces
are being applied at the same point in space (the location of the
joint) or
at least at points coaxial with the force.
> What wrong with me (or ODE)?
Nothing is wrong with ODE, and I suspect nothing is wrong with you
either. :)
The info that ODE returns in the joint feedback structure describes the
effective forces and torques that have been applied at the bodies'
respective
centers of mass. If you do the coordinate transformation to compute the
equivalent forces and torques, assuming that the forces are both being
applied
at the same point in space, you will find that they are indeed equal and
opposite.
Consider a hinge joint. ODE's job is to keep the appropriate axes on
the two
bodies collinear and to prevent the bodys from sliding relative to each
other
along that axis. In the physical world that constraint might be
maintained by
a bearing located at any point along the axis. The actual forces
experienced
at the joint will depend on the bearing's particular location. If you
want to
compute the actual torques experienced by a joint in a given spot, you
have to
do the conversion yourself, taking into account the joint's position,
which
ODE does not in general know.
Actually, you should observe that the *forces* returned by ODE *are*
already
equal and opposite, but the torques are not because the forces are being
applied at different points. To compute the corrected torques, you can
do
something like:
// joint connects body1 to body2, acting at position jointPos
const dJoint::FeedbackData *fb = joint->getFeedbackData();
// fb->f1 and fb->f2 are already correct; compute the torques:
dVector3 t1 = fb->t1 + (fb->f1).cross( jointPos -
body1->getPosition() );
dVector3 t2 = fb->t2 + (fb->f2).cross( jointPos -
body2->getPosition() );
// now t1 and t2 are equal and opposite too, so of course we really
// only needed to bother with one of the above two computations
(Or at any rate that's how I express it using my library; your syntax
will
be different, but the math is the same.)
mdh
Matt Hancher
NASA Ames Reserach Center
mdh at email.arc.nasa.gov