summaryrefslogtreecommitdiffhomepage
path: root/digital/io/src/cylinder.fsm
blob: 09b381c31d84273fcca89f1d54d9ab43fe50a46e (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
# Cylinder FSM
# Control the puck's entrance
cylinder

States:
 IDLE
  waiting for init
 WAIT_FOR_JACK_IN
  waiting for jack
 RESET_POS
  reset the cylinder position
 INIT_POS
  initializing cylinder to a good position (open)
 WAIT_A_PUCK
  waiting a puck enter in cylinder
 TURN_PLUS_4
  turn cylinder 4 position after

Events:
 start
  start event
 jack_inserted_into_bot
  the init signal
 new_puck
  there is a puck in position 1
 move_done
  cylinder move finished
 state_timeout

IDLE:
 start -> WAIT_FOR_JACK_IN
  we wait the jack before moving anything

WAIT_FOR_JACK_IN:
 jack_inserted_into_bot -> RESET_POS
  we init the cylinder position

RESET_POS:
 move_done -> INIT_POS
  move the cylinder to open it

INIT_POS:
 move_done -> WAIT_A_PUCK
  the cylinder is ready to get pucks

WAIT_A_PUCK:
 new_puck -> TURN_PLUS_4
  turn cylinder 4 position after

TURN_PLUS_4:
 move_done -> WAIT_A_PUCK
  wait a puck again