SET TORQUE READ(3)

NAME
SET_TORQUE_READ, SET_POT_READ, SET_PENDANT_READ, SET_FORCE_READ, SET_JSTICK_READ, SET_ADC_CHAN, SET_SLU_CHAN -- RCI CHG macros to enable I/O from different devices.

USAGE
#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;

ARGUMENTS

rbt --
    Pointer to RCI robot structure.

val --
    Boolean value: enables if non-zero, disables if zero.

mask --
    Bitmask describing which channels to enable.

DESCRIPTION
These macros enable or disable the reading of different types of sensor information from the robot controller into the 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 options, numAdc, and numSlu fields of the 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 HOW structure is gathered from the robot controller and updated once every control cycle.

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

SET_POT_READ() enables or disables the reading of the robot potentiometers into the potInput field of the 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 POTS_AVAIL is set in the options field. The potOK field will be set true during each cycle for which a read was successful and potInput contains valid data.

SET_PENDANT_READ() enables information to be read back from the robot teach pendant into the pendantInput field of the 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 PENDANT_AVAIL is set in the options field. The pendantOK field will be set true during each cycle for which a read was successful and pendantInput contains valid data.

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

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

SET_ADC_CHAN() enables the ADC channels specified by the bitmask mask to be read back into the adcInput field of the HOW structure. The total number of ADC channels available is defined in the 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 mask can be read back in the adc field.

SET_SLU_CHAN() enables the serial line units specified by the bitmask mask to be read back into the sluInput field of the HOW structure. The total number of SLUs available is defined in the 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 mask can be read back in the 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 SLU data structure, which contains a buffer whose maximum size is HOW_SLUBUF, and a count of the number of bytes read. Information in the SLU is replaced every control cycle, so it is up to the control functions to retrieve the information while they can.

DIAGNOSTICS
Failures will result in an abort condition. Defined abort codes include:

ECount --
    A bad count (negative or larger than HOW_SLUBUF) was received by a serial line unit.

SEE ALSO
CHG(3), HOW(3).