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

States:
 IDLE
 DESIRED_POSITION
 MOVE_ON_LEFT
 MOVE_ON_RIGHT

Events:
 start
 reached
 failed_or_blocked_or_near_border
 failed_or_blocked

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.
 failed_or_blocked: near_right_border -> MOVE_ON_LEFT
  The robot has failed to reach the position. It shall try another position before trying to reach this one again. It shall go to the on the left only if the left border is the farest one.
 failed_or_blocked: near_left_border -> MOVE_ON_RIGHT
  Same process as the previous one but 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.
 failed_or_blocked_or_near_border -> MOVE_ON_RIGHT
  The position is fail again, it will try to reach another one.

MOVE_ON_RIGHT:
 reached -> DESIRED_POSITION
  The position has been reached. It will now try to reach the position provided by the user.
 failed_or_blocked_or_near_border -> MOVE_ON_LEFT
  The position is fail again, it will try to reach another one.