summaryrefslogtreecommitdiff
path: root/i/chuck/src/ai
diff options
context:
space:
mode:
Diffstat (limited to 'i/chuck/src/ai')
-rw-r--r--i/chuck/src/ai/ai.cc17
-rw-r--r--i/chuck/src/ai/ai.hh8
2 files changed, 14 insertions, 11 deletions
diff --git a/i/chuck/src/ai/ai.cc b/i/chuck/src/ai/ai.cc
index e078bb6..93b7cac 100644
--- a/i/chuck/src/ai/ai.cc
+++ b/i/chuck/src/ai/ai.cc
@@ -246,19 +246,18 @@ Ai::progMatch(void)
log_ ("match") << "Eloignement du bord";
motorMove(900,0);//On fonce tout droit
while (!update ());
- /// On tourner de -90°
+ /// On tourner de 45°
log_ ("match") << "Petite rotation de 45°";
- motorRotate(3.1416/(-4.)*(coefcolor));
+ motorRotate(R45*(coefcolor));
///On avance a travers les ordures euh on est sensé en ramacer
motorMove(900.,0.);
- ///On se positionne pour la marche arrière
- /*
- motorRotate(3.1416/(-4.)*(coefcolor));
- */
- /// On dit bonjour au mur
- log_ ("match") << "Va à l'opposé";
+ ///On se positionne pour la marche arrière
+ motorRotate(R45*(-3)*(coefcolor));
+
+ ///tuuutuuuutuuuuu je fait mon crénau
+ log_ ("match") << "Creneau";
if (!motorMove (1000, 0))
{
log_ ("match") << "Un mur ! Reculons";
@@ -292,7 +291,7 @@ Ai::progMatch(void)
/// Avance le robal et dit si il a finit (true) ou si il a bloqué
bool
-Ai::motorMove (int d, int a)
+Ai::motorMove (double d, double a)
{
motor_.move(d, a); /// XXX Voir la distance
do
diff --git a/i/chuck/src/ai/ai.hh b/i/chuck/src/ai/ai.hh
index 7241c25..b19dbc8 100644
--- a/i/chuck/src/ai/ai.hh
+++ b/i/chuck/src/ai/ai.hh
@@ -32,6 +32,10 @@
#include "scheduler/schedulable_read_fd.hh"
#include "log/log.hh"
+#define PI 3.14159
+#define R90 1.57079
+#define R45 0.7854
+
class Ai
{
private:
@@ -49,7 +53,7 @@ class Ai
const int schedule_time_;
const int reference_sensor_mask_;
bool mustRotate_;
- const int coefcolor;
+ int coefcolor;
public:
/// Constructeur
Ai(const Config & config);
@@ -75,7 +79,7 @@ class Ai
/// programme de match du robal
void progMatch(void);
void progHomoloRobal(void);
- bool motorMove (int d, int a);
+ bool motorMove (double d, double a);
void motorRotate (double d);
void motorDeblock(void);
void avoidrobot(void);