From a1c8880ef806ba64f5f985cec8e845f01ebae228 Mon Sep 17 00:00:00 2001 From: Nicolas Schodet Date: Sat, 2 Jun 2012 00:31:12 +0200 Subject: digital/io-hub/src/guybrush: wait when unloading --- digital/io-hub/src/guybrush/top.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'digital/io-hub/src/guybrush') diff --git a/digital/io-hub/src/guybrush/top.c b/digital/io-hub/src/guybrush/top.c index 2bc6c8e1..10f65c7f 100644 --- a/digital/io-hub/src/guybrush/top.c +++ b/digital/io-hub/src/guybrush/top.c @@ -111,7 +111,9 @@ FSM_STATES ( /* Going to an unload position. */ TOP_UNLOAD_GOING, /* Going back in unload zone. */ - TOP_UNLOAD_GOING_BACK) + TOP_UNLOAD_GOING_BACK, + /* Unloading, waiting for elements to fall. */ + TOP_UNLOADING) FSM_START_WITH (TOP_START) @@ -678,18 +680,23 @@ FSM_TRANS (TOP_UNLOAD_GOING, move_success, } } -FSM_TRANS (TOP_UNLOAD_GOING_BACK, robot_move_success, TOP_DECISION) +FSM_TRANS (TOP_UNLOAD_GOING_BACK, robot_move_success, TOP_UNLOADING) { top_do_unload (); return FSM_NEXT (TOP_UNLOAD_GOING_BACK, robot_move_success); } -FSM_TRANS (TOP_UNLOAD_GOING_BACK, robot_move_failure, TOP_DECISION) +FSM_TRANS (TOP_UNLOAD_GOING_BACK, robot_move_failure, TOP_UNLOADING) { top_do_unload (); return FSM_NEXT (TOP_UNLOAD_GOING_BACK, robot_move_failure); } +FSM_TRANS_TIMEOUT (TOP_UNLOADING, 250, TOP_DECISION) +{ + return FSM_NEXT_TIMEOUT (TOP_UNLOADING); +} + /** UNLOAD failures. */ FSM_TRANS (TOP_UNLOAD_GOING, move_failure, TOP_DECISION) -- cgit v1.2.3