summaryrefslogtreecommitdiff
path: root/i/chuck/src/ai
diff options
context:
space:
mode:
authorbecquet2007-05-17 10:14:02 +0000
committerbecquet2007-05-17 10:14:02 +0000
commitf17f84ea7c045ce1b56416a008edaa411ff749cc (patch)
tree429023654d823eb991365babf9b3ab03e5a729b5 /i/chuck/src/ai
parentf172d87ec5c9a94b33d00fa72541b85542228b68 (diff)
Diffstat (limited to 'i/chuck/src/ai')
-rw-r--r--i/chuck/src/ai/ai.cc64
-rw-r--r--i/chuck/src/ai/test_ai.cc5
2 files changed, 40 insertions, 29 deletions
diff --git a/i/chuck/src/ai/ai.cc b/i/chuck/src/ai/ai.cc
index 8ff967a..0810990 100644
--- a/i/chuck/src/ai/ai.cc
+++ b/i/chuck/src/ai/ai.cc
@@ -137,9 +137,9 @@ Ai::prepare (void)
{
es_.lcdPrint("");
es_.lcdPrint("Prepa match...");
- coefcolor=es_.setcolorsens();
es_.lcdPrint("G ma couleur");
es_.lcdPrint("Inserer Jack");
+ std::cout<<"insere jak"<<std::endl;
es_.setOthersStat (10);
while (!update ());
// XXX We should check if the jack is not already in
@@ -150,12 +150,17 @@ Ai::prepare (void)
// We first wait for the jack to be put inside
waitJack (true);
// Set actual position
+ std::cout<<"jak retire"<<std::endl;
+ coefcolor=es_.setcolorsens();
motor_.getAsserv().setPos(0,0,0);
// Ok the match begin ! Go go go !
Timer::startRound ();
//on fait tomber le roulo apré le top départ
es_.roulo_tombe();
+ temporisation(1500);
+ es_.roulo_roule(0xD8);
es_.setOthersStat (0);
+ std::cout<<"le roulo auré du tombé"<<std::endl;
// Shut up fucking beach !
es_.setOthersStat (0);
es_.setOthersStat (0);
@@ -246,47 +251,48 @@ Ai::progMatch(void)
while (!update ());
/// En avant guingamp
log_ ("match") << "Eloignement du bord";
- motorMove(900,0);//On fonce tout droit
+ motorMove(1300,0);//On fonce tout droit
while (!update ());
/// On tourner de 45°
log_ ("match") << "Petite rotation de 45°";
motorRotate(R45*(coefcolor));
+ std::cout<<"première rot"<<std::endl;
///On avance a travers les ordures euh on est sensé en ramacer
- motorMove(900.,0.);
+ motorMove(1900.,0.);
- ///On se positionne pour la marche arrière
- motorRotate(R45*(-3)*(coefcolor));
+
+
+
+ while(!update())
+ {
+ ///On se positionne pour la marche arrière
+ motorRotate(R45*(5)*(coefcolor));
+
///tuuutuuuutuuuuu je fait mon crénau
log_ ("match") << "Creneau";
- if (!motorMove (1000, 0))
- {
- log_ ("match") << "Un mur ! Reculons";
- motorMove (-60, 0);
- }
- /// On tourne bizarrement mais de 90°
- log_ ("match") << "On tourne à 90° en deux fois";
- motorMove(-36,36);
- motorMove(180, 180);
- /// On avance un peu
- log_ ("match") << "On avance de l'autre coté";
- motorMove (1420, 0);
- log_ ("match") << "On recule un peu";
- motorMove (-150, 0);
- log_ ("match") << "On tourne";
- motorMove (216, 216);
- motorMove (-150, 0);
+ //bool ok = motor_.docreno();
+ motorMove(-500.,0.);
+ es_.bouge_ascenceur(0x50,0xFF,0x00);
+
+ while (!update ());
+ //on avance un peu
+ motorMove(400.,0.);
+ //direction le tas d'ordure
+ while (!update ());
+ motorRotate(R45*(-1)*coefcolor);
+ motorMove(450.,0.);
- /* Here, we are in front of all our holes */
+ while (!update ());
+ //demitour
+ motorRotate(R90);
+ while (!update ());
- int rotationSens = 1;
- const double distanceMax[2] = { -1600., 200. };
- // Force a turn back !
- double distanceCur, remainingDist;
- int ret;
+ motorMove(450.,0.);
- /* Save angle */
+ }
+ /* Save angle */
motor_.getPosition (dummy, dummy, aStart);
afterMatch();
}
diff --git a/i/chuck/src/ai/test_ai.cc b/i/chuck/src/ai/test_ai.cc
index 661384f..1993036 100644
--- a/i/chuck/src/ai/test_ai.cc
+++ b/i/chuck/src/ai/test_ai.cc
@@ -57,6 +57,11 @@ class TestAi : public Tester
{
Interpreter &interpreter = getInterpreter();
// Add functions
+ interpreter.add ("progMatch", Interpreter::memFunc (ai_, &Ai::progMatch),
+ "progMatch ()");
+ interpreter.add
+ ("avoid", Interpreter::memFunc (ai_, &Ai::avoidrobot),
+ "do the avoid prog");
}
void postRun(void)
{