From 20bbd9db488c56bfc2195865ec2b5c77fa024dbd Mon Sep 17 00:00:00 2001 From: Nélio Laranjeiro Date: Sun, 30 Mar 2008 20:53:54 +0200 Subject: Moved the gutter fsm to the io/directory. --- digital/io/src/Makefile.gutter | 21 +++++++++++ digital/io/src/gutter.conf | 5 +++ digital/io/src/gutter.fsm | 34 +++++++++++++++++ digital/io/src/gutter/Makefile.gutter | 22 ----------- digital/io/src/gutter/gutter.conf | 5 --- digital/io/src/gutter/gutter.fsm | 34 ----------------- digital/io/src/gutter/gutter_cb.c | 70 ----------------------------------- digital/io/src/gutter/gutter_robo.h | 35 ------------------ digital/io/src/gutter_cb.c | 70 +++++++++++++++++++++++++++++++++++ digital/io/src/gutter_robo.h | 35 ++++++++++++++++++ 10 files changed, 165 insertions(+), 166 deletions(-) create mode 100644 digital/io/src/Makefile.gutter create mode 100644 digital/io/src/gutter.conf create mode 100644 digital/io/src/gutter.fsm delete mode 100644 digital/io/src/gutter/Makefile.gutter delete mode 100644 digital/io/src/gutter/gutter.conf delete mode 100644 digital/io/src/gutter/gutter.fsm delete mode 100644 digital/io/src/gutter/gutter_cb.c delete mode 100644 digital/io/src/gutter/gutter_robo.h create mode 100644 digital/io/src/gutter_cb.c create mode 100644 digital/io/src/gutter_robo.h diff --git a/digital/io/src/Makefile.gutter b/digital/io/src/Makefile.gutter new file mode 100644 index 00000000..146835ed --- /dev/null +++ b/digital/io/src/Makefile.gutter @@ -0,0 +1,21 @@ +CFLAGS = -O2 -Wall + +all: prgm exe dot png + +prgm: gutter.fsm gutter.conf + python ../../../tools/dfagen/dfagen.py -o c -d $< -c gutter.conf -p gutter + +exe: prgm + +dot: gutter.fsm gutter.conf + python ../../../tools/dfagen/dfagen.py -o dot -d $< -c gutter.conf -p gutter + +png: gutter.dot + dot -Tpng -o gutter.png gutter.dot + +clean: + rm -f gutter.h + rm -f gutter_cb.h + rm -f gutter.dot + rm -f gutter.png + rm -f gutter.c diff --git a/digital/io/src/gutter.conf b/digital/io/src/gutter.conf new file mode 100644 index 00000000..2f21fd61 --- /dev/null +++ b/digital/io/src/gutter.conf @@ -0,0 +1,5 @@ +[user] +type = gutter_t +type-forward-decl = typedef struct gutter_t gutter_t; +type-decl = #include "gutter_robo.h" +field = fsm diff --git a/digital/io/src/gutter.fsm b/digital/io/src/gutter.fsm new file mode 100644 index 00000000..158c8d13 --- /dev/null +++ b/digital/io/src/gutter.fsm @@ -0,0 +1,34 @@ +#FSM get samples +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. + position_failed -> . + The position failed, shall try another path. + +OPEN_COLLECTOR: + collector_opened -> CLOSE_COLLECTOR + Wait some time and clse the door. + +CLOSE_COLLECTOR: + collector_closed-> END + The samples has been inserted in the gutter. diff --git a/digital/io/src/gutter/Makefile.gutter b/digital/io/src/gutter/Makefile.gutter deleted file mode 100644 index ceae7a8a..00000000 --- a/digital/io/src/gutter/Makefile.gutter +++ /dev/null @@ -1,22 +0,0 @@ -CFLAGS = -O2 -Wall - -all: prgm exe dot png - -prgm: gutter.fsm gutter.conf - python ../../../../tools/dfagen/dfagen.py -o c -d $< -c gutter.conf -p gutter - -exe: gutter.fsm gutter.conf - make prgm - -dot: gutter.fsm gutter.conf - python ../../../../tools/dfagen/dfagen.py -o dot -d $< -c gutter.conf -p gutter - -png: gutter.dot - dot -Tpng -o gutter.png gutter.dot - -clean: - rm -f gutter.h - rm -f gutter_cb.h - rm -f gutter.dot - rm -f gutter.png - rm -f gutter.c diff --git a/digital/io/src/gutter/gutter.conf b/digital/io/src/gutter/gutter.conf deleted file mode 100644 index 2f21fd61..00000000 --- a/digital/io/src/gutter/gutter.conf +++ /dev/null @@ -1,5 +0,0 @@ -[user] -type = gutter_t -type-forward-decl = typedef struct gutter_t gutter_t; -type-decl = #include "gutter_robo.h" -field = fsm diff --git a/digital/io/src/gutter/gutter.fsm b/digital/io/src/gutter/gutter.fsm deleted file mode 100644 index 158c8d13..00000000 --- a/digital/io/src/gutter/gutter.fsm +++ /dev/null @@ -1,34 +0,0 @@ -#FSM get samples -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. - position_failed -> . - The position failed, shall try another path. - -OPEN_COLLECTOR: - collector_opened -> CLOSE_COLLECTOR - Wait some time and clse the door. - -CLOSE_COLLECTOR: - collector_closed-> END - The samples has been inserted in the gutter. diff --git a/digital/io/src/gutter/gutter_cb.c b/digital/io/src/gutter/gutter_cb.c deleted file mode 100644 index 729c187f..00000000 --- a/digital/io/src/gutter/gutter_cb.c +++ /dev/null @@ -1,70 +0,0 @@ -/* - * 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. - trap_close_rear_panel(); - 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. - trap_open_rear_panel(); - 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); -} - diff --git a/digital/io/src/gutter/gutter_robo.h b/digital/io/src/gutter/gutter_robo.h deleted file mode 100644 index 251d6f4d..00000000 --- a/digital/io/src/gutter/gutter_robo.h +++ /dev/null @@ -1,35 +0,0 @@ -#ifndef gutter_robo_h -#define gutter_robo_h -/* gutter_robo.h */ -/* {{{ - * - * Copyright (C) 2008 Nélio Laranjeiro - * - * APBTeam: - * Web: http://apbteam.org/ - * Email: team AT apbteam DOT org - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * }}} */ - -#include "gutter.h" - -struct gutter_t -{ - gutter_state_t fsm; -}; - -#endif /* gutter_robo_h */ diff --git a/digital/io/src/gutter_cb.c b/digital/io/src/gutter_cb.c new file mode 100644 index 00000000..729c187f --- /dev/null +++ b/digital/io/src/gutter_cb.c @@ -0,0 +1,70 @@ +/* + * 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. + trap_close_rear_panel(); + 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. + trap_open_rear_panel(); + 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); +} + diff --git a/digital/io/src/gutter_robo.h b/digital/io/src/gutter_robo.h new file mode 100644 index 00000000..251d6f4d --- /dev/null +++ b/digital/io/src/gutter_robo.h @@ -0,0 +1,35 @@ +#ifndef gutter_robo_h +#define gutter_robo_h +/* gutter_robo.h */ +/* {{{ + * + * Copyright (C) 2008 Nélio Laranjeiro + * + * APBTeam: + * Web: http://apbteam.org/ + * Email: team AT apbteam DOT org + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * }}} */ + +#include "gutter.h" + +struct gutter_t +{ + gutter_state_t fsm; +}; + +#endif /* gutter_robo_h */ -- cgit v1.2.3