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

States:
 IDLE
 DESIRED_POSITION
 MOVE_ON_LEFT
 MOVE_ON_RIGHT

Events:
 start
 reached
 failed
 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.
 failed: 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: near_left_border -> MOVE_ON_RIGHT
  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 right only if the right border is the farest one.
 blocked: near_left_border -> MOVE_ON_RIGHT
  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 right only if the right border is the farest one.
 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.

MOVE_ON_LEFT:
 reached -> DESIRED_POSITION
  The position has been reached. It will now try to reach the position provided by the user.
 failed: near_left_border -> MOVE_ON_RIGHT
  The position is fail again, it will try to reach another one.
 blocked -> MOVE_ON_RIGHT
  The position is fail again, it will go backward 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: near_right_border -> MOVE_ON_LEFT
  The position is fail again, it will try to reach another one.
 blocked -> MOVE_ON_LEFT
  The position is fail again, it will go backward to reach another one.