summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhaller2006-05-25 05:14:33 +0000
committerhaller2006-05-25 05:14:33 +0000
commit01f9051ce4d7221a588a2d3853f15662911986f9 (patch)
tree7d679e0ca7fe6ca04c49a66e15049eeca576fc91
parentbcb580848f8e9106dd9d07249636a0f2736dabe3 (diff)
Codage de l'AI d'homologation...
-rw-r--r--i/marvin/src/ai/ai.cc67
-rw-r--r--i/marvin/src/ai/ai.hh3
2 files changed, 61 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 ());
+}
diff --git a/i/marvin/src/ai/ai.hh b/i/marvin/src/ai/ai.hh
index 8d673e5..f0143ec 100644
--- a/i/marvin/src/ai/ai.hh
+++ b/i/marvin/src/ai/ai.hh
@@ -72,5 +72,8 @@ class Ai
void referenceSensors (void);
/// programme d'homologation du robal
void progHomoloRobal(void);
+ void motorMove (int d, int a);
+ void motorRotate (double d);
+ void motorFindHole (void);
};
#endif // ai_hh