summaryrefslogtreecommitdiff
path: root/digital/io/src/move.fsm
blob: e36e4e86e47d67b10410a4b9c4f4bb0d263ec816 (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
#Move FSM.
move

States:
 IDLE
 DESIRED_POSITION
 COMPUTE_POS
 MOVE_ON_LEFT
 MOVE_ON_RIGHT

Events:
 start
 reached
 blocked
 near_left_border
 near_right_border

IDLE:
 start -> DESIRED_POSITION
  Tries to reach a position provided by the user. If the position desired can not be reached, it all try to move on the right or the left.

DESIRED_POSITION:
 reached -> IDLE
  The position provided by the user has been reached, the FSM can stop.
 blocked -> COMPUTE_POS
  The robot will compute the position from the border and will take the decision to go on the left or on the right.

MOVE_ON_LEFT:
 reached -> DESIRED_POSITION
  The position has been reached. It will now try to reach the position provided by the user.
 blocked -> MOVE_ON_RIGHT
  The robot will try to go on the left because the previous movement block on the right.

MOVE_ON_RIGHT:
 reached -> DESIRED_POSITION
  The position has been reached. It will now try to reach the position provided by the user.
 blocked -> MOVE_ON_LEFT
  The robot will try to go on the left because the previous movement block on the left.

COMPUTE_POS:
 near_left_border -> MOVE_ON_RIGHT
  The robot is near the left border it shall try to move on the right.
 near_right_border -> MOVE_ON_LEFT
  The robot is near the right border it shall try to move on the left.