summaryrefslogtreecommitdiff
path: root/i/marvin/src/ai/ai.cc
diff options
context:
space:
mode:
Diffstat (limited to 'i/marvin/src/ai/ai.cc')
-rw-r--r--i/marvin/src/ai/ai.cc67
1 files changed, 58 insertions, 9 deletions
diff --git a/i/marvin/src/ai/ai.cc b/i/marvin/src/ai/ai.cc
index d9bfd0a..986f53b 100644
--- a/i/marvin/src/ai/ai.cc
+++ b/i/marvin/src/ai/ai.cc
@@ -130,15 +130,21 @@ Ai::waitJack (bool out)
void
Ai::prepare (void)
{
+ es_.setOthersStat (10);
+ while (!update ());
// XXX We should check if the jack is not already in
// We first wait for the jack to be put inside
waitJack (false);
// We reference all the color
referenceSensors ();
+ es_.barilletInit();
+ while (!update ());
// We first wait for the jack to be put inside
waitJack (true);
// Ok the match begin ! Go go go !
Timer::startRound ();
+ es_.setOthersStat (0);
+ while (!update ());
}
/// Reference sensors
@@ -160,26 +166,69 @@ void Ai::progHomoloRobal(void)
{
/// On init le robal
prepare();
- /// PAF BEGIN!!! (lancer le timer)
- Timer::startRound();
+ es_.barilletDebutLancement();
+ while (!update ());
+ temporisation (1000);
+ es_.barilletLancement();
+ while (!update ());
/// on avance un poil parce que le mur c'est mal
- motor_.move(400, 0);
+ motorMove(500, 0);
+ motorRotate(-0.54);
+ motorMove(1200, 0);
+ motorRotate(M_PI);
+ motorFindHole ();
+
/// On tourne XXX
- motor_.rotate(-M_PI/4);
+/// motorRotate(-M_PI/4);
/// On cherche au moins une balle (sinon c'est con)
- es_.barilletLancement();
- motor_.move(1000, 0); /// XXX Voir la distance
+/// motorMove(1000, 0); /// XXX Voir la distance
/// XXX Avancer d'une certaine facon pour choper des balles
/// XXX Ouais ba y'a encore ddes truc à faire là
/// On cherche un tru (repositionnement??)
- motor_.lockGoodHole();
- motor_.findHole();
+/// motor_.lockGoodHole();
+/// while (!update ());
+/// motor_.findHole();
+/// while (!update ());
/// On trouve un trou, chouette
/// Aspirer le trou
- es_.extraitBalle();
+ //es_.extraitBalle();
/// mettre une baballe
es_.dropWhiteBall();
+ while (!update ());
/// Tourner 3 fois en chantant du Mickael Jackson
/// Again....
/// Fin du match
}
+
+void
+Ai::motorMove (int d, int a)
+{
+ motor_.move(d, a); /// XXX Voir la distance
+ do
+ {
+ update ();
+ }
+ while (!motor_.finish ());
+}
+
+void
+Ai::motorRotate (double d)
+{
+ motor_.rotate (d);
+ do
+ {
+ update ();
+ }
+ while (!motor_.finish ());
+}
+
+void
+Ai::motorFindHole (void)
+{
+ motor_.findHole ();
+ do
+ {
+ update ();
+ }
+ while (!motor_.finish ());
+}