From d803fd8ba61dba29c904ee1fccfab2b7177834d4 Mon Sep 17 00:00:00 2001 From: Jérémy Dufour Date: Fri, 2 May 2008 13:03:19 +0200 Subject: * digital/io/src - integrate support for "the near end of match" function in the top and get samples FSM. --- digital/io/src/getsamples_cb.c | 3 ++- digital/io/src/top.fsm | 5 ++++- digital/io/src/top_cb.c | 20 ++++++++++++++++---- 3 files changed, 22 insertions(+), 6 deletions(-) (limited to 'digital/io') diff --git a/digital/io/src/getsamples_cb.c b/digital/io/src/getsamples_cb.c index 14ac4996..1ba50ac1 100644 --- a/digital/io/src/getsamples_cb.c +++ b/digital/io/src/getsamples_cb.c @@ -33,6 +33,7 @@ #include "giboulee.h" /* BOT_ */ #include "playground.h" /* PG_* */ #include "main.h" /* main_post_event_for_top_fsm */ +#include "chrono.h" #include "io.h" @@ -193,7 +194,7 @@ getsamples__TAKE_SAMPLES__arm_pass_noted_position (void) /* Prepare classification */ getsamples_configure_classifier (); /* More samples? */ - if (getsamples_data_.sample_bitfield) + if (getsamples_data_.sample_bitfield && !chrono_near_end_match ()) { /* Compute notifier */ getsamples_data_.arm_noted_position += BOT_ARM_THIRD_ROUND; diff --git a/digital/io/src/top.fsm b/digital/io/src/top.fsm index 9c1e6509..06db7b8f 100644 --- a/digital/io/src/top.fsm +++ b/digital/io/src/top.fsm @@ -82,9 +82,12 @@ GO_TO_SAMPLE_DISTRIBUTOR: we are now in front of our samples distributor, launch the get samples FSM GET_SAMPLES_FROM_SAMPLES_DISTRIBUTOR: - get_samples_fsm_finished -> GO_TO_OUR_ICE_DISTRIBUTOR + get_samples_fsm_finished: not_near_end_of_match -> GO_TO_OUR_ICE_DISTRIBUTOR we have finished to get our samples, let's go to our ice distributor with the move FSM + get_samples_fsm_finished: near_end_of_match -> GO_TO_GUTTER + we have finished to get our samples, but there is no time, let's go to the + gutter with the move FSM GO_TO_OUR_ICE_DISTRIBUTOR: move_fsm_finished -> GET_ICE_FROM_OUR_ICE_DISTRIBUTOR diff --git a/digital/io/src/top_cb.c b/digital/io/src/top_cb.c index 33f5c467..0cccdf38 100644 --- a/digital/io/src/top_cb.c +++ b/digital/io/src/top_cb.c @@ -108,16 +108,28 @@ top__MOVE_AWAY_FROM_START_BORDER__move_fsm_finished (void) /* * GET_SAMPLES_FROM_SAMPLES_DISTRIBUTOR =get_samples_fsm_finished=> - * => GO_TO_OUR_ICE_DISTRIBUTOR + * not_near_end_of_match => GO_TO_OUR_ICE_DISTRIBUTOR * we have finished to get our samples, let's go to our ice distributor with * the move FSM + * near_end_of_match => GO_TO_GUTTER + * we have finished to get our samples, but there is no time, let's go to the + * gutter with the move FSM */ fsm_branch_t top__GET_SAMPLES_FROM_SAMPLES_DISTRIBUTOR__get_samples_fsm_finished (void) { - /* Start the move FSM to our ice distributor */ - move_start (PG_DISTRIBUTOR_ICE_OUR_X, PG_DISTRIBUTOR_ICE_OUR_Y, 0); - return top_next (GET_SAMPLES_FROM_SAMPLES_DISTRIBUTOR, get_samples_fsm_finished); + if (!chrono_near_end_match ()) + { + /* Start the move FSM to our ice distributor */ + move_start (PG_DISTRIBUTOR_ICE_OUR_X, PG_DISTRIBUTOR_ICE_OUR_Y, 0); + return top_next_branch (GET_SAMPLES_FROM_SAMPLES_DISTRIBUTOR, get_samples_fsm_finished, not_near_end_of_match); + } + else + { + /* Go to gutter */ + move_start (PG_GUTTER_X, PG_GUTTER_Y, 0); + return top_next_branch (GET_SAMPLES_FROM_SAMPLES_DISTRIBUTOR, get_samples_fsm_finished, near_end_of_match); + } } /* -- cgit v1.2.3