From 39cd5564e451ade59dd9e61b5c5682c7eceabd55 Mon Sep 17 00:00:00 2001 From: Nicolas Haller Date: Fri, 22 May 2009 08:16:41 +0200 Subject: * digital/io/src: - fix the elevator loop event transition --- digital/io/src/filterbridge.fsm | 14 ++++++++++---- digital/io/src/filterbridge_cb.c | 24 ++++++++++++++---------- digital/io/src/main.c | 4 ++++ 3 files changed, 28 insertions(+), 14 deletions(-) (limited to 'digital') diff --git a/digital/io/src/filterbridge.fsm b/digital/io/src/filterbridge.fsm index 728c5615..c039fa7e 100644 --- a/digital/io/src/filterbridge.fsm +++ b/digital/io/src/filterbridge.fsm @@ -11,6 +11,8 @@ States: close access to the lift (and wait 1 sec) WAIT_A_PUCK waiting for a new puck + WAIT_LIFT_READY + waiting for elevator ready MARCEL_WAIT[timeout=45] waiting the puck is entirely in pos2 OPEN_DOOR[timeout=225] @@ -25,6 +27,8 @@ Events: robot start jack_inserted_into_bot jack into the bot + lift_ready + the elevator is ready puck_on_pos2 a puck has been detected on bridge's position 2 no_puck_on_pos2 @@ -45,10 +49,12 @@ CLOSE_DOOR: we are ready, we wait a puck WAIT_A_PUCK: - puck_on_pos2: lift_not_ready -> . - Lift not ready, we stand by - puck_on_pos2: lift_ready -> MARCEL_WAIT - wait the puck is entirely on pos2 + puck_on_pos2 -> WAIT_LIFT_READY + Puck ready to be dropped to the elevator. Test if elvt ready to get it. + +WAIT_LIFT_READY: + lift_ready -> MARCEL_WAIT + the lift is ready MARCEL_WAIT: state_timeout -> OPEN_DOOR diff --git a/digital/io/src/filterbridge_cb.c b/digital/io/src/filterbridge_cb.c index 0c29e495..2b4e452d 100644 --- a/digital/io/src/filterbridge_cb.c +++ b/digital/io/src/filterbridge_cb.c @@ -71,20 +71,24 @@ filterbridge__CLOSE_DOOR__state_timeout (void) /* * WAIT_A_PUCK =puck_on_pos2=> - * lift_not_ready => WAIT_A_PUCK - * Lift not ready, we stand by - * lift_ready => MARCEL_WAIT - * wait the puck is entirely on pos2 + * => WAIT_LIFT_READY + * Puck ready to be dropped to the elevator. Test if elvt ready to get it. */ fsm_branch_t filterbridge__WAIT_A_PUCK__puck_on_pos2 (void) { - if(elvt_is_ready) - { - return filterbridge_next_branch (WAIT_A_PUCK, puck_on_pos2, lift_ready); - } - else - return filterbridge_next_branch (WAIT_A_PUCK, puck_on_pos2, lift_not_ready); + return filterbridge_next (WAIT_A_PUCK, puck_on_pos2); +} + +/* + * WAIT_LIFT_READY =lift_ready=> + * => MARCEL_WAIT + * the lift is ready + */ +fsm_branch_t +filterbridge__WAIT_LIFT_READY__lift_ready (void) +{ + return filterbridge_next (WAIT_LIFT_READY, lift_ready); } /* diff --git a/digital/io/src/main.c b/digital/io/src/main.c index 23d70b5a..dbe5eddd 100644 --- a/digital/io/src/main.c +++ b/digital/io/src/main.c @@ -256,6 +256,10 @@ main_event_to_fsm (void) if(cylinder_distributor_fucked) FSM_HANDLE_EVENT (&cylinder_fsm, CYLINDER_EVENT_distrib_fucked); + /* elevator is ready */ + if(elvt_is_ready) + FSM_HANDLE_EVENT (&filterbridge_fsm, + FILTERBRIDGE_EVENT_lift_ready); /* bot empty */ if(top_puck_inside_bot < 4) -- cgit v1.2.3