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

States:
 IDLE
 DESIRED_POSITION
 BACKWARD
 GO_AWAY
 STOP_WAIT

Events:
 start
 bot_move_succeed
 bot_move_failed
 bot_move_obstacle
 wait_finished

IDLE:
 start -> DESIRED_POSITION
  Save the destination position and put obstacles number to 0.

DESIRED_POSITION:
 bot_move_succeed-> IDLE
  Destination position reached by the bot. Set the flag of the top event to inform it.
 bot_move_failed-> BACKWARD
  Store the current position, initialise the path system i.e. provide the position of the obstacle and request the path system the next position.
 bot_move_obstacle-> STOP_WAIT
  Stop the bot.

BACKWARD:
 bot_move_succeed-> GO_AWAY
  Launch the pathfinder and go to the next position.

STOP_WAIT:
 wait_finished-> GO_AWAY
  Launch the pathfinder and go to the next position.

GO_AWAY:
 bot_move_obstacle -> STOP_WAIT
  Go to the stop wait event.
 bot_move_succeed: position_desired -> IDLE
  The position desired provided on the FSM call had been reached.
 bot_move_succeed: position_intermediary -> GO_AWAY
  Request the next step to reached to the path finder.
 bot_move_failed -> BACKWARD
  Store the current position, and go backward.