summaryrefslogtreecommitdiffhomepage
path: root/digital/io/src
diff options
context:
space:
mode:
authorNélio Laranjeiro2008-03-29 16:55:12 +0100
committerNélio Laranjeiro2008-03-29 16:55:12 +0100
commitea8d7c80227602af4e51bf550b0bd715ea5f4e49 (patch)
tree13c38bf3f04f7315a6d4aa8a8afdba2872c6ac76 /digital/io/src
parentfd563cc503df214e7402a11aef187c69ffd0f60f (diff)
Added the fsm for the gutter, The open and close commande for the
collector are missing.
Diffstat (limited to 'digital/io/src')
-rw-r--r--digital/io/src/gutter/Makefile2
-rw-r--r--digital/io/src/gutter/gutter.fsm6
-rw-r--r--digital/io/src/gutter/gutter_cb.c69
3 files changed, 75 insertions, 2 deletions
diff --git a/digital/io/src/gutter/Makefile b/digital/io/src/gutter/Makefile
index 63752dc5..ceae7a8a 100644
--- a/digital/io/src/gutter/Makefile
+++ b/digital/io/src/gutter/Makefile
@@ -7,7 +7,6 @@ prgm: gutter.fsm gutter.conf
exe: gutter.fsm gutter.conf
make prgm
- if [ -f gutter_cb.c ]; then patch gutter_cb.c gutter_cb_skel.c; else mv gutter_cb_skel.c gutter_cb.c; fi;
dot: gutter.fsm gutter.conf
python ../../../../tools/dfagen/dfagen.py -o dot -d $< -c gutter.conf -p gutter
@@ -17,7 +16,6 @@ png: gutter.dot
clean:
rm -f gutter.h
- rm -f gutter_cb.c
rm -f gutter_cb.h
rm -f gutter.dot
rm -f gutter.png
diff --git a/digital/io/src/gutter/gutter.fsm b/digital/io/src/gutter/gutter.fsm
index af15c87a..158c8d13 100644
--- a/digital/io/src/gutter/gutter.fsm
+++ b/digital/io/src/gutter/gutter.fsm
@@ -2,17 +2,23 @@
get_samples
States:
+ START
GO_TO_GUTTER
OPEN_COLLECTOR
CLOSE_COLLECTOR
END
Events:
+ ok
position_reached
position_failed
collector_opened
collector_closed
+START:
+ ok -> GO_TO_GUTTER
+ Go to the gutter.
+
GO_TO_GUTTER:
position_reached -> OPEN_COLLECTOR
The robo is near the gutter and the door can be opened.
diff --git a/digital/io/src/gutter/gutter_cb.c b/digital/io/src/gutter/gutter_cb.c
new file mode 100644
index 00000000..14268177
--- /dev/null
+++ b/digital/io/src/gutter/gutter_cb.c
@@ -0,0 +1,69 @@
+/*
+ * THIS IS AN AUTOMATICALLY GENERATED FILE, DO NOT EDIT!
+ *
+ * Skeleton for get_samples callbacks implementation.
+ *
+ *
+ */
+#include "gutter_cb.h"
+
+/*
+ * START =ok=>
+ * => GO_TO_GUTTER
+ * Go to the gutter.
+ */
+gutter_branch_t
+gutter__START__ok (gutter_t *user)
+{
+ asserv_go_to_gutter();
+ return gutter_next (START, ok);
+}
+
+/*
+ * CLOSE_COLLECTOR =collector_closed=>
+ * => END
+ * The samples has been inserted in the gutter.
+ */
+gutter_branch_t
+gutter__CLOSE_COLLECTOR__collector_closed (gutter_t *user)
+{
+ //Close the collector.
+ return gutter_next (CLOSE_COLLECTOR, collector_closed);
+}
+
+/*
+ * GO_TO_GUTTER =position_failed=>
+ * => GO_TO_GUTTER
+ * The position failed, shall try another path.
+ */
+gutter_branch_t
+gutter__GO_TO_GUTTER__position_failed (gutter_t *user)
+{
+ return gutter_next (GO_TO_GUTTER, position_failed);
+}
+
+/*
+ * GO_TO_GUTTER =position_reached=>
+ * => OPEN_COLLECTOR
+ * The robo is near the gutter and the door can be opened.
+ */
+gutter_branch_t
+gutter__GO_TO_GUTTER__position_reached (gutter_t *user)
+{
+ // Open the collector.
+ return gutter_next (GO_TO_GUTTER, position_reached);
+}
+
+/*
+ * OPEN_COLLECTOR =collector_opened=>
+ * => CLOSE_COLLECTOR
+ * Wait some time and clse the door.
+ */
+gutter_branch_t
+gutter__OPEN_COLLECTOR__collector_opened (gutter_t *user)
+{
+ utils_delay_ms(4.4);
+ return gutter_next (OPEN_COLLECTOR, collector_opened);
+}
+
+