\input manualMacros.tex
\manBegin
\manPageInfo{RCI Reference Manual}{}{}
\manTitle{encoderToAngle}{3}
\manSection{NAME}
{\rightskip=0ptplus1fil
{\tt \manName{encoderToAngle}},
{\tt \manName{angleToEncoder}},
{\tt \manName{encoderToJoint}},
{\tt \manName{jointToEncoder}},
{\tt \manName{mtorqueToJtorque}},
{\tt \manName{jtorqueToMtorque}}
-- generic RCI actuator to joint conversion routines.

}
\manSection{USAGE}
\cverbatim
#include <rci.h>

encoderToAngle(ang, enc, jls)
   float *ang;
   int *enc;
   JLS *jls;

angleToEncoder(enc, ang, jls)
   int *enc;
   float *ang;
   JLS *jls;

encoderToJoint(ang, enc, jls)
   float *ang;
   int *enc;
   JLS *jls;

jointToEncoder(enc, ang, jls)
   int *enc;
   float *ang;
   JLS *jls;

mtorqueToJtorque(jtor, mtor, jls)
   float *jtor, *mtor;
   JLS *jls;

jtorqueToMtorque(mtor, jtor, jls)
   float *mtor, *jtor;
   JLS *jls; @endcverbatim
\manSection{ARGUMENTS}
\manItem{{\tt ang} --}
Array of angle values or angle displacements (radians or mm.).
\manItem{{\tt enc} --}
Array of encoder values or encoder displacements.
\manItem{{\tt jls} --}
Pointer to {\tt JLS} structure.
\manItem{{\tt mtor} --}
Array of motor torque values (Newton-meters or Newtons).
\manItem{{\tt jtor} --}
Array of joint force values (Newton-meters or Newtons).
\manSection{DESCRIPTION}
These routines transform position, displacement (velocity), and torque
between actuator and joint coordinates for a robot described by
a {\tt JLS} structure (q.v.). They may be called from any part of an RCI
program. 

The routines make use of the
various conversion matrices specified in the {\tt JLS} structure. Although
they will work for any robot that is well-defined by the information
in {\tt JLS}, they are not particularly fast. Consequently, it is
desirable to write robot specific versions of these functions
that live in the structure
(this has been done for the PUMA robot).
Such routines should conform to the interface described here.

{\tt encoderToAngle()} translates encoder values to joint angles,
subtracting the offset values described in the {\tt encOffset} field
of the {\tt JLS} structure, and then multiplying by
the conversion factors in the {\tt enctoang} matrix.

{\tt angleToEncoder()} translates angle values to encoder values, 
multiplying by 
the conversion factors in the {\tt angtoenc} matrix of the {\tt JLS}
structure, and then adding the offsets described in the {\tt encOffset} field.

{\tt encoderToJoint()} translates encoder displacements to angle
displacements, multiplying by conversion factors in the {\tt enctoang} matrix
of the {\tt JLS} structure.

{\tt jointToEncoder()} translates angle displacements to encoder
displacements, multiplying by the conversion factors in the {\tt angtoenc} 
matrix of the {\tt JLS} structure.

{\tt mtorqueToJtorque()} translates motor torques to joint torques,
multiplying by the gear ratios in the {\tt forGearRatios} matrix
of the {\tt JLS} structure.

{\tt jtorqueToMtorque()} translates joint torques to motor torques,
dividing by the gear ratios in the {\tt forGearRatios} matrix
of the {\tt JLS} structure.

A note relating to the implementation of the routines:
The above mentioned matrix fields are stored
in a compact form consisting of a list of
the diagonal elements, followed the non-zero off-diagonal terms arranged
in row-column order. The number of off-diagonal (coupling) terms, and
the indices corresponding to them, are described by other fields in
the {\tt JLS} structure.
\manSection{SEE ALSO}
{\tt getJls(3)}, {\tt JLS(3)}.
\manEnd
\end
