summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--digital/io/src/Makefile7
-rw-r--r--digital/io/src/move.fsm41
2 files changed, 45 insertions, 3 deletions
diff --git a/digital/io/src/Makefile b/digital/io/src/Makefile
index 7a82e78d..3e85aa96 100644
--- a/digital/io/src/Makefile
+++ b/digital/io/src/Makefile
@@ -40,11 +40,12 @@ FSM_TEMPLATES := $(FSM_TEMPLATES:%=fsm_templates/%)
EXTRA_CLEAN_FILES = getsamples_fsm.h getsamples_fsm.c getsamples_cb.h \
getsamples_cb_skel.c getsamples.png \
gutter_fsm.h gutter_fsm.c gutter_cb.h \
- gutter_cb_skel.c gutter.png
+ gutter_cb_skel.c gutter.png \
+ move_fsm.h move_fsm.c move.png move_cb.h move_cb_skel.c
# Bootstrap, fsm should be generated before fsm.h is used.
fsm.c: fsm.h
-fsm.h: getsamples_fsm.h gutter_fsm.h
+fsm.h: getsamples_fsm.h gutter_fsm.h move_fsm.h
DFAGEN = python $(BASE)/../../tools/dfagen/dfagen.py
@@ -80,7 +81,7 @@ else
endif
-png: getsamples.png gutter.png
+png: getsamples.png gutter.png move.png
%.png: %.dot
dot -Tpng -o $@ $<
diff --git a/digital/io/src/move.fsm b/digital/io/src/move.fsm
new file mode 100644
index 00000000..da059071
--- /dev/null
+++ b/digital/io/src/move.fsm
@@ -0,0 +1,41 @@
+#Move FSM.
+move
+
+States:
+ START
+ END
+ DESIRED_POSITION
+ MOVE_ON_LEFT
+ MOVE_ON_RIGHT
+
+Events:
+ ok
+ reached
+ near_border
+ failed_or_blocked
+
+START:
+ ok -> 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 -> END
+ The position provided by the user has been reached, the FSM can stop.
+ failed_or_blocked -> 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_or_blocked -> MOVE_ON_LEFT
+ The position is fail again, it will try to reach another one.
+ near_border -> MOVE_ON_RIGHT
+ The robot is now too near of the border.
+
+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 -> MOVE_ON_RIGHT
+ The position is fail again, it will try to reach another one.
+ near_border -> MOVE_ON_LEFT
+ The robot is now too near of the border.