From f8506e55841f86ef2c385eac31aa8cdb53349b8a Mon Sep 17 00:00:00 2001 From: Jérémy Dufour Date: Fri, 22 May 2009 07:14:25 +0200 Subject: * digital/io/src: - fix angle for clean distributor position, - when we do not need to stop move FSM to go somewhere else, do not stop it. --- digital/io/src/top.c | 4 ++-- digital/io/src/top.fsm | 4 ++-- digital/io/src/top_cb.c | 25 ++++++++----------------- 3 files changed, 12 insertions(+), 21 deletions(-) (limited to 'digital/io') diff --git a/digital/io/src/top.c b/digital/io/src/top.c index 7cdeacef..af9d0ff7 100644 --- a/digital/io/src/top.c +++ b/digital/io/src/top.c @@ -85,9 +85,9 @@ top_get_next_position_to_get_distributor (asserv_position_t *clean_position, /* First distributor. */ { { 2711, 0 + DISTRIBUTOR_PROTECTION, 270 }, { 2711, DISTRIBUTOR_PROTECTION, 270 } }, /* Second distributor. */ - { { PG_WIDTH - DISTRIBUTOR_PROTECTION, 600, 90 }, { PG_WIDTH - DISTRIBUTOR_PROTECTION, 800, 0 } }, + { { PG_WIDTH - DISTRIBUTOR_PROTECTION, 600, 270 }, { PG_WIDTH - DISTRIBUTOR_PROTECTION, 800, 0 } }, /* Third distributor. */ - { { PG_WIDTH - DISTRIBUTOR_PROTECTION, 1100, 90 }, { PG_WIDTH - DISTRIBUTOR_PROTECTION, 1300, 0 } }, + { { PG_WIDTH - DISTRIBUTOR_PROTECTION, 1100, 270 }, { PG_WIDTH - DISTRIBUTOR_PROTECTION, 1300, 0 } }, }; /* Maximum number of remaining puck by distributor. */ static uint8_t distributor_puck_count[DISTRIBUTOR_COUNT] = { 5, 5, 5 }; diff --git a/digital/io/src/top.fsm b/digital/io/src/top.fsm index d59eea08..cd8517a1 100644 --- a/digital/io/src/top.fsm +++ b/digital/io/src/top.fsm @@ -82,12 +82,12 @@ GET_PUCK_FROM_THE_GROUND: move_fsm_succeed: already_six_pucks_or_no_next_position_and_no_puck -> GET_PUCK_FROM_DISTRIBUTOR close cylinder. get the next distributor position and launch move FSM to go there. - move_fsm_succeed: already_six_pucks_or_no_next_position_and_some_puck -> STOP_TO_GO_TO_UNLOAD_AREA + move_fsm_succeed: already_six_pucks_or_no_next_position_and_some_puck -> GO_TO_UNLOAD_AREA close cylinder. get the next distributor position and launch move FSM to go there. move_fsm_succeed: next_position_exists -> . go to the next position using move FSM. - move_fsm_failed -> STOP_TO_GO_TO_UNLOAD_AREA + move_fsm_failed -> GO_TO_UNLOAD_AREA close cylinder. we have failed to do a move, go the distributor (get next distributor and go there with move FSM). diff --git a/digital/io/src/top_cb.c b/digital/io/src/top_cb.c index 3dd7bafe..ce6d6db4 100644 --- a/digital/io/src/top_cb.c +++ b/digital/io/src/top_cb.c @@ -78,7 +78,7 @@ top__WAIT_INIT_TO_FINISH__init_match_is_started (void) * already_six_pucks_or_no_next_position_and_no_puck => GET_PUCK_FROM_DISTRIBUTOR * close cylinder. * get the next distributor position and launch move FSM to go there. - * already_six_pucks_or_no_next_position_and_some_puck => STOP_TO_GO_TO_UNLOAD_AREA + * already_six_pucks_or_no_next_position_and_some_puck => GO_TO_UNLOAD_AREA * close cylinder. * get the next distributor position and launch move FSM to go there. * next_position_exists => GET_PUCK_FROM_THE_GROUND @@ -107,8 +107,6 @@ top__GET_PUCK_FROM_THE_GROUND__move_fsm_succeed (void) } else { - /* Go there. */ - move_start (position, ASSERV_BACKWARD); /* Go to distributor. */ top_get_next_position_to_get_distributor (&position, &front_position); /* Go there. */ @@ -126,7 +124,7 @@ top__GET_PUCK_FROM_THE_GROUND__move_fsm_succeed (void) /* * GET_PUCK_FROM_THE_GROUND =move_fsm_failed=> - * => STOP_TO_GO_TO_UNLOAD_AREA + * => GO_TO_UNLOAD_AREA * close cylinder. * we have failed to do a move, go the distributor (get next distributor and go * there with move FSM). @@ -134,14 +132,14 @@ top__GET_PUCK_FROM_THE_GROUND__move_fsm_succeed (void) fsm_branch_t top__GET_PUCK_FROM_THE_GROUND__move_fsm_failed (void) { - asserv_position_t position; - /* Ensure cylinder is close. */ cylinder_close_order = 1; /* Flush cylinder. */ cylinder_flush_order = 1; - top_get_next_position_to_get_puck_on_the_ground (&position, 0); + asserv_position_t position; + /* Go to unload area. */ + top_get_next_position_to_unload_puck (&position); /* Go there. */ - move_start (position, 0); + move_start (position, ASSERV_BACKWARD); return top_next (GET_PUCK_FROM_THE_GROUND, move_fsm_failed); } @@ -155,8 +153,6 @@ top__GET_PUCK_FROM_THE_GROUND__bot_is_full_of_pucks (void) { /* Ensure cylinder is close. */ cylinder_close_order = 1; - /* Flush cylinder. */ - cylinder_flush_order = 1; /* Stop move FSM. */ move_stop (); return top_next (GET_PUCK_FROM_THE_GROUND, bot_is_full_of_pucks); @@ -178,13 +174,8 @@ top__GET_PUCK_FROM_THE_GROUND__state_timeout (void) cylinder_close_order = 1; if (top_puck_inside_bot) { - /* Flush cylinder. */ - cylinder_flush_order = 1; - asserv_position_t position; - /* Go to unload area. */ - top_get_next_position_to_unload_puck (&position); - /* Go there. */ - move_start (position, ASSERV_BACKWARD); + /* Stop move FSM. */ + move_stop (); return top_next_branch (GET_PUCK_FROM_THE_GROUND, state_timeout, some_pucks); } else -- cgit v1.2.3