Class LichtKommandos

java.lang.Object
  extended by LichtKommandos
All Implemented Interfaces:
Behavior

public class LichtKommandos
extends java.lang.Object
implements Behavior

Abhängig von den Sensoren, die den Ball sehen und dem Winkel, den der Roboter zum Spielfeld steht, behandelt der Roboter in dieser Klasse unterschiedliche Aktionen, mit dem Ball umzugehen. Steht der Roboter mit dem Rücken zum gegnerischen Tor, müssen wir einen größeren Bogen um den Ball machen. Dazu dreht er sich ein Stück und fährt eine gewisse Zeit geradeaus, dann wird der Ball wieder gesucht. Wiederholt ergibt sich daraus eine Bogenfahrt um den Ball. Steht der Roboter dagegen schon einigermaßen in die richtige Richtung, so drhen wir uns nicht ganz so weit. Schaut der Roboter schon gut auf das Tor (isNorthern), dann fahren wir einfach drauf zu und schießen. Auf welcher Seite der Roboter um den Ball herum fährt, hängt vom Lichtsensor ab, der den Ball sieht, und von der letzten Seite, um die der Roboter um den Ball herumgefahren ist. Dabei greift er auf die Nachrichten zurück, die der andere RCX geschickt hat, da dieser die Lichtsensoren besitzt. Die Klasse implementiert ebenfalls Behaviour und wird so von Arbitrator kontrolliert.

Author:
Franz Steinmetz

Constructor Summary
LichtKommandos()
           
 
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()
          Das Behaviour möchte die Kontrolle, sobald der Ball in Sicht ist
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LichtKommandos

public LichtKommandos()
Method Detail

action

public void action()
Description copied from interface: Behavior
The code in action() represents the actual action of the robot when this behavior becomes active. It can be as complex as navigating around a room, or as simple as playing a tune.
The contract for implementing this method is:
Any action can be started in this method. This method should not start a never ending loop. This method can return on its own, or when the suppress() method is called; but it must return eventually. The action can run in a seperate thread if the designer wishes it, and can therefore continue running after this method call returns.

Specified by:
action in interface Behavior

suppress

public void suppress()
Description copied from interface: Behavior
The code in suppress() should stop the current behavior. This can include stopping motors, or even calling methods to update internal data (such as navigational coordinates).
The contract for implementing this method is:
This method will stop the action running in this Behavior class. This method will not return until that action has been stopped. It is acceptable for a delay to occur while the action() method finishes up.

Specified by:
suppress in interface Behavior

takeControl

public boolean takeControl()
Das Behaviour möchte die Kontrolle, sobald der Ball in Sicht ist

Specified by:
takeControl in interface Behavior
Returns:
boolean Indicates if this Behavior should seize control.