summaryrefslogtreecommitdiffhomepage
path: root/digital/io/src/top.fsm
blob: 6340984e400d1175818d08d4168424ffb108ac58 (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
# Top FSM.
top
  Main FSM calling other FSM.

States:
 *IDLE
  waiting for the beginning of the top FSM.
 WAIT_INIT_TO_FINISH
  waiting for the end of init.
 GO_FAR
  testing move fsm, going to a far point.
 GO_NEAR
  testing move fsm, going to a near point.

Events:
 start
  initialize the FSM.
 move_fsm_succeed
  when the move FSM returns with success.
 move_fsm_failed
  when the move FSM returns with an error.
 bot_move_succeed
  when the bot has succeed its asserv movement.
 bot_move_failed
  when the bot has failed its asserv movement.
 init_match_is_started
  when the init FSM has finished and the match start.
 state_timeout
  timeout in cycle count.
 asserv_last_cmd_ack
  last command sent to the asserv board has been acquitted.

import init.fsm
import move.fsm

IDLE:
 start -> WAIT_INIT_TO_FINISH
  nothing to do.

WAIT_INIT_TO_FINISH:
 init_match_is_started -> GO_FAR
  the match start
  go to a far point

GO_FAR:
 move_fsm_succeed -> GO_NEAR
  go to a near point
 move_fsm_failed -> GO_NEAR
  go to a near point

GO_NEAR:
 move_fsm_succeed -> GO_FAR
  restart
 move_fsm_failed -> GO_FAR
  restart