summaryrefslogtreecommitdiffhomepage
path: root/digital/io-hub/src/apbirthday
diff options
context:
space:
mode:
authorNicolas Schodet2013-05-09 01:54:04 +0200
committerNicolas Schodet2013-05-09 01:54:04 +0200
commite64c4c67b78a6adb26f592e7c5015f7a775b06d6 (patch)
treea70c2ed1c73b0c946293c36580f0061b8127c42b /digital/io-hub/src/apbirthday
parentb9cbd50a836e9b2186a36226b9dd80407e8598a4 (diff)
digital/io-hub/src/apbirthday: always drop plates
Diffstat (limited to 'digital/io-hub/src/apbirthday')
-rw-r--r--digital/io-hub/src/apbirthday/strat.cc15
-rw-r--r--digital/io-hub/src/apbirthday/strat.hh5
-rw-r--r--digital/io-hub/src/apbirthday/top.cc30
3 files changed, 13 insertions, 37 deletions
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)
{
}