\input manualMacros.tex
\manBegin
\manPageInfo{RCI Reference Manual}{}{}
\manTitle{SET TORQUE READ}{3}
\manSection{NAME}
\tolerance = 400
{\raggedright
{\tt \manName{SET_TORQUE_READ}},
{\tt \manName{SET_POT_READ}},
{\tt \manName{SET_PENDANT_READ}},
{\tt \manName{SET_\-FORCE_\-READ}},
{\tt \manName{SET_\-JSTICK_\-READ}},
{\tt \manName{SET_\-ADC_\-CHAN}},
{\tt \manName{SET_\-SLU_\-CHAN}}
-- RCI {\it CHG} macros to enable I/O from different devices.

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

SET_TORQUE_READ(rbt, val)
   RCI_RBT *rbt;
   int val;

SET_POT_READ(rbt, val)
   RCI_RBT *rbt;
   int val;

SET_PENDANT_READ(rbt, val)
   RCI_RBT *rbt;
   int val;

SET_FORCE_READ(rbt, val)
   RCI_RBT *rbt;
   int val;

SET_JSTICK_READ(rbt, val)
   RCI_RBT *rbt;
   int val;

SET_ADC_CHAN(rbt, mask)
   RCI_RBT *rbt;
   unsigned long mask;

SET_SLU_CHAN(rbt, mask)
   RCI_RBT *rbt;
   unsigned long mask;  @endcverbatim
\manSection{ARGUMENTS}
\manItem{{\tt rbt} --}
Pointer to RCI robot structure.
\manItem{{\tt val} --}
Boolean value: enables if non-zero, disables if zero.
\manItem{{\tt mask} --}
Bitmask describing which channels to enable.
\manSection{DESCRIPTION}
These macros enable or disable the reading of different types of sensor
information from the robot controller
into the {\tt HOW} structure. 
They may be called from any part of an RCI program.

Not all of the I/O features may be
available. Values set in the {\tt options}, {\tt numAdc}, and
{\tt numSlu} fields of the {\tt HOW} structure when the task is
first started indicate what features are available and how many 
ADC and DAC channels the controller has. Information being read into
the {\tt HOW} structure is gathered from the robot controller and
updated once every control cycle.

{\tt SET_TORQUE_READ()} enables or disables the reading of 
torque information from the robot. This data is read into the
{\tt mtorque} and {\tt jtorque} fields of the {\tt HOW} structure.
The feature is available if {\tt TORQUE_AVAIL} is set in the
{\tt options} field.
The {\tt torqueOK} field will
be set true during each cycle for which a read was successful and
{\tt mtorque} and {\tt jtorque} contain valid data.

{\tt SET_POT_READ()} enables or disables the reading of the
robot potentiometers into the {\tt potInput} field of the
{\tt HOW} structure. Potentiometer readings are used on some
robots for calibration: they provide a rough measure of the robot's
position so that the position may then be determined exactly 
by seeking reference marks on the shaft encoders.
The feature is available if {\tt POTS_AVAIL} is set in the
{\tt options} field.
The {\tt potOK} field will
be set true during each cycle for which a read was successful and
{\tt potInput} contains valid data.

{\tt SET_PENDANT_READ()} enables information to be read back from
the robot teach pendant into the {\tt pendantInput} field of the 
{\tt HOW} structure. This usual function of this field is to act as
a bit map of of the buttons on the teach pendant, where a bit is set
if a particular button is pressed. 
The feature is available if {\tt PENDANT_AVAIL} is set in the
{\tt options} field.
The {\tt pendantOK} field will
be set true during each cycle for which a read was successful and
{\tt pendantInput} contains valid data.

{\tt SET_FORCE_READ()} enables information to be read back from
a six degree of freedom force sensor into the {\tt forceInput}
field of the {\tt HOW} structure.
The feature is available if {\tt FORCE_AVAIL} is set in the
{\tt options} field.
The {\tt forceOK} field will
be set true during each cycle for which a read was successful and
{\tt forceInput} contains valid data.

{\tt SET_JSTICK_READ()} enables information to be read back from
a six degree of joystick into the {\tt jstickInput}
field of the {\tt HOW} structure.
The feature is available if {\tt JSTICK_AVAIL} is set in the
{\tt options} field.
The {\tt jstickOK} field will
be set true during each cycle for which a read was successful and
{\tt jstickInput} contains valid data.

{\tt SET_ADC_CHAN()} enables the ADC channels specified by the bitmask 
{\tt mask} to be read back into the {\tt adcInput} field of the {\tt HOW}
structure. The total number of ADC channels available is defined in the
{\tt numAdc} field. 
Bit 0 corresponds to channel 0, bit 1 corresponds to channel 1, etc.
Bit settings for non-existent channels are ignored.
The value set by {\tt mask} can be read back in the {\tt adc} field.

{\tt SET_SLU_CHAN()} enables the serial line units specified by 
the bitmask {\tt mask}
to be read back into the {\tt sluInput} field of the {\tt HOW} structure.
The total number of SLUs available is defined in the
{\tt numSlu} field. 
Bit 0 corresponds to channel 0, bit 1 corresponds to channel 1, etc.
Bit settings for non-existent units are ignored.
The value set by {\tt mask} can be read back in the {\tt slu} field.

Serial line unit information consists of the bytes that were read from 
the unit during the previous cycle. This packet is stored in an
{\tt SLU} data structure, which contains a buffer whose maximum size
is {\tt HOW_SLUBUF}, and a count of the number of bytes read. Information
in the {\tt SLU} is replaced every control cycle, so it is up to the
control functions to retrieve the information while they can.
\manSection{DIAGNOSTICS}
Failures will result in an abort condition. Defined abort codes include:

\manItem{{\tt ECount} --}
A bad count (negative or larger than {\tt HOW_SLUBUF}) was received by
a serial line unit.
\manSection{SEE ALSO}
\raggedright
{\tt CHG(3)}, {\tt HOW(3)}.
\manEnd
\end
