summaryrefslogtreecommitdiffhomepage
path: root/digital/io/src/gutter_cb.c
diff options
context:
space:
mode:
authorJérémy Dufour2008-05-03 12:43:19 +0200
committerJérémy Dufour2008-05-03 12:43:19 +0200
commit23bce6a75a17b9cd9d3f35a251baa1b0635697a4 (patch)
treecc53e275464e9e86cf6fe705497d0212fea960f1 /digital/io/src/gutter_cb.c
parent1bcff7dbcbb284f5564ac708292b23fd447395a9 (diff)
* digital/io/src
- manage the event where the bot can be blocked (when moving) in the different FSM, by waiting and trying again ; - ensure we update the classifier (with the servos motor) even when the arm move in a state where it should not.
Diffstat (limited to 'digital/io/src/gutter_cb.c')
-rw-r--r--digital/io/src/gutter_cb.c31
1 files changed, 31 insertions, 0 deletions
diff --git a/digital/io/src/gutter_cb.c b/digital/io/src/gutter_cb.c
index 8d11a63a..96f5c605 100644
--- a/digital/io/src/gutter_cb.c
+++ b/digital/io/src/gutter_cb.c
@@ -42,6 +42,11 @@ uint16_t gutter_wait_cycle_;
*/
#define GUTTER_WAIT_FOR_BALLS_TO_DROP 300
+/**
+ * Time to wait before trying the go to the wall again.
+ */
+#define GUTTER_WAIT_BEFORE_TRY_AGAIN (225)
+
/*
* ROTATE_REAR_SIDE_TO_GUTTER =bot_move_succeed=>
* => GO_TO_THE_GUTTER_WALL
@@ -56,6 +61,19 @@ gutter__ROTATE_REAR_SIDE_TO_GUTTER__bot_move_succeed (void)
}
/*
+ * WAIT_AND_TRY_AGAIN =wait_finished=>
+ * => GO_TO_THE_GUTTER_WALL
+ * try the fuck the wall again
+ */
+fsm_branch_t
+gutter__WAIT_AND_TRY_AGAIN__wait_finished (void)
+{
+ /* Make the bot reversing against the gutter */
+ asserv_go_to_the_wall ();
+ return gutter_next (WAIT_AND_TRY_AGAIN, wait_finished);
+}
+
+/*
* IDLE =start=>
* => ROTATE_REAR_SIDE_TO_GUTTER
* put the bot back to the gutter
@@ -71,6 +89,18 @@ gutter__IDLE__start (void)
}
/*
+ * GO_TO_THE_GUTTER_WALL =bot_move_failed=>
+ * => WAIT_AND_TRY_AGAIN
+ * ask the top FSM to wake us up in a few times
+ */
+fsm_branch_t
+gutter__GO_TO_THE_GUTTER_WALL__bot_move_failed (void)
+{
+ main_getsamples_wait_cycle = GUTTER_WAIT_BEFORE_TRY_AGAIN;
+ return gutter_next (GO_TO_THE_GUTTER_WALL, bot_move_failed);
+}
+
+/*
* GO_TO_THE_GUTTER_WALL =bot_move_succeed=>
* => DROP_BALLS
* open the collector to drop the balls
@@ -91,6 +121,7 @@ gutter__GO_TO_THE_GUTTER_WALL__bot_move_succeed (void)
* DROP_BALLS =wait_finished=>
* => IDLE
* close the rear panel
+ * tell the top FSM we have finished
*/
fsm_branch_t
gutter__DROP_BALLS__wait_finished (void)