summaryrefslogtreecommitdiff
path: root/digital/io/src/top.fsm
blob: 3e1fb456c1124aae11b17472bca703487dff9e26 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
# Top FSM.
# Some remarks on this FSM.
# Maybe we can make only one state for the all the GO_TO_*DISTRIBUTOR. It is
# more complicated, but it can be cleaner...
# We do not manage some cases like, we have not get any balls from any
# distributors.
top
  Top FSM with the Marcel's strategy

States:
 IDLE
  waiting for the beginning of the top FSM
 WAIT_JACK_IN
  waiting for the jack to be inserted into the bot
 WAIT_JACK_OUT
  waiting for the jack to be removed from the bot
 CONFIGURE_ASSERV
  configuring the asserv board
 MOVE_FORWARD
  move forward
 MOVE_BACKWARD
  move backward

Events:
 start
  initialize the FSM
 move_fsm_finished
  when the move FSM returns
 jack_inserted_into_bot
  the jack is inserted into the bot
 jack_removed_from_bot
  the jack is removed from the bot
 settings_acknowledged
  the asserv board has acknowledged the settings sent
 state_timeout

IDLE:
 start -> WAIT_JACK_IN
  wait for the jack to be inserted into the bot

WAIT_JACK_IN:
 jack_inserted_into_bot -> WAIT_JACK_OUT
  wait for the jack to be removed from the bot

WAIT_JACK_OUT:
 jack_removed_from_bot -> CONFIGURE_ASSERV
  the match start, start the chronometer
  we should also initialize all the subsystems of IO (get our color, ...)
  set the settings of the asserv board (especially the position)

CONFIGURE_ASSERV:
 settings_acknowledged -> MOVE_FORWARD
  move the bot forward

MOVE_FORWARD:
 move_fsm_finished -> MOVE_BACKWARD
  return to initial position (yep it's useless but it's for test)

MOVE_BACKWARD:
 move_fsm_finished -> MOVE_FORWARD
  move forward again