summaryrefslogtreecommitdiffhomepage
path: root/digital/io-hub/src/apbirthday/strat.cc
diff options
context:
space:
mode:
authorNicolas Schodet2013-04-20 16:48:20 +0200
committerNicolas Schodet2013-04-22 23:45:50 +0200
commitdff9259a55383a5892987f8a3b640a0c0e26cbfc (patch)
tree840042f87dece2061c46c66291c12ff9ef52a78c /digital/io-hub/src/apbirthday/strat.cc
parent89e487abcff9d0f08befa5cc9ea69dc316a9e315 (diff)
digital/io-hub/src/apbirthday: plate loading behaviour
Diffstat (limited to 'digital/io-hub/src/apbirthday/strat.cc')
-rw-r--r--digital/io-hub/src/apbirthday/strat.cc35
1 files changed, 32 insertions, 3 deletions
diff --git a/digital/io-hub/src/apbirthday/strat.cc b/digital/io-hub/src/apbirthday/strat.cc
index 328c1298..9950cdc6 100644
--- a/digital/io-hub/src/apbirthday/strat.cc
+++ b/digital/io-hub/src/apbirthday/strat.cc
@@ -25,13 +25,36 @@
#include "robot.hh"
#include "top.hh"
#include "debug.host.hh"
+#include "bot.hh"
Strat::Decision
-Strat::decision (vect_t &pos)
+Strat::decision (Position &pos)
{
// TODO: this is a stub.
- pos = pg_cake_pos;
- return CANDLES;
+ static int step;
+ static const int plate_app = pg_plate_size_border + BOT_SIZE_RADIUS + 20;
+ static const int plate_load = pg_plate_size_border + BOT_SIZE_BACK - 40;
+ switch (step++)
+ {
+ case 0:
+ plate_decision_.drop = false;
+ plate_decision_.approaching_pos =
+ pg_position_deg (200, 250 + plate_app, 90);
+ plate_decision_.loading_pos = pg_vect (200, 250 + plate_load);
+ pos = plate_decision_.approaching_pos;
+ return PLATE;
+ case 1:
+ plate_decision_.drop = true;
+ plate_decision_.approaching_pos =
+ pg_position_deg (200, 1000 - plate_app, -90);
+ plate_decision_.loading_pos = pg_vect (200, 1000 - plate_load);
+ pos = pg_position_deg (200, 250 + plate_load, 90);
+ return PLATE;
+ default:
+ pos.v = pg_cake_pos;
+ pos.a = 0;
+ return CANDLES;
+ }
}
/// Compute score for candles between first and last.
@@ -97,6 +120,12 @@ Strat::decision_candles (CandlesDecision &decision, uint16_t robot_angle)
}
void
+Strat::decision_plate (PlateDecision &decision)
+{
+ decision = plate_decision_;
+}
+
+void
Strat::failure ()
{
}