Software: Behavior Control

The control system is event based, and the behavior of the vehicle is determined by reactions to events. The system groups sets of event handlers into objects called behaviors. A behavior is simply an object with arbitrary internal state that handles events generated by the system. The following events are generated:
enter The enter event is generated when a behavior object is first activated by the control system. The behavior typically handles the enter event by performing any necessary one-time initialization. This event includes information about the state of the vehicle and the current time.
think The think event is generated periodically (typically ten times a second) by the system. This event can be used to trigger any periodic, continuous, or time-sensitive aspects of a behavior. This event include information about the state of the vehicle and the current time.
leave The leave event occurs when a behavior has finished its operation and is being deactivated. Including the same information as the enter and think events, this allows the behavior to free any resources it has acquired.
frame The frame event is generated by an active camera component upon receiving an image frame from the camera device. The image and a handle to the camera is passed to the behavior's event handler. The frame handler is used to initiate vision processing on the captured frame.
ping The ping event is generated by the acoustics component and notifies the active behavior that a ping has been detected. The event includes information about where the acoustics hardware believes the pinger is.

Consider, as an example, a Waypoint behavior. This might handle events as follows:
enterThe Waypoint behavior would handle this event by requesting the target waypoint through the propulsion component interface.
thinkHere the behavior would check whether the robot is close enough to its target. If so, the behavior would notify the system that it is done (triggering the leave event). The behavior might also check whether a specified time limit has expired and leave due to timeout if that is the case.

Behaviors can be implemented in compiled C++ or in interpreted code via the scripting engine.


Software System:
Design | Platform | Sensors | Propulsion/Navigation | Behavior | Scripting Engine | Vision Processing