public class Arbitrator
extends java.lang.Object
action()
and suppress()
methods on them.
takeControl()
. action()
method exits, call action()
on the Behavior of highest priority. action()
exits,
suppress()
on the active Behavior i.e. whose action()
method is running.
action()
on the same Behavior.
suppress()
is called, terminate action()
immediately.
action()
exits, the robot is in a safe state (e.g. motors stopped)
takeControl()
should continue to return true
go()
to start it running.
Behavior
Modifier and Type | Field and Description |
---|---|
boolean |
keepRunning |
Constructor and Description |
---|
Arbitrator(Behavior[] behaviorList)
Same as Arbitrator(behaviorList, false) Arbitrator start() never exits
|
Arbitrator(Behavior[] behaviorList,
boolean returnWhenInactive)
Allocates an Arbitrator object and initializes it with an array of
Behavior objects.
|
Modifier and Type | Method and Description |
---|---|
void |
go()
This method starts the arbitration of Behaviors and runs an endless loop.
|
void |
stop() |
public Arbitrator(Behavior[] behaviorList, boolean returnWhenInactive)
behaviorList
- an array of Behavior objects.returnWhenInactive
- if true, the go() method returns when no Behavior is active.public Arbitrator(Behavior[] behaviorList)
behaviorList
- An array of Behavior objects.public void go()
no action()
method is running and
takeControl()
returns true and
public void stop()