dLife Home Page

dlife.robot.controllers.subsumption
Class SubsumptionController

java.lang.Object
  extended by dlife.robot.Controller
      extended by dlife.robot.controllers.subsumption.SubsumptionController

public abstract class SubsumptionController
extends Controller

Controller based upon the Subsumption Architecture.

To create a subsumption controller:

  1. Make a subclass of this class.
  2. Override the startUp method:
  3. Implement the step method to send commands to the robot based on the outputs of the behaviors. NOTE: Behaviors should not send commands directly to the robot. Instead, they generate their outputs which are ultimately interpreted by the step method which sends the commands to the robot.

The SubsumptionController maintains a key,value map for the output signals of each Behavior. The Behaviors specify their input signals by using keys that can be found in the map. Behaviors also specify the key to be used to store their output signal into the map.

Version:
Nov 29, 2010
Author:
Grant Braught, Dickinson College

Nested Class Summary
static class SubsumptionController.Signal
          Representation of a signal that is passed between behaviors.
 
Field Summary
static SubsumptionController.Signal NONE
          The value associated with keys that have no current value.
 
Constructor Summary
SubsumptionController()
           
 
Method Summary
 void addBehavior(Behavior b)
          Add the specified behavior to this SubsumptionController.
 SubsumptionController.Signal getValue(String key)
          Get a signal from the behavior output map.
 void setValue(String key, SubsumptionController.Signal signal)
          Set the signal for a key in behavior output map.
 void shutDown()
          Shutdown this SubsumptionController.
 void startUp(Robot robot)
          Resets all of the Behavior objects.
 
Methods inherited from class dlife.robot.Controller
step
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NONE

public static final SubsumptionController.Signal NONE
The value associated with keys that have no current value. This value should be returned from the step method of Behaviors that are not currently active.

Constructor Detail

SubsumptionController

public SubsumptionController()
Method Detail

getValue

public final SubsumptionController.Signal getValue(String key)
Get a signal from the behavior output map.

Parameters:
key - the key for the signal to be obtained.
Returns:
the signal associated with the key.
Throws:
UnknownKeyException - if the specified key does not exist in the map.

setValue

public final void setValue(String key,
                           SubsumptionController.Signal signal)
Set the signal for a key in behavior output map. If the key already exists in the map, its signal will be replaced by the specified signal.

Parameters:
key - the key (may be null for unused values or behaviors that have no output).
signal - the signal associated with the key.

startUp

public void startUp(Robot robot)
Resets all of the Behavior objects. For proper operation of the controller this method must be invoked the startUp method defined in any subclass.

Specified by:
startUp in class Controller
Parameters:
robot - the Robot that this Controller will be controlling.

shutDown

public void shutDown()
Shutdown this SubsumptionController. This stops all of the Behaviors. For proper behavior any subclass that overrides shutDown must invoke super.shutdown to stop the behaviors.

Overrides:
shutDown in class Controller

addBehavior

public void addBehavior(Behavior b)
Add the specified behavior to this SubsumptionController. When added an entry will be made in the behavior output map for this behavior using its output key. The default output signal for the added behavior will be NONE. NOTE: New Behaviors cannot be added between a call to startUp and a call to shutDown.

Parameters:
b - the Behavior to be added.
Throws:
DuplicateOutputKeyException - if another Behavior is already using the output key specified for the new Behavior.
IllegalStateException - if a Behavior is added to a Controller that has already been started up, but not yet shut down.

dLife Home Page