summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorJérémy Dufour2008-04-24 00:58:22 +0200
committerJérémy Dufour2008-04-24 00:58:22 +0200
commite2046a06ee91772f0fa7ac8f139044a8a0620098 (patch)
tree43235e078f9d2abef1c9e0349abece9f084bcd6d
parent0ab57413d5a7490504840bb675bb42af7aa8763e (diff)
* digital/io/src
- add an event to move away the bot from the gutter (to be able to turn freely) ; - move an event in the source file to ease merge.
-rw-r--r--digital/io/src/top.fsm23
-rw-r--r--digital/io/src/top_cb.c56
2 files changed, 51 insertions, 28 deletions
diff --git a/digital/io/src/top.fsm b/digital/io/src/top.fsm
index 24a3b1fd..5a8e78b1 100644
--- a/digital/io/src/top.fsm
+++ b/digital/io/src/top.fsm
@@ -16,8 +16,9 @@ States:
waiting for the jack to be removed from the bot
CONFIGURE_ASSERV
configuring the asserv board
- MOVE_AWAY_FROM_BORDER
- move the bot away from the border to be able to turn freely
+ MOVE_AWAY_FROM_START_BORDER
+ move the bot away from the border of the start point to be able to turn
+ freely
GO_TO_SAMPLE_DISTRIBUTOR
go to our distributor of samples (using the move FSM)
GO_TO_OUR_ICE_DISTRIBUTOR
@@ -35,6 +36,8 @@ States:
DROP_OFF_BALLS_TO_GUTTER
drop all the balls contained in the bot into the gutter (using the gutter
FSM)
+ MOVE_AWAY_FROM_GUTTER_BORDER
+ move the bot away from the border of the gutter to be able to turn freely
Events:
start
@@ -67,10 +70,10 @@ WAIT_JACK_OUT:
set the settings of the asserv board (especially the position)
CONFIGURE_ASSERV:
- settings_acknowledged -> MOVE_AWAY_FROM_BORDER
+ settings_acknowledged -> MOVE_AWAY_FROM_START_BORDER
move the bot away from the border to be able to turn freely
-MOVE_AWAY_FROM_BORDER:
+MOVE_AWAY_FROM_START_BORDER:
move_fsm_finished -> GO_TO_SAMPLE_DISTRIBUTOR
order the bot to move to our samples distributors with the move FSM
@@ -101,10 +104,9 @@ GO_TO_GUTTER:
FSM
DROP_OFF_BALLS_TO_GUTTER:
- gutter_fsm_finished -> GO_TO_SAMPLE_DISTRIBUTOR
- we have finished to drop off all the balls, let's go to our sample
- ditributor to try the same strategy again
- reset internal data
+ gutter_fsm_finished -> MOVE_AWAY_FROM_GUTTER_BORDER
+ we have finished to drop off all the balls, let's move away from the gutter
+ to move freely
GO_TO_ADVERSE_ICE_DISTRIBUTOR:
move_fsm_finished -> GET_ICE_FROM_ADVERSE_ICE_DISTRIBUTOR
@@ -115,3 +117,8 @@ GET_ICE_FROM_ADVERSE_ICE_DISTRIBUTOR:
get_samples_fsm_finished -> GO_TO_GUTTER
we have finished to get ice. Even if we are not full, let's go to the gutter
with the move FSM
+
+MOVE_AWAY_FROM_GUTTER_BORDER:
+ move_fsm_finished -> GO_TO_SAMPLE_DISTRIBUTOR
+ go to our sample ditributor to try the same strategy again
+ reset internal data
diff --git a/digital/io/src/top_cb.c b/digital/io/src/top_cb.c
index 65754f90..fed78ef2 100644
--- a/digital/io/src/top_cb.c
+++ b/digital/io/src/top_cb.c
@@ -47,16 +47,18 @@ extern uint8_t top_waiting_for_settings_ack_;
/*
* DROP_OFF_BALLS_TO_GUTTER =gutter_fsm_finished=>
- * => GO_TO_SAMPLE_DISTRIBUTOR
- * we have finished to drop off all the balls, let's go to our sample
- * ditributor to try the same strategy again
- * reset internal data
+ * => MOVE_AWAY_FROM_GUTTER_BORDER
+ * we have finished to drop off all the balls, let's move away from the gutter
+ * to move freely
*/
fsm_branch_t
top__DROP_OFF_BALLS_TO_GUTTER__gutter_fsm_finished (void)
{
- /* Start the move FSM */
- move_start (PG_DISTRIBUTOR_SAMPLE_OUR_X, PG_DISTRIBUTOR_SAMPLE_OUR_Y);
+ /* Get current position */
+ asserv_position_t position;
+ asserv_get_position (&position);
+ /* Move away from the gutter */
+ move_start (position.x, position.y + BOT_MIN_DISTANCE_TURN_FREE);
return top_next (DROP_OFF_BALLS_TO_GUTTER, gutter_fsm_finished);
}
@@ -83,6 +85,19 @@ top__WAIT_JACK_OUT__jack_removed_from_bot (void)
}
/*
+ * MOVE_AWAY_FROM_START_BORDER =move_fsm_finished=>
+ * => GO_TO_SAMPLE_DISTRIBUTOR
+ * order the bot to move to our samples distributors with the move FSM
+ */
+fsm_branch_t
+top__MOVE_AWAY_FROM_START_BORDER__move_fsm_finished (void)
+{
+ /* Start the move FSM to our samples distributor */
+ move_start (PG_DISTRIBUTOR_SAMPLE_OUR_X, PG_DISTRIBUTOR_SAMPLE_OUR_Y);
+ return top_next (MOVE_AWAY_FROM_START_BORDER, move_fsm_finished);
+}
+
+/*
* GET_SAMPLES_FROM_SAMPLES_DISTRIBUTOR =get_samples_fsm_finished=>
* => GO_TO_OUR_ICE_DISTRIBUTOR
* we have finished to get our samples, let's go to our ice distributor with
@@ -97,19 +112,6 @@ top__GET_SAMPLES_FROM_SAMPLES_DISTRIBUTOR__get_samples_fsm_finished (void)
}
/*
- * MOVE_AWAY_FROM_BORDER =move_fsm_finished=>
- * => GO_TO_SAMPLE_DISTRIBUTOR
- * order the bot to move to our samples distributors with the move FSM
- */
-fsm_branch_t
-top__MOVE_AWAY_FROM_BORDER__move_fsm_finished (void)
-{
- /* Start the move FSM to our samples distributor */
- move_start (PG_DISTRIBUTOR_SAMPLE_OUR_X, PG_DISTRIBUTOR_SAMPLE_OUR_Y);
- return top_next (MOVE_AWAY_FROM_BORDER, move_fsm_finished);
-}
-
-/*
* GO_TO_ADVERSE_ICE_DISTRIBUTOR =move_fsm_finished=>
* => GET_ICE_FROM_ADVERSE_ICE_DISTRIBUTOR
* we are now in front of the adverse ice distributor, launch the get samples
@@ -205,6 +207,20 @@ top__GET_ICE_FROM_OUR_ICE_DISTRIBUTOR__get_samples_fsm_finished (void)
}
/*
+ * MOVE_AWAY_FROM_GUTTER_BORDER =move_fsm_finished=>
+ * => GO_TO_SAMPLE_DISTRIBUTOR
+ * go to our sample ditributor to try the same strategy again
+ * reset internal data
+ */
+fsm_branch_t
+top__MOVE_AWAY_FROM_GUTTER_BORDER__move_fsm_finished (void)
+{
+ /* Start the move FSM */
+ move_start (PG_DISTRIBUTOR_SAMPLE_OUR_X, PG_DISTRIBUTOR_SAMPLE_OUR_Y);
+ return top_next (MOVE_AWAY_FROM_GUTTER_BORDER, move_fsm_finished);
+}
+
+/*
* GET_ICE_FROM_ADVERSE_ICE_DISTRIBUTOR =get_samples_fsm_finished=>
* => GO_TO_GUTTER
* we have finished to get ice. Even if we are not full, let's go to the gutter
@@ -231,7 +247,7 @@ top__WAIT_JACK_IN__jack_inserted_into_bot (void)
/*
* CONFIGURE_ASSERV =settings_acknowledged=>
- * => MOVE_AWAY_FROM_BORDER
+ * => MOVE_AWAY_FROM_START_BORDER
* move the bot away from the border to be able to turn freely
*/
fsm_branch_t