summaryrefslogtreecommitdiff
path: root/i/marvin/src/ai/ai.cc
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/ai.cc
parentdd7faf987331073d71248bd84f5a113ad9629a29 (diff)
Général :
- commit du programme d'après premier match.
Diffstat (limited to 'i/marvin/src/ai/ai.cc')
-rw-r--r--i/marvin/src/ai/ai.cc63
1 files changed, 49 insertions, 14 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 aprs 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 prpare le robot
prepare();
/// Faire des crpes...
@@ -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();
}