summaryrefslogtreecommitdiffhomepage
path: root/digital/io-hub/src/apbirthday/strat.hh
diff options
context:
space:
mode:
authorNicolas Schodet2013-05-09 04:54:57 +0200
committerNicolas Schodet2013-05-09 04:54:57 +0200
commitf6d463f8f2e30cd4a633a7aab36f17ce56e513f5 (patch)
tree79e5bd5a0d5a56e7e764425e75af9ad7625202b4 /digital/io-hub/src/apbirthday/strat.hh
parente64c4c67b78a6adb26f592e7c5015f7a775b06d6 (diff)
digital/io-hub/src/apbirthday: change initial plate taking
Diffstat (limited to 'digital/io-hub/src/apbirthday/strat.hh')
-rw-r--r--digital/io-hub/src/apbirthday/strat.hh22
1 files changed, 22 insertions, 0 deletions
diff --git a/digital/io-hub/src/apbirthday/strat.hh b/digital/io-hub/src/apbirthday/strat.hh
index 3e6c7264..1f4365c6 100644
--- a/digital/io-hub/src/apbirthday/strat.hh
+++ b/digital/io-hub/src/apbirthday/strat.hh
@@ -49,6 +49,13 @@ class Strat
/// Information on a plate decision.
struct PlateDecision
{
+ /// Chosen plate.
+ int plate;
+ /// Leave movement after plate is taken.
+ bool leave;
+ /// 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;
@@ -65,7 +72,13 @@ class Strat
/// Movement direction.
Asserv::DirectionConsign dir;
};
+ /// Number of plates.
+ static const int plate_nb = 10;
public:
+ /// Constructor.
+ Strat ();
+ /// Color specific initialisation.
+ void color_init ();
/// Return new decision and associated position.
Decision decision (Position &pos);
/// Take a decision related to candles, return false to give up candles.
@@ -77,11 +90,20 @@ class Strat
void decision_gifts (GiftsDecision &decision);
/// Report a failure to apply the previous decision.
void failure ();
+ /// Report a success.
+ void success ();
private:
+ /// Compute best score for a plate.
+ int score_plate (Position &pos);
+ private:
+ /// Last taken decision.
+ Decision last_decision_;
/// Last plate decision.
PlateDecision plate_decision_;
/// Last gifts decision.
GiftsDecision gifts_decision_;
+ /// Plate visited?
+ bool plate_visited_[plate_nb];
};
#endif // strat_hh