From e64c4c67b78a6adb26f592e7c5015f7a775b06d6 Mon Sep 17 00:00:00 2001 From: Nicolas Schodet Date: Thu, 9 May 2013 01:54:04 +0200 Subject: digital/io-hub/src/apbirthday: always drop plates --- digital/io-hub/src/apbirthday/strat.cc | 15 ++++----------- digital/io-hub/src/apbirthday/strat.hh | 5 ----- digital/io-hub/src/apbirthday/top.cc | 30 +++++++++--------------------- 3 files changed, 13 insertions(+), 37 deletions(-) (limited to 'digital') diff --git a/digital/io-hub/src/apbirthday/strat.cc b/digital/io-hub/src/apbirthday/strat.cc index 446b8b7a..ea1c1ff6 100644 --- a/digital/io-hub/src/apbirthday/strat.cc +++ b/digital/io-hub/src/apbirthday/strat.cc @@ -39,23 +39,16 @@ Strat::decision (Position &pos) switch (step++) { case 0: - plate_decision_.drop = false; - plate_decision_.approaching_pos = - pg_position_deg (200, 600 + plate_app, 90); - plate_decision_.approaching_pos.v.x -= 35; + pos = pg_position_deg (200, 600 + plate_app, 90); + pos.v.x -= 35; plate_decision_.loading_pos = pg_vect (200, 600 + plate_load); plate_decision_.loading_pos.x -= 35; - pos = plate_decision_.approaching_pos; return PLATE; case 1: - plate_decision_.drop = true; - plate_decision_.approaching_pos = - pg_position_deg (200, 1400 - plate_app, -90); - plate_decision_.approaching_pos.v.x += 35; + pos = pg_position_deg (200, 1400 - plate_app, -90); + pos.v.x += 35; plate_decision_.loading_pos = pg_vect (200, 1400 - plate_load); plate_decision_.loading_pos.x += 35; - pos = pg_position_deg (200, 600 + plate_load, 90); - pos.v.x -= 35; return PLATE; case 3: gifts_decision_.go_first = true; diff --git a/digital/io-hub/src/apbirthday/strat.hh b/digital/io-hub/src/apbirthday/strat.hh index f5266827..3e6c7264 100644 --- a/digital/io-hub/src/apbirthday/strat.hh +++ b/digital/io-hub/src/apbirthday/strat.hh @@ -49,11 +49,6 @@ class Strat /// Information on a plate decision. struct PlateDecision { - /// Should drop plate before. - bool drop; - /// Approach position, where the robot should be before starting - /// approaching. - Position approaching_pos; /// Loading position, point where to go backward to load the plate. If /// the point is reached, there is no plate. vect_t loading_pos; diff --git a/digital/io-hub/src/apbirthday/top.cc b/digital/io-hub/src/apbirthday/top.cc index 4fd39c36..7372576b 100644 --- a/digital/io-hub/src/apbirthday/top.cc +++ b/digital/io-hub/src/apbirthday/top.cc @@ -495,21 +495,10 @@ FSM_TRANS (TOP_CANDLES_LEAVE_GO_AWAY, robot_move_failure, TOP_DECISION) /// Plate. /// -FSM_TRANS (TOP_PLATE_GOTO, move_success, - load, TOP_PLATE_APPROACH, - drop, TOP_PLATE_DROPING) +FSM_TRANS (TOP_PLATE_GOTO, move_success, TOP_PLATE_APPROACH) { - if (top.plate.drop) - { - ANGFSM_HANDLE (AI, plate_drop); - return FSM_BRANCH (drop); - } - else - { - robot->asserv.set_speed (BOT_SPEED_PLATE); - robot->move.start (top.plate.loading_pos, Asserv::BACKWARD); - return FSM_BRANCH (load); - } + robot->asserv.set_speed (BOT_SPEED_PLATE); + robot->move.start (top.plate.loading_pos, Asserv::BACKWARD); } FSM_TRANS (TOP_PLATE_GOTO, move_failure, TOP_DECISION) @@ -517,12 +506,6 @@ FSM_TRANS (TOP_PLATE_GOTO, move_failure, TOP_DECISION) robot->strat.failure (); } -FSM_TRANS (TOP_PLATE_DROPING, plate_droped, TOP_PLATE_GOTO) -{ - top.plate.drop = false; - robot->move.start (top.plate.approaching_pos, Asserv::BACKWARD_REVERT_OK); -} - FSM_TRANS (TOP_PLATE_APPROACH, move_success, TOP_DECISION) { // TODO: no plate. @@ -540,7 +523,12 @@ FSM_TRANS (TOP_PLATE_APPROACH, top_plate_present, TOP_PLATE_LOADING) ANGFSM_HANDLE (AI, plate_take); } -FSM_TRANS (TOP_PLATE_LOADING, plate_taken, TOP_DECISION) +FSM_TRANS (TOP_PLATE_LOADING, plate_taken, TOP_PLATE_DROPING) +{ + ANGFSM_HANDLE (AI, plate_drop); +} + +FSM_TRANS (TOP_PLATE_DROPING, plate_droped, TOP_DECISION) { } -- cgit v1.2.3