|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
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 perform when this behavior takes control.
e.g. Back up and turn.
3) The tasks to perform when another behavior has seized control from this
behavior, including interrupting it. S
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 tasks the robot performs when this behavior becomes active. |
void |
suppress()
The code in suppress() should stop the current behavior. |
boolean |
takeControl()
The boolean return indicates if this behavior should seize control of the robot. |
Method Detail |
---|
boolean takeControl()
void action()
void suppress()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |