From df86960a8825149382e162e04ef37667f0ebdd37 Mon Sep 17 00:00:00 2001 From: Jérémy Dufour Date: Mon, 18 May 2009 13:03:52 +0200 Subject: * digital/io/src: - add event for the last command sent to the asserv board has been acquited, - make init FSM finish by returning to IDLE state (and not moving and moving again), - when in position, do a last turn, to face in the right position. --- digital/io/src/init.fsm | 5 ++++- digital/io/src/init_cb.c | 8 ++++---- digital/io/src/main.c | 6 ++++-- 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/digital/io/src/init.fsm b/digital/io/src/init.fsm index 8b9aa4dc..faf41e2b 100644 --- a/digital/io/src/init.fsm +++ b/digital/io/src/init.fsm @@ -34,6 +34,9 @@ Events: move_done the move is finished state_timeout + timeout. + asserv_last_cmd_ack + last command sent to the asserv board acquited. IDLE: start -> WAIT_JACK_IN @@ -68,5 +71,5 @@ GO_BACKWARD_AGAIN: set real position to asserv SET_POSITION: - move_done -> TURN_90_DEGREES_CCW + asserv_last_cmd_ack -> IDLE turn bot for 180 degrees counterclockwise diff --git a/digital/io/src/init_cb.c b/digital/io/src/init_cb.c index ff9f00c8..1f681d47 100644 --- a/digital/io/src/init_cb.c +++ b/digital/io/src/init_cb.c @@ -131,15 +131,15 @@ init__GO_BACKWARD_AGAIN__move_done (void) } /* - * SET_POSITION =move_done=> - * => TURN_90_DEGREES_CCW + * SET_POSITION =asserv_last_cmd_ack=> + * => IDLE * turn bot for 180 degrees counterclockwise */ fsm_branch_t -init__SET_POSITION__move_done (void) +init__SET_POSITION__asserv_last_cmd_ack (void) { asserv_goto_angle (PG_A_VALUE_COMPUTING (0 * BOT_ANGLE_DEGREE)); - return init_next (SET_POSITION, move_done); + return init_next (SET_POSITION, asserv_last_cmd_ack); } diff --git a/digital/io/src/main.c b/digital/io/src/main.c index fba5b9b3..cabe9734 100644 --- a/digital/io/src/main.c +++ b/digital/io/src/main.c @@ -141,8 +141,10 @@ main_event_to_fsm (void) FSM_HANDLE_TIMEOUT (&elevator_fsm); FSM_HANDLE_TIMEOUT (&cylinder_fsm); - /* FIXME: rename and generalise this event. */ - FSM_HANDLE_EVENT (&top_fsm, TOP_EVENT_settings_acknowledged); + /* If we have entering this function, last command of the asserv board has + * been aquited. + * FIXME: other FSM need it? */ + FSM_HANDLE_EVENT (&init_fsm, INIT_EVENT_asserv_last_cmd_ack); asserv_status_e move_status = none, -- cgit v1.2.3