1   import interfaces.Controller;
2   import interfaces.AbstractRobot;
3   
4   import java.lang.*;
5   
6   /**
7   * A simple example behaviour - used for testing, debugging etc,
8   *
9   * @author Graham Ritchie
10  */
11  public class SimpleBehaviour extends Controller
12  {
13      private AbstractRobot robot;
14      private boolean running;
15  
16      private int[] sensors={Controller.SENSOR_TYPE_TOUCH,Controller.SENSOR_TYPE_TOUCH,Controller.SENSOR_TYPE_TOUCH};
17      
18      public void initController(AbstractRobot r)
19      {
20          robot=r;
21      }
22      
23      public AbstractRobot getRobot()
24      {
25          return robot;
26      }
27      
28      public int[] getSensors()
29      {
30          return sensors;
31      }
32      
33      public void run()
34      {
35          running=true;
36          go();
37      }
38      
39      public void halt()
40      {
41          // stops the robot
42          running=false;
43      }
44      
45      /**
46      * Control method - just moves the robot around a bit
47      */
48      public void go()
49      {
50          robot.right(4500);
51          
52          robot.forward(12000);
53          
54          robot.backward(12000);
55      }
56  }   
57