|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface Behavior
The Behavior interface represents an object embodying a specific
behavior belonging to a robot. Each behavior must define three things:
1) The circumstances to make this behavior seize control of the robot.
e.g. When the touch sensor determines the robot has collided with an object.
2) The action to exhibit when this behavior takes control.
e.g. Back up and turn.
3) The actions to perform when another behavior has seized control from this
behavior.
e.g. Stop the current movement and update coordinates.
These are represented by defining the methods takeControl(), action(),
and suppress() respectively.
A behavior control system has one or more Behavior objects. When you have defined
these objects, create an array of them and use that array to initialize an
Arbitrator object.
Arbitrator
Method Summary | |
---|---|
void |
action()
The code in action() represents the actual action of the robot when this behavior becomes active. |
void |
suppress()
The code in suppress() should stop the current behavior. |
boolean |
takeControl()
Returns a boolean to indicate if this behavior should seize control of the robot. |
Method Detail |
---|
boolean takeControl()
void action()
void suppress()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |