aGarciaDefs.teaIndex

Overview

The aGarciaDefs.tea file contains constants used in both the TEA programs loaded into the Garcia robot and the Garcia API running on a host computer.  This file is located in the aSystem subfolder of the main brainstem directory.

Constants are declared with #define statements.  The #define statement and comment styles are identical in both TEA and C/C++ so this file is used when compiling code in both languages.  The values are subject to change without warning.  Only the defined names should be used to access the constants.  Some of the constants are only used in TEA programs while others are only used in Garcia API routines.

Naming Conventions

Names for constants begin with aGARCIA_ .  Next comes the module label associated with the constant, either MOTO_ or GP_ .  Additional labels are appended after the module label and may be separated with underscores.

A few other conventions are used in the constant names.  A PADB_ label indicates the location of a single-byte value stored in the scratch pad.  A PADS_ label indicates the starting location of a two-byte value stored in the scratch pad.  After the module label, a constant for an analog input will have a label starting with A and a constant for a digital IO will have a label starting with D .  The PID_ label indicates a TEA process ID (not to be confused with PID motion control values).  The FILE_ label indicates a TEA file slot.

NOTE:The following sections correspond to sections labeled with comments in the aGarciaDefs.tea file.

Unit Constants

These constants define codes for selecting distance and angle measurement units.

Constant Name Usage Description
aGARCIA_DISTANCE_METERS code Code that tells API to use meters for all distance measurements.
aGARCIA_DISTANCE_FEET code Code that tells API to use feet for all distance measurements.
aGARCIA_DISTANCE_FEET code Code that tells API to use inches for all distance measurements.
aGARCIA_ANGLE_RADIANS code Code that tells API to use radians for all angle measurements.
aGARCIA_ANGLE_DEGREES code Code that tells API to use degrees for all angle measurements.
aGARCIA_PID_PERIOD scaling factor Period in 10ths of milliseconds for PID calculation loop.
aGARCIA_MAX_VELOCITY scaling factor Maximum possible encoder ticks per one aGARCIA_PID_PERIOD
interval under no-load conditions.

Drive Train Constants

The comments in this section describe the calculations and nominal values for calculating the relationships between encoder ticks and units of rotational or straight motion.  The defined values are scaling factors for a typical robot.  Small improvements in motion accuracy may be gained by fine-tuning these values, but this is not recommended.

Constant Name Usage Description
aGARCIA_TICKS_PER_METER scaling factor Number of encoder ticks processed when Garcia moves straight 1 meter.
aGARCIA_TICKS_PER_FOOT scaling factor Number of encoder ticks processed when Garcia moves straight 1 foot.
aGARCIA_TICKS_PER_RADIAN scaling factor Number of encoder ticks processed when one wheel turns 1 radian.
aGARCIA_TICKS_PER_DEGREE scaling factor Number of encoder ticks processed when one wheel turns 1 degree.
aGARCIA_TICKS_PER_360DEGREES scaling factor Number of encoder ticks processed when the robot drives both wheels in opposite directions
and rotates about its center axis by 360 degrees.

Error Values

These are the codes that may be returned by a primitive when it terminates execution.

Constant Name Usage Description
aGARCIA_ERRFLAG_NORMAL code Terminated without error.
aGARCIA_ERRFLAG_STALL code Detected stall.
aGARCIA_ERRFLAG_FRONTR_LEFT code The reading from the front left ranger exceeded the 2-byte threshold stored at scratch pad location aGARCIA_MOTO_PADS_FRONTTHR.
aGARCIA_ERRFLAG_FRONTR_RIGHT code The reading from the front right ranger exceeded the 2-byte threshold stored at scratch pad location aGARCIA_MOTO_PADS_FRONTTHR.
aGARCIA_ERRFLAG_REARR_LEFT code The reading from the rear left ranger exceeded the 2-byte threshold stored in counter aGARCIA_GP_CTR_REARTHR.
aGARCIA_ERRFLAG_REARR_RIGHT code The reading from the rear right ranger exceeded the 2-byte threshold stored in counter aGARCIA_GP_CTR_REARTHR.
aGARCIA_ERRFLAG_SIDER_LEFT code The reading from the side left ranger exceeded the 2-byte threshold stored at scratch pad location aGARCIA_MOTO_PADS_SIDETHR.
aGARCIA_ERRFLAG_SIDER_RIGHT code The reading from the side right ranger exceeded the 2-byte threshold stored at scratch pad location aGARCIA_MOTO_PADS_SIDETHR.
aGARCIA_ERRFLAG_FALL_LEFT code Robot experienced a loss of detection from the left downward-looking proximity detector.
aGARCIA_ERRFLAG_FALL_RIGHT code Robot experienced a loss of detection from the right downward-looking proximity detector.
aGARCIA_ERRFLAG_ABORT code Primitive was forced to terminate by user.
aGARCIA_ERRFLAG_ABORT code Primitive was forced to terminate by user.
aGARCIA_ERRFLAG_NOTEXECUTED code Primitive is awaiting execution.  This code is only generated by an application using the Garcia API.  It is defined for completeness, but is seldom used in practice.
aGARCIA_ERRFLAG_WONTEXECUTE code Primitive was queued for execution but error in previously queued primitive will prevent primitive from being executed.  This code is only generated by an application using the Garcia API.
aGARCIA_ERRFLAG_BATT code Low battery condition was detected during execution.
aGARCIA_ERRFLAG_IRRX code IR command was received during execution.

Rear Sensor Control Flags

These are flags that control the operation of the rear sensor checking routine in the gMonitorGP program that runs on the GP 2.0 processor.  These flags may be ORed together and written to the aGARCIA_GP_PADB_REARCTRL scratch pad byte.

Constant Name Usage Description
aGARCIA_REARCTRL_DOCK bit flag Setting this flag will enable generation of an error when both rear sensors exceed the threshold.
aGARCIA_REARCTRL_LEFT bit flag Setting this flag will enable generation of an error when the left rear sensor exceeds a threshold.
aGARCIA_REARCTRL_RIGHT bit flag Setting this flag will enable generation of an error when the right rear sensor exceeds a threshold.
aGARCIA_REARCTRL_INV bit flag Setting this flag inverts the result of the rear sensor check.
aGARCIA_REARCTRL_MASK mask This mask value has all the rear control bit flags set.

Motion Termination Flags

These are flags that determine what sensors may terminate execution of a primitive.  Range finders may terminate a primitive when they pass a threshold.  These flags may be ORed together and written to the aGARCIA_MOTO_PADB_ENDFLAGS scratch pad byte.

Constant Name Usage Description
aGARCIA_ENDCTRL_FRONT bit flag Setting this flag will enable generation of an error when either front sensor exceeds a threshold.
aGARCIA_ENDCTRL_REAR bit flag Setting this flag will enable generation of an error when the rear sensors detect a condition defined by the Rear Sensor Control Flags.
aGARCIA_ENDCTRL_SIDE bit flag Setting this flag will enable generation of an error when either side sensor exceeds a threshold.
aGARCIA_ENDCTRL_IRRX bit flag Setting this flag will enable generation of an error when the robot receives an IR command.

Execution Control Flags

These are flags that define user-controlled conditions for terminating a primitive.  These flags may be ORed together and written to the aGARCIA_MOTO_PADB_EXEFLAGS scratch pad byte.

Constant Name Usage Description
aGARCIA_EXECTRL_USER bit flag Setting this flag forces a primitive to signal the user process when the primitive completes execution.
aGARCIA_EXECTRL_IRCHK bit flag Setting this flag forces a primitive to complete execution upon reception of an IR message.
aGARCIA_EXECTRL_EDGECHK bit flag Setting this flag forces a primitive to complete execution upon loss of detection from a front-mounted edge detector.
aGARCIA_EXECTRL_STALLCHK bit flag Setting this flag enables stall error checking in the Moto monitor program.

Wallhug Modes

These codes are described in the documentation for the hug primitive.

Align Modes

These codes are described in the documentation for the align primitive.

Default Data

This is a "catch all" category for constants that may be added as needed.

Moto IO Constants

These constants identify which devices are associated with the IO pins on the Moto 1.0 processor, as well as the indexes for the left and right motor channels.

Constant Name Usage Description
aGARCIA_MOTO_ADDR index Module address (I2C address) for the Moto 1.0 processor.
aGARCIA_MOTO_MOTOR_RIGHT index Motor channel index for right motor.
aGARCIA_MOTO_MOTOR_LEFT index Motor channel index for left motor.
aGARCIA_MOTO_ARANGE_FRONT_LEFT index Analog input index for left front IR ranger.
aGARCIA_MOTO_ARANGE_FRONT_RIGHT index Analog input index for right front IR ranger.
aGARCIA_MOTO_ARANGE_SIDE_LEFT index Analog input index for left side IR ranger.
aGARCIA_MOTO_ARANGE_SIDE_RIGHT index Analog input index for right side IR ranger.
aGARCIA_MOTO_DLED_USER index Digital IO pin index for yellow user-controlled LED.
aGARCIA_MOTO_DEDGE_RIGHT index Digital IO pin index for right downward-looking proximity detector.
aGARCIA_MOTO_DEDGE_LEFT index Digital IO pin index for left downward-looking proximity detector.

Moto Shared Data

These constants identify locations of scratch pad and counter RAM in the Moto 1.0 processor that are reserved for system data.

Constant Name Usage Description
aGARCIA_MOTO_PADS_STATUS index Two-byte status value.  Holds result of primitive execution
aGARCIA_MOTO_PADB_MOVEDONE index Index of flag byte that indicates completion of ramp motion.
aGARCIA_MOTO_PADB_ENDFLAGS index Index of flag byte that stores conditions to check for completion of a primitive.
aGARCIA_MOTO_PADB_GPSTAT index Index of byte that holds status of last operation performed in the GP 2.0 processor.
aGARCIA_MOTO_PADB_EXEFLAGS index Index of byte with user-controlled execution flags.
aGARCIA_MOTO_PADB_MONENABLE index Index of flag byte for enabling monitor.
aGARCIA_MOTO_PADB_MIRRORIO index Index of byte that holds state of user LED.
aGARCIA_MOTO_PADS_STALLTHR index Index of 2-byte stall condition threshold.
aGARCIA_MOTO_PADS_FRONTTHR index Index of 2-byte threshold for a front IR ranger detection.
aGARCIA_MOTO_PADS_SIDETHR index Index of 2-byte threshold for a side IR ranger detection.
aGARCIA_MOTO_PADS_DEFVEL index Index of 2-byte default velocity.
aGARCIA_MOTO_PADS_DEFACCTM index Index of 2-byte default acceleration step time.
aGARCIA_MOTO_PADS_NULL_LVEL index Index of 2-byte left motor velocity for null primtive.
aGARCIA_MOTO_PADS_NULL_RVEL index Index of 2-byte right motor velocity for null primtive.
aGARCIA_MOTO_CTR_STALLMASK index Index of 2-byte counter used to hold mask byte that determines size of the stall condition queue.
aGARCIA_MOTO_CTR_IRRX index Index of 2-byte counter used to receive IR message.
aGARCIA_MOTO_BIT_LEDUSER index Index of bit in aGARCIA_MOTO_PADB_MIRRORIO that holds state of yellow user LED.

Moto File, Process, and Reflex Assignments

These constants identify TEA file slots dedicated to primitives, which TEA process slots are assigned to the monitor, the primitives, and user programs, and reflex IDs used in the Moto processor.

Constant Name Usage Description
aGARCIA_MOTO_FILE_SWPIVOT index File slot used for the turn (single wheel pivot) primitive.
aGARCIA_MOTO_FILE_MOVE index File slot used for the move primitive.
aGARCIA_MOTO_FILE_PIVOT index File slot used for the pivot primitive.
aGARCIA_MOTO_FILE_WALLHUG index File slot used for the hug primitive.
aGARCIA_MOTO_FILE_ALIGN index File slot used for the align primitive.
aGARCIA_MOTO_FILE_DOCK index File slot used for the experimental dock primitive.
aGARCIA_MOTO_FILE_CONFIG index Unused. (File slot for obsolete config primitive.)
aGARCIA_MOTO_FILE_MONITOR index File slot used for gMonitorMoto.tea program.
aGARCIA_MOTO_FILE_DEMO index File slot used for gDemo.tea demo program.
aGARCIA_MOTO_FILE_USER index File slot used for user program (same as demo program slot).
aGARCIA_MOTO_PID_BEHAVIOR index Process ID for primitives.
aGARCIA_MOTO_PID_MONITOR index Process ID for gMonitorMoto.tea program.
aGARCIA_MOTO_PID_USER index Process ID for user/demo program.
aGARCIA_MOTO_RFLX_RAMP index Reflex ID for trapezoidal ramp completion reflex.
aGARCIA_MOTO_RFLX_LED index Reflex ID for user LED control reflex.

GP IO Constants

These constants identify which devices are associated with the IO pins on the GP 2.0 processor.

Constant Name Usage Description
aGARCIA_GP_ADDR index Module address (I2C address) for the GP 2.0 processor.
aGARCIA_GP_ARANGE_REAR_LEFT index Analog input index for left rear IR ranger.
aGARCIA_GP_ARANGE_REAR_RIGHT index Analog input index for right rear IR ranger.
aGARCIA_GP_ABATTERY index Analog input index for battery voltage monitoring.
aGARCIA_GP_ACURRENT_RMOTOR index Analog input index for right motor current sensing.
aGARCIA_GP_ACURRENT_LMOTOR index Analog input index for left motor current sensing.
aGARCIA_GP_DENABLE_SIDERNG index Digital IO pin index for enable circuit for side pair of IR rangers.
aGARCIA_GP_DENABLE_FRONTRNG index Digital IO pin index for enable circuit for front pair of IR rangers.
aGARCIA_GP_DENABLE_REARRNG index Digital IO pin index for enable circuit for rear pair of IR rangers.
aGARCIA_GP_DENABLE_DOWNRNG index Digital IO pin index for enable circuit for pair of downward-looking proximity sensors.
aGARCIA_GP_DIRCOMM_RX index Digital IO pin index for IR receiver on Garcia's head.
aGARCIA_GP_DIRCOMM_TX index Digital IO pin index for IR LED transmitter on Garcia's head.
aGARCIA_GP_DBUTTON index Digital IO pin index for push button on back of Garcia's head.
aGARCIA_GP_SERVO_PAN index Servo output index for pan control on the Garcia Boom accessory.
aGARCIA_GP_SERVO_TILT index Servo output index for tilt control on the Garcia Boom accessory.

GP Shared Data

These constants identify locations of scratch pad and counter RAM in the GP 2.0 processor that are reserved for system data.

Constant Name Usage Description
aGARCIA_GP_PADB_REARCTRL index Flag byte for controlling rear IR ranger monitoring behavior.
aGARCIA_GP_PADB_MIRRORIO index Mirrors the current state of the ranger enable circuits.  Changes written to this byte only take place after a change is written to the aGARCIA_GP_PADB_MIRRORMASK byte.
aGARCIA_GP_PADB_MIRRORMASK index Mirror control byte.  Changing this byte applies any changes previously written to the aGARCIA_GP_PADB_MIRRORIO byte.  Once change is applied, this byte is reset to 0.
aGARCIA_GP_PADB_MIRRORBUTTON index Byte that holds current state of button on Garcia's head.
aGARCIA_GP_CTR_REARTHR index Index of 2-byte counter used to store rear IR ranger threshold.
aGARCIA_GP_BIT_ENABLESIDE index Index of bit in aGARCIA_GP_PADB_MIRRORIO byte that mirrors state of enable circuit for the side pair of IR rangers.
aGARCIA_GP_BIT_ENABLEFRONT index Index of bit in aGARCIA_GP_PADB_MIRRORIO byte that mirrors state of enable circuit for the front pair of IR rangers.
aGARCIA_GP_BIT_ENABLEREAR index Index of bit in aGARCIA_GP_PADB_MIRRORIO byte that mirrors state of enable circuit for the rear pair of IR rangers.
aGARCIA_GP_BIT_ENABLEDOWN index Index of bit in aGARCIA_GP_PADB_MIRRORIO byte that mirrors state of enable circuit for the pair of downward-looking proximity sensors.

GP File, Process, and Reflex Assignments

These constants identify TEA file slots dedicated to primitives, which TEA process slots are assigned to the monitor, the primitives, and user programs, and reflex IDs used in the GP 2.0 processor.

Constant Name Usage Description
aGARCIA_GP_FILE_MONITOR index File slot used for gMonitorGP.tea program.
aGARCIA_GP_PID_MONITOR index Process ID for gMonitorGP.tea program.

version: 1.0, build 80506
© Copyright 1994-2006 Acroname, Inc., Boulder, Colorado.  All rights reserved.