NXT Programming


Lesson 10

In this lab session we will investigate how a behavior-based architecture, [1], has been implemented in the subsumption API of leJOS NXJ. Especially, we will investigate the interface lejos.subsumption.Behavior and the class lejos.subsumption.Arbitrator and try to make an alternative implementation of the Arbitrator.

BumperCar

As an example of a behavior-based control program the leJOS NXJ distribution contains a BumperCar program in the folder samples/BumperCar. It consists of two behaviors DriveForward and DetectWall both implementing the interface Behavior and a main program BumperCar that uses an instance of the class Arbitrator to control the activation of the two behaviors. First, make BumperCar run on an NXT.

Then make the following experiments with the BumperCar to investigate the functions of the Arbitrator:

Motivation Functions

When the DetectWall behavior is active another hit on the touch sensor will not reactivate the action sequence in the method action. It makes of cause no sense to reactivate action as long as touch is pressed but what if it is pressed again while it is turning ? Lets consider how Thiemo Krink's motivation functions, [2], can be used to make such a reaktivation possible. Describe how takeControl could return a motivation value. e.g. an integer value. The behavior with the highest value is then activated each time through the loop in the Arbitrator. How could takeControl be programmed to give high values when touch is pressed and lower values when it is ok to reactivate the action method ?

References


Last update: 15-11-09