summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Haller2009-04-19 23:36:38 +0200
committerNicolas Haller2009-04-19 23:36:38 +0200
commit7e43a04c49a0f7b5fc02fc25517d5e950a4e37cf (patch)
tree680afe6c5a55ccc38dc3ccc96bd1f3fbdaaa1234
parent54a97038d99c00de98b30dcc97ae95822bacea9d (diff)
* digital/io/src/filterbridge{_cb.c,.fsm}
- filterbridge fsm updated due to meca modifications
-rw-r--r--digital/io/src/filterbridge.fsm58
-rw-r--r--digital/io/src/filterbridge_cb.c80
2 files changed, 50 insertions, 88 deletions
diff --git a/digital/io/src/filterbridge.fsm b/digital/io/src/filterbridge.fsm
index d1495abe..13027069 100644
--- a/digital/io/src/filterbridge.fsm
+++ b/digital/io/src/filterbridge.fsm
@@ -7,40 +7,34 @@ States:
waiting the lift is ready to accept new puck
WAIT_A_PUCK
waiting for a new puck
- CLOSE_FIRST_DOOR
- isolating the firt puck on the bridge
WAIT_RGB_PROBE
waiting for RGB probe the first puck
EJECT_PUCK
eject a bad puck
RETURN_NORMAL_POS
move the bridge to his normal position
- OPEN_SECOND_DOOR
- open and free the puck to the lift
- CLOSE_SECOND_DOOR
- prepare for a new puck
- OPEN_FIRST_DOOR
- accept a puck for a new test
+ OPEN_DOOR
+ release puck to the lift and block a new puck on pos1
+ CLOSE_DOOR
+ release pos1 puck and close access to the lift
Events:
lift_ready
lift ready to accept new puck
puck_on_pos2
a puck has been detected on bridge's position 2
- first_door_closed
- the first door is closed
no_puck_on_pos2
there is no puck on position 2
bridge_in_position
bridge is in his normal position
- second_door_closed
- you shall not pass to the lift
- first_door_opened
- bridge ready to test a new puck
- puck_ejected
+ door_opened
+ puck 1 blocked and puck 2 release to the lift
+ ejection_done
the ejection procedure is completed
color_probed
the result of the investigation will be revealed (suspens!!)
+ door_closed
+ ready to test a new puck
IDLE:
@@ -48,37 +42,29 @@ IDLE:
the lift is ready to get pucks, we can begin testing procedure
WAIT_A_PUCK:
- puck_on_pos2 -> CLOSE_FIRST_DOOR
- close the first door after a puck is ready for filtering
-
-CLOSE_FIRST_DOOR:
- first_door_closed -> WAIT_RGB_PROBE
- get puck color
+ puck_on_pos2: too_much_puck -> EJECT_PUCK
+ we have too much puck, eject the puck quickly and whistle
+ puck_on_pos2: nb_puck_ok -> WAIT_RGB_PROBE
+ probe color of the new puck
WAIT_RGB_PROBE:
color_probed: bad_color -> EJECT_PUCK
- eject bad PUCK
- color_probed: good_color -> OPEN_SECOND_DOOR
+ eject bad puck
+ color_probed: good_color -> OPEN_DOOR
put puck to the lift
EJECT_PUCK:
- puck_ejected -> RETURN_NORMAL_POS
+ ejection_done -> RETURN_NORMAL_POS
put bridge on normal position after puck ejection
RETURN_NORMAL_POS:
- bridge_in_position: puck_still_here -> EJECT_PUCK
- re-eject this sticky puck, grml!
- bridge_in_position: no_puck_anymore -> OPEN_FIRST_DOOR
+ bridge_in_position -> CLOSE_DOOR
make bridge ready to test a new puck
-OPEN_SECOND_DOOR:
- no_puck_on_pos2 -> CLOSE_SECOND_DOOR
- close the lift access door and tell to lift it has a new puck
-
-CLOSE_SECOND_DOOR:
- second_door_closed -> OPEN_FIRST_DOOR
- filter bridge is ready to get a new puck
+OPEN_DOOR:
+ no_puck_on_pos2 -> CLOSE_DOOR
+ release puck to the lift
-OPEN_FIRST_DOOR:
- first_door_opened -> IDLE
+CLOSE_DOOR:
+ door_closed -> IDLE
filter bridge ready
diff --git a/digital/io/src/filterbridge_cb.c b/digital/io/src/filterbridge_cb.c
index 0864fa8d..7949f176 100644
--- a/digital/io/src/filterbridge_cb.c
+++ b/digital/io/src/filterbridge_cb.c
@@ -27,21 +27,24 @@
#include "filterbridge_cb.h"
/*
- * CLOSE_FIRST_DOOR =first_door_closed=>
- * => WAIT_RGB_PROBE
- * get puck color
+ * WAIT_A_PUCK =puck_on_pos2=>
+ * nb_puck_ok => WAIT_RGB_PROBE
+ * probe color of the new puck
+ * too_much_puck => EJECT_PUCK
+ * we have too much puck, eject the puck quickly and whistle
*/
fsm_branch_t
-filterbridge__CLOSE_FIRST_DOOR__first_door_closed (void)
+filterbridge__WAIT_A_PUCK__puck_on_pos2 (void)
{
- return filterbridge_next (CLOSE_FIRST_DOOR, first_door_closed);
+ return filterbridge_next_branch (WAIT_A_PUCK, puck_on_pos2, nb_puck_ok);
+ return filterbridge_next_branch (WAIT_A_PUCK, puck_on_pos2, too_much_puck);
}
/*
* WAIT_RGB_PROBE =color_probed=>
* bad_color => EJECT_PUCK
- * eject bad PUCK
- * good_color => OPEN_SECOND_DOOR
+ * eject bad puck
+ * good_color => OPEN_DOOR
* put puck to the lift
*/
fsm_branch_t
@@ -52,28 +55,6 @@ filterbridge__WAIT_RGB_PROBE__color_probed (void)
}
/*
- * WAIT_A_PUCK =puck_on_pos2=>
- * => CLOSE_FIRST_DOOR
- * close the first door after a puck is ready for filtering
- */
-fsm_branch_t
-filterbridge__WAIT_A_PUCK__puck_on_pos2 (void)
-{
- return filterbridge_next (WAIT_A_PUCK, puck_on_pos2);
-}
-
-/*
- * CLOSE_SECOND_DOOR =second_door_closed=>
- * => OPEN_FIRST_DOOR
- * filter bridge is ready to get a new puck
- */
-fsm_branch_t
-filterbridge__CLOSE_SECOND_DOOR__second_door_closed (void)
-{
- return filterbridge_next (CLOSE_SECOND_DOOR, second_door_closed);
-}
-
-/*
* IDLE =lift_ready=>
* => WAIT_A_PUCK
* the lift is ready to get pucks, we can begin testing procedure
@@ -85,50 +66,45 @@ filterbridge__IDLE__lift_ready (void)
}
/*
- * RETURN_NORMAL_POS =bridge_in_position=>
- * no_puck_anymore => OPEN_FIRST_DOOR
- * make bridge ready to test a new puck
- * puck_still_here => EJECT_PUCK
- * re-eject this sticky puck, grml!
+ * CLOSE_DOOR =door_closed=>
+ * => IDLE
+ * filter bridge ready
*/
fsm_branch_t
-filterbridge__RETURN_NORMAL_POS__bridge_in_position (void)
+filterbridge__CLOSE_DOOR__door_closed (void)
{
- return filterbridge_next_branch (RETURN_NORMAL_POS, bridge_in_position, no_puck_anymore);
- return filterbridge_next_branch (RETURN_NORMAL_POS, bridge_in_position, puck_still_here);
+ return filterbridge_next (CLOSE_DOOR, door_closed);
}
/*
- * OPEN_FIRST_DOOR =first_door_opened=>
- * => IDLE
- * filter bridge ready
+ * RETURN_NORMAL_POS =bridge_in_position=>
+ * => CLOSE_DOOR
+ * make bridge ready to test a new puck
*/
fsm_branch_t
-filterbridge__OPEN_FIRST_DOOR__first_door_opened (void)
+filterbridge__RETURN_NORMAL_POS__bridge_in_position (void)
{
- return filterbridge_next (OPEN_FIRST_DOOR, first_door_opened);
+ return filterbridge_next (RETURN_NORMAL_POS, bridge_in_position);
}
/*
- * OPEN_SECOND_DOOR =no_puck_on_pos2=>
- * => CLOSE_SECOND_DOOR
- * close the lift access door and tell to lift it has a new puck
+ * OPEN_DOOR =no_puck_on_pos2=>
+ * => CLOSE_DOOR
+ * release puck to the lift
*/
fsm_branch_t
-filterbridge__OPEN_SECOND_DOOR__no_puck_on_pos2 (void)
+filterbridge__OPEN_DOOR__no_puck_on_pos2 (void)
{
- return filterbridge_next (OPEN_SECOND_DOOR, no_puck_on_pos2);
+ return filterbridge_next (OPEN_DOOR, no_puck_on_pos2);
}
/*
- * EJECT_PUCK =puck_ejected=>
+ * EJECT_PUCK =ejection_done=>
* => RETURN_NORMAL_POS
* put bridge on normal position after puck ejection
*/
fsm_branch_t
-filterbridge__EJECT_PUCK__puck_ejected (void)
+filterbridge__EJECT_PUCK__ejection_done (void)
{
- return filterbridge_next (EJECT_PUCK, puck_ejected);
+ return filterbridge_next (EJECT_PUCK, ejection_done);
}
-
-