summaryrefslogtreecommitdiffhomepage
path: root/digital/io/src/filterbridge.fsm
blob: 13027069d893880dcfe6d43202c7671ea8f8262a (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
62
63
64
65
66
67
68
69
70
# Filter Bridge FSM
# Filter column element (our colour -> go to lift, !our colour -> EJECT)
filterbridge

States:
 IDLE
  waiting the lift is ready to accept new puck
 WAIT_A_PUCK
  waiting for a new puck
 WAIT_RGB_PROBE
  waiting for RGB probe the first puck
 EJECT_PUCK
  eject a bad puck
 RETURN_NORMAL_POS
  move the bridge to his normal position
 OPEN_DOOR
  release puck to the lift and block a new puck on pos1
 CLOSE_DOOR
  release pos1 puck and close access to the lift

Events:
 lift_ready
  lift ready to accept new puck
 puck_on_pos2
  a puck has been detected on bridge's position 2
 no_puck_on_pos2
  there is no puck on position 2
 bridge_in_position
  bridge is in his normal position
 door_opened
  puck 1 blocked and puck 2 release to the lift
 ejection_done
  the ejection procedure is completed
 color_probed
  the result of the investigation will be revealed (suspens!!)
 door_closed
  ready to test a new puck


IDLE:
 lift_ready -> WAIT_A_PUCK
  the lift is ready to get pucks, we can begin testing procedure

WAIT_A_PUCK:
 puck_on_pos2: too_much_puck -> EJECT_PUCK
  we have too much puck, eject the puck quickly and whistle
 puck_on_pos2: nb_puck_ok -> WAIT_RGB_PROBE
  probe color of the new puck

WAIT_RGB_PROBE:
 color_probed: bad_color -> EJECT_PUCK
  eject bad puck
 color_probed: good_color -> OPEN_DOOR
  put puck to the lift

EJECT_PUCK:
 ejection_done -> RETURN_NORMAL_POS
  put bridge on normal position after puck ejection

RETURN_NORMAL_POS:
 bridge_in_position -> CLOSE_DOOR
  make bridge ready to test a new puck

OPEN_DOOR:
 no_puck_on_pos2 -> CLOSE_DOOR
  release puck to the lift

CLOSE_DOOR:
 door_closed -> IDLE
  filter bridge ready