Stall SensingIndex

Garcia Stall Sensing Basics

Garcia detects stalls by comparing the encoder input to its PID loops with the desired setpoints.  If the inputs are not tracking the setpoints within a reasonable error limit, that means the PID loops are having difficulty maintaining the desired setpoints.

The gMonitorMoto.tea file contains the source code for stall sensing as well as other robot monitoring code.  Default constants for stall sensing parameters are located in the gCommon.tea file.

Stall Conditions and Stall Errors.

A PID input value that differs significantly from the PID setpoint indicates a stall condition .  The monitor loop running on the Moto processor continually checks for stall conditions by calculating the absolute difference between the PID input and PID setpoint and comparing this term to a threshold.  A value above the threshold indicates a stall condition.  The stall-threshold property of the API provides access to the stall threshold.  Values for this property are in units of encoder ticks per PID interval.  Fluctuations of +-1 between the PID input and PID setpoint are normal at low speeds.  The fluctuations may increase at higher speeds.  The default threshold is 2.

When the monitor detects several consecutive stall conditions, it signals a stall error .  A stall error can force a primitive to terminate.  Stall conditions are tracked in a bit queue.  The size of the queue determines the number of stall conditions that must be detected before a stall error occurs.  Internally, the queue size is stored as a bit mask.  The number of low bits set in the mask determine queue size.  The current value is 0x00FF.  This value has 8 bits which corresponds to a stall condition flag queue of 8 entries.  So 8 stall conditions must occur before a stall error occurs.  Changing this mask to 0x007F would make a bit queue of 7 entries.  Then 7 stall conditions would occur before a stall error would occur.  The bit queue is stored as a 2-byte int so the maximum number of stall conditions that can be queued is 16.  The stall-queue-size property of the API allows a user to set the size of the queue.  Instead of calculating a mask value, the user may specify the queue size as an integer from 1 to 16.  The API will generate a proper mask value.

Internally, speed is also specified as encoder ticks per PID interval.  If the stall threshold is set above the desired speed, stall sensing will no longer be possible because the stall calculation will never exceed the threshold.  A larger stall threshold may be necessary to accommodate behaviors where frequent speed changes are normal, such as in a wall-hug.  Frequent speed changes will increase the fluctuations between the PID input and PID setpoint.

Stall Load

The high quality h-bridges in the Garcia robot provide a linear relationship between a desired motor speed and the PWM setting needed to reach the desired motor speed.  Before executing a maneuver, the robot calculates how much PWM output it will need to move at a desired speed.  It adds some excess to account for friction.  The "load" constant is related to how much work the robot must do to keep its wheels spinning.  A load of 1 is the case where the robot's wheels spin freely in air without any resistance, as when the robot is mounted up on a block for testing.  Adding any resistance with a load of 1 will make the robot stall.  A load of 2 gives the robot twice as much power as necessary to get a desired speed.  This is usually enough to get the robot to move around on smooth surfaces.  A load of 3 may be required for rougher surfaces or when the robot must push against objects, as when it backs into a dock.  If there is no load limit, the robot can apply maximum power to its wheels.  With no limit to its output power, the robot might spin its wheels and never stall even if the robot is jammed in a corner.  Therefore the load limit is necessary for effective stall sensing.

Stall load constants are hard-coded in the primitives.  The default value for the stall load constant is 2 for most primitives.  The docking primitive uses a value of 3 which seemed to work better in testing.

Stall Sensing Initialization

The TEA programs that execute primitives initialize some stall constants prior to performing any motions.  Changing hard-coded stall sensing parameters in the primitives requires changing the constants and then recompiling the TEAware for the robot.


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