summaryrefslogtreecommitdiff
path: root/i/marvin/src/ai
diff options
context:
space:
mode:
authordufourj2006-05-26 08:12:24 +0000
committerdufourj2006-05-26 08:12:24 +0000
commit56e637ec77fc6c220009663dcc35712e399bfd5d (patch)
treed3ebab75458fdce937169fcd2931283e0c1bd3ee /i/marvin/src/ai
parentdd7faf987331073d71248bd84f5a113ad9629a29 (diff)
Général :
- commit du programme d'après premier match.
Diffstat (limited to 'i/marvin/src/ai')
-rw-r--r--i/marvin/src/ai/ai.cc63
-rw-r--r--i/marvin/src/ai/ai.hh2
-rw-r--r--i/marvin/src/ai/test_ai.cc2
3 files changed, 52 insertions, 15 deletions
diff --git a/i/marvin/src/ai/ai.cc b/i/marvin/src/ai/ai.cc
index ac06157..19f3cca 100644
--- a/i/marvin/src/ai/ai.cc
+++ b/i/marvin/src/ai/ai.cc
@@ -133,7 +133,6 @@ void
Ai::prepare (void)
{
es_.lcdPrint("");
- es_.lcdPrint("");
es_.lcdPrint("Prepa match...");
es_.lcdPrint("Inserer Jack");
es_.setOthersStat (10);
@@ -146,8 +145,8 @@ Ai::prepare (void)
// Set actual position
motor_.getAsserv().setPos(0,0,0);
es_.barilletInit();
- es_.lcdPrint("Virer le jack...");
- es_.lcdPrint("PRET POUR MATCH");
+ es_.lcdPrint("Barillet pret ?");
+ es_.lcdPrint("Virer le jack !");
while (!update ());
// We first wait for the jack to be put inside
waitJack (true);
@@ -166,7 +165,7 @@ Ai::afterMatch(void)
{
// On attend de mettre le jack après le match
es_.lcdPrint("FIN DU MATCH");
- es_.lcdPrint("Inserer jack...");
+// es_.lcdPrint("Inserer jack...");
while (!update());
waitJack(false);
// On vide le barillet
@@ -260,7 +259,8 @@ void Ai::progHomoloRobal(void)
void
Ai::progMatch(void)
{
- bool isFinish;
+ init ();
+// bool isFinish;
/// On prépare le robot
prepare();
/// Faire des crêpes...
@@ -270,21 +270,56 @@ Ai::progMatch(void)
temporisation (1000);
es_.barilletLancement();
while (!update ());
+ log_ ("match") << "Totem activator";
+ es_.totemActivator (true);
/// En avant guingamp
+ log_ ("match") << "Eloignement du bord";
motorMove(480,0);
/// On tourner de -90°
- motorMove(432,432);
+ log_ ("match") << "Petite rotation de 90°";
+ motorMove(216,-216);
/// On dit bonjour au mur
- if(motorMove(900, 0))
- motorMove(200, 0);
+ log_ ("match") << "Va à l'opposé";
+ if (!motorMove (1000, 0))
+ {
+ log_ ("match") << "Un mur ! Reculons";
+ motorMove (-70, 0);
+ }
+// motorMove(200, 0);
/// On tourne bizarrement mais de 90°
- motorMove(-72,-72);
- motorMove(360,-360);
+ log_ ("match") << "On tourne à 90° en deux fois";
+ motorMove(-36,36);
+ motorMove(190, 190);
/// On avance un peu
- motorMove(150,0);
- // On tourne de 90°
- motorMove(432,-432);
- motorMove(1400,0);
+// log_ ("match") << "On recule un peu";
+// motorMove (-110, 0);
+// // On tourne de 90°
+// log_ ("match") << "On tourne vers le totem";
+// motorMove (216, 216);
+// log_ ("match") << "On avance";
+// motorMove (950, 0);
+// log_ ("match") << "Petite rotation de 90° droite";
+// motorMove (316, -316);
+// motorMove (800, 0);
+// motorBasicFindHole ();
+ log_ ("match") << "On avance de l'autre coté";
+ motorMove (1320, 0);
+ log_ ("match") << "On recule un peu";
+ motorMove (-420, 0);
+ log_ ("match") << "On tourne";
+ motorMove (150, 150);
+ motorBasicFindHole ();
+ es_.dropWhiteBall();
+ while (!update ());
+ temporisation (3000);
+ es_.deposeBalle ();
+ while (!update ());
+ motorBasicFindHole ();
+ es_.dropWhiteBall();
+ while (!update ());
+ temporisation (3000);
+ es_.deposeBalle ();
+
afterMatch();
}
diff --git a/i/marvin/src/ai/ai.hh b/i/marvin/src/ai/ai.hh
index b7b0833..e3f7e19 100644
--- a/i/marvin/src/ai/ai.hh
+++ b/i/marvin/src/ai/ai.hh
@@ -76,7 +76,7 @@ class Ai
void progHomoloRobal(void);
/// programme de match du robal
void progMatch(void);
- void motorMove (int d, int a);
+ bool motorMove (int d, int a);
void motorRotate (double d);
void motorBasicFindHole (void);
int motorSmartFindHole (double distOut);
diff --git a/i/marvin/src/ai/test_ai.cc b/i/marvin/src/ai/test_ai.cc
index dd51b7d..6a7d09f 100644
--- a/i/marvin/src/ai/test_ai.cc
+++ b/i/marvin/src/ai/test_ai.cc
@@ -79,6 +79,8 @@ class TestAi : public Tester
"Programme d'homologation du robal");
interpreter.add("match", Interpreter::memFunc(ai_, &Ai::progMatch),
"Programme de match qui déchire du robal");
+ interpreter.add("findHoleBasic", Interpreter::memFunc(ai_, &Ai::motorBasicFindHole),
+ "Find a hole, basic version");
interpreter.add ("_postcall",
Interpreter::memFunc (*this, &TestAi::postcall));
}