summaryrefslogtreecommitdiff
path: root/i
diff options
context:
space:
mode:
Diffstat (limited to 'i')
-rw-r--r--i/chuck/src/ai/ai.cc64
-rw-r--r--i/chuck/src/ai/test_ai.cc5
-rw-r--r--i/chuck/src/es/es.cc15
-rw-r--r--i/chuck/src/es/es.hh2
-rw-r--r--i/chuck/src/motor/motor.cc2
-rw-r--r--i/chuck/src/motor/motor.hh2
6 files changed, 51 insertions, 39 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)
{
diff --git a/i/chuck/src/es/es.cc b/i/chuck/src/es/es.cc
index e1ea228..668aab1 100644
--- a/i/chuck/src/es/es.cc
+++ b/i/chuck/src/es/es.cc
@@ -240,16 +240,17 @@ void Es::receive(char command, const Proto::Frame & frame)
//Activation du truk ki monte et descend.
void
-Es::bouge_ascenceur(int sens,uint8_t vit,uint8_t tps)
+Es::bouge_ascenceur(uint8_t vit,uint8_t tps,uint8_t sens)
{
- if (sens == UP)
- {
- proto_.send('a',"bbb",vit,tps,0x01);
- }
- if (sens == DOWN)
+
+ proto_.send('a',"bbb",vit,tps,0x00);
+ for(int cpt=0;cpt<5;cpt++)
{
- proto_.send('a',"bbb",vit,tps,0x00);
+ proto_.send('a',"bbb",0xFF,0x05,0x01);
+ proto_.send('a',"bbb",0xFF,0x05,0x00);
}
+ proto_.send('a',"bbb",vit,tps,0x01);
+ proto_.send('a',"bbb",vit,tps,0x01);
//faire un static pour savoir la dernière commande.
//permettra de faire l'inverse en automatique.
}
diff --git a/i/chuck/src/es/es.hh b/i/chuck/src/es/es.hh
index 94470eb..f5eeff4 100644
--- a/i/chuck/src/es/es.hh
+++ b/i/chuck/src/es/es.hh
@@ -120,7 +120,7 @@ class Es : public Proto::Receiver
void lcdGetKey (int freq);
///Activé l'assenceur
- void bouge_ascenceur(int sens,uint8_t vit,uint8_t tps);
+ void bouge_ascenceur(uint8_t vit,uint8_t tps,uint8_t sens);
///rotate Left or Right
int setcolorsens(void);
//a finir pour def le vit
diff --git a/i/chuck/src/motor/motor.cc b/i/chuck/src/motor/motor.cc
index c322ff5..78fc8b6 100644
--- a/i/chuck/src/motor/motor.cc
+++ b/i/chuck/src/motor/motor.cc
@@ -159,7 +159,7 @@ Motor::receivePos (double x, double y, double a)
///Do the super Crénaux
bool
-docrenO(void)
+Motor::docreno(void)
{
static bool place;
return place;
diff --git a/i/chuck/src/motor/motor.hh b/i/chuck/src/motor/motor.hh
index 6f9b00a..4289201 100644
--- a/i/chuck/src/motor/motor.hh
+++ b/i/chuck/src/motor/motor.hh
@@ -70,7 +70,7 @@ class Motor : public Asserv::Receiver
/// get the position of robal
void getPosition(double & x, double & y, double & a) const;
/// DO the super Crénaux
- bool docrenO();
+ bool docreno(void);
private: