gReflexes.leafIndex

Overview

The gReflexes.leaf file is a source file for reflexes used in Garcia.  In a Garcia, reflexes perform simple tasks such as dual-processor resets and sensor or status updates.

Reflexes can be triggered by the user by issuing a cmdRAW_INPUT command with an appropriate reflex ID and input parameter.

Moto 1.0 Reflexes

A table of the reflexes specific to a Garcia's Moto 1.0 module along with reflex descriptions is given below.

Moto Reflex Vector ID Description
aGARCIA_MOTO_RFLX_RAMP 125 Upon completion of a ramp motion, writes a 1 to the aGARCIA_MOTO_PADB_MOVEDONE control byte.  The built-in trapezoidal ramp algorithm in the Moto processor uses this reflex to signal TEA programs that a ramp motion has completed.
aMoto_RFX_BOOT 127 Will launch the user process in file slot aGARCIA_MOTO_FILE_USER as TEA process aGARCIA_MOTO_PID_USER. (Currently unused.)
aGARCIA_MOTO_RFLX_LED 124 Writes input parameter to user LED and updates aGARCIA_MOTO_PADB_MIRRORIO control byte with new state of user LED.

GP 2.0 Reflexes

Tables of the reflexes specific to a Garcia's GP 2.0 module along with reflex descriptions are provided below.

GP Reflex Vector ID Description
gp_vecIRRX4 19 Upon reception of an IR command, writes received data to aGARCIA_MOTO_CTR_IRRX in Moto module.
(Reflex Timer 1) 25 Used by the dual reset reflex.
(Reflex Timer 2) 26 Used by the dual reset reflex.
gp_vecDUALRESET 100 Resets Moto, waits 2 seconds, sets Moto to internal heartbeat, waits 0.1 seconds, resets self.  This is a safe way to reset both processors with one command.  From the Console, a user can enter 2 38 100 0 to reset the robot.
gp_vecDUALKILL 101 Kills monitor processes in both GP and Moto.
gp_vecDUMPVER 99 Dumps debug packet with "dumpfile" (TEAware) build number.  Build number is defined in aGarciaDefs.tea.

Starting with Build 23, the GP 2.0 module has some additional reflexes for controlling the front, side, rear, and downward-looking sensor pair enabler circuits.  When a sensor reading is requested and the appropriate sensor pair is enabled, a reading can be taken immediately from the sensor and returned to the API.  If the appropriate sensor pair is disabled, the sensor pair must be enabled.  The enabler circuits need some time to turn on completely.  Therefore a delay is necessary before reading a sensor if its enabler has just been activated.  Reflexes handle all this low-level logic.  If a sensor is enabled, a reflex returns the reading immediately.  If a sensor is disabled, a reflex enables it, starts a timer, then returns the reading after the timer expires.  In older TEAware, the API had to do all this work and that required extra communication on the link.  This new reflex approach keeps the link traffic to a minimum: one command and one reply.

In order for these reflexes to work, the gMonitorGP.tea program modifies a reflex enabler dedicated to each of the four sensor pairs.  The vector referenced by each reflex enabler is changed depending on whether the enabler circuit is turned on or off.  To get a sensor reading, the API issues a cmdRFLXE_CHK command that checks a reflex enabler and passes a unique sensor ID to the reflex.  If the sensor enabler circuit must be turned on, the ID for the sensor must be stashed in the scratch pad.  Then a timer is set.  After the timer expires, the stashed ID is retrieved and used to get a reading from the appropriate sensor.  If the sensor enabler circuit is already on, a different reflex is triggered which immediately takes the sensor reading.

GP Reflex Vector ID Description
gp_vecENA0_ON 110 Triggered when reflex enabler 0 is checked and the side sensor enabler is currently on.  This reflex gets a reading from one of the side sensors based on the stashed ID.
gp_vecENA0_OFF 111 Triggered when reflex enabler 0 is checked and the side sensor enabler is currently off.  This reflex turns on the enabler, stashes the input parameter ID byte, and sets a timer that gives the sensor and enabler circuit time to initialize.
gp_vecENA1_ON 112 Triggered when reflex enabler 1 is checked and the front sensor enabler is currently on.  This reflex gets a reading from one of the front sensors based on the stashed ID.
gp_vecENA1_OFF 113 Triggered when reflex enabler 1 is checked and the front sensor enabler circuit is currently off.  This reflex turns on the circuit, stashes the input parameter ID byte, and sets a timer that gives the sensor and enabler circuit time to initialize.
gp_vecENA2_ON 114 Triggered when reflex enabler 2 is checked and the rear sensor enabler is currently on.  This reflex gets a reading from one of the rear sensors based on the stashed ID.
gp_vecENA2_OFF 115 Triggered when reflex enabler 2 is checked and the rear sensor enabler cirucit is currently off.  This reflex turns on the circuit, stashes the input parameter ID byte, and sets a timer that gives the sensor and enabler circuit time to initialize.
gp_vecENA3_ON 116 Triggered when reflex enabler 3 is checked and the down sensor enabler is currently on.  This reflex gets a reading from one of the down sensors based on the stashed ID.
gp_vecENA3_OFF 117 Triggered when reflex enabler 3 is checked and the down sensor enabler circuit is currently off.  This reflex turns on the circuit, stashes the input parameter ID byte, and sets a timer that gives the sensor and enabler circuit time to initialize.

GP Reflex Vector ID Description
gp_vecENA_DELAY 44 Triggered when sensor enabler delay timer has expired.  Launches reflex that returns sensor reading based on stashed index.
gp_vecRD_FRONT_LEFT 64 Reads front left ranger and returns value to host.
gp_vecRD_FRONT_RIGHT 65 Reads front right ranger and returns value to host.
gp_vecRD_SIDE_LEFT 66 Reads side left ranger and returns value to host.
gp_vecRD_SIDE_RIGHT 67 Reads side right ranger and returns value to host.
gp_vecRD_REAR_LEFT 68 Reads rear left ranger and returns value to host.
gp_vecRD_REAR_RIGHT 69 Reads rear right ranger and returns value to host.
gp_vecRD_DOWN_RIGHT 74 Reads down right sensor and returns value to host.
gp_vecRD_DOWN_LEFT 79 Reads down left sensor and returns value to host.
gp_vecRD 80 Triggers read of one of the 8 sensors based on input parameter.

version: 1.0, build n.a.
© Copyright 1994-2012 Acroname, Inc., Boulder, Colorado.  All rights reserved.