View Javadoc

1   /*
2    * To change this template, choose Tools | Templates
3    * and open the template in the editor.
4    */
5   package cz.cuni.amis.pogamut.usar2004.samples.AirScanner;
6   
7   /**
8    * List of all Robot states. Each state represents on type of behaviour
9    * associated with this state
10   *
11   * @author vejmanm
12   */
13  public enum State
14  {
15      DEFAULT,//initial - find closest corner
16      LONGFORTH,//long way
17      SHORTFORTH,//short way
18      LONGBACK,//long way backwards
19      SHORTBACK,//short as well
20      TERMINATE,//return home and end
21      LAND,//fall
22      CHARGE,//return to base
23      CHARGING,//fall down, reconfigure, wait one moment
24      AVOIDING,//reactive avoiding obstacles
25      AVOIDED,//got to the point that leaded away from an obstacle
26      CONTINUE,//Get back to the position before charge was required
27      CONTINUED;//continue in scanning
28  
29      public static State getNextState(State current)
30      {
31          switch(current)
32          {
33              case DEFAULT:
34                  return LONGFORTH;
35              case LONGFORTH:
36                  return SHORTFORTH;
37              case SHORTFORTH:
38                  return LONGBACK;
39              case LONGBACK:
40                  return SHORTBACK;
41              case SHORTBACK:
42                  return LONGFORTH;
43              case TERMINATE:
44                  return LAND;
45              case LAND:
46                  return LAND;
47              case CHARGE:
48                  return CHARGING;
49              case CHARGING:
50                  return CHARGING;
51              case CONTINUE:
52                  return CONTINUED;
53              case AVOIDING:
54                  return AVOIDED;
55              default:
56                  return DEFAULT;
57          }
58      }
59  }