summaryrefslogtreecommitdiffhomepage
path: root/digital/io
diff options
context:
space:
mode:
Diffstat (limited to 'digital/io')
-rw-r--r--digital/io/src/Makefile6
-rw-r--r--digital/io/src/mainFsm.fsm52
2 files changed, 56 insertions, 2 deletions
diff --git a/digital/io/src/Makefile b/digital/io/src/Makefile
index ae765ece..0bc02433 100644
--- a/digital/io/src/Makefile
+++ b/digital/io/src/Makefile
@@ -41,7 +41,9 @@ 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 \
- move_fsm.h move_fsm.c move.png move_cb.h move_cb_skel.c
+ move_fsm.h move_fsm.c move.png move_cb.h move_cb_skel.c \
+ mainFsm.h mainFsm.c mainFsm.png mainFsm_cb.h \
+ mainFsm_cb_skel.c
# Bootstrap, fsm should be generated before fsm.h is used.
fsm.c: fsm.h
@@ -81,7 +83,7 @@ else
endif
-png: getsamples.png gutter.png move.png
+png: getsamples.png gutter.png move.png mainFsm.png
%.png: %.dot
dot -Tpng -o $@ $<
diff --git a/digital/io/src/mainFsm.fsm b/digital/io/src/mainFsm.fsm
new file mode 100644
index 00000000..35482f52
--- /dev/null
+++ b/digital/io/src/mainFsm.fsm
@@ -0,0 +1,52 @@
+# Main FSM.
+mainfsm
+
+States:
+ START
+ GET_SAMPLES
+ GET_ICE
+ GO_TO_GOAL
+ GET_ADV_ICE
+
+Events:
+ ok
+ samples_took
+ collector_full
+ ice_took
+ samples_deposed
+ samples_took_ice_distributor_empty_not_enough_time
+ samples_took_ice_distributor_empty_enough_time
+ samples_deposed_ice_distributor_empty
+ ice_took_collector_full
+ not_enough_time
+ ice_took_collector_not_full
+
+START:
+ ok -> GET_SAMPLES
+ Go to take some samples. The sequence shall be adapt to take the correct number of samples.
+
+GET_SAMPLES:
+ samples_took -> GET_ICE
+ The samples had been took and now the ice is missing.
+ samples_took_ice_distributor_empty_not_enough_time -> GO_TO_GOAL
+ Some samples had been took and there is not enough time to get some ice.
+ samples_took_ice_distributor_empty_enough_time -> GET_ADV_ICE
+ Go to take ice in the adversary distributor because the one in our part of the table is empty.
+ collector_full -> GO_TO_GOAL
+ All the room in the robot are full.
+
+GET_ICE:
+ ice_took -> GO_TO_GOAL
+ The ice had been taken and the collector is full. The robot shall go to depose it into the goal.
+
+GO_TO_GOAL:
+ samples_deposed -> GET_SAMPLES
+ The samples had been deposed, it shall try to get more samples. This state will call the getsamples FSM and the moveFSM.
+ samples_deposed_ice_distributor_empty -> GET_ADV_ICE
+ Go to get some adversary ice because our distributor is empty.
+
+GET_ADV_ICE:
+ ice_took -> GO_TO_GOAL
+ The ice has been taken, now the robot shall depose it.
+ ice_took_collector_not_full -> GET_SAMPLES
+ There is enough time to get some samples and go to the goal.