summaryrefslogtreecommitdiffhomepage
path: root/digital/io/src/filterbridge.fsm
blob: 5722f5e21efa2c59218bfd571917c7df55653e76 (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
# 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_JACK_IN
  waiting for the jack to be inserted into the bot
 CLOSE_DOOR[timeout=225]
  close access to the lift (and wait 1 sec)
 WAIT_A_PUCK
  waiting for a new puck
 MARCEL_WAIT[timeout=45]
  waiting the puck is entirely in pos2
 OPEN_DOOR[timeout=225]
  release puck to the lift and block a new puck on pos1
 PUSH_PUCK
  push the puck to the lift

Events:
 start
  robot start
 jack_inserted_into_bot
  jack into the bot
 puck_on_pos2
  a puck has been detected on bridge's position 2
 no_puck_on_pos2
  there is no puck on position 2
 state_timeout
  timeout used to wait the end of servo move

IDLE:
 start -> WAIT_JACK_IN
  we wait for the jack

WAIT_JACK_IN:
 jack_inserted_into_bot -> CLOSE_DOOR
  we init the bridge

CLOSE_DOOR:
 state_timeout -> WAIT_A_PUCK
  we are ready, we wait a puck

WAIT_A_PUCK:
 puck_on_pos2: lift_not_ready -> .
  Lift not ready, we stand by
 puck_on_pos2: lift_ready -> MARCEL_WAIT
  wait the puck is entirely on pos2

MARCEL_WAIT:
 state_timeout -> OPEN_DOOR
  lift ready, we deliver

OPEN_DOOR:
 state_timeout -> PUSH_PUCK
  we push the puck to the lift

PUSH_PUCK:
 no_puck_on_pos2 -> CLOSE_DOOR
  the puck disappears, we close doors