summaryrefslogtreecommitdiff
path: root/2005/i/robert/src/ai/ai.cc
diff options
context:
space:
mode:
Diffstat (limited to '2005/i/robert/src/ai/ai.cc')
-rw-r--r--2005/i/robert/src/ai/ai.cc48
1 files changed, 26 insertions, 22 deletions
diff --git a/2005/i/robert/src/ai/ai.cc b/2005/i/robert/src/ai/ai.cc
index cdb9d4c..12e8f88 100644
--- a/2005/i/robert/src/ai/ai.cc
+++ b/2005/i/robert/src/ai/ai.cc
@@ -23,7 +23,10 @@
//
// }}}
-#include"ai.hh"
+#include "ai.hh"
+#include "config/config.hh"
+#include "timer/timer.hh"
+#include "ovision/see/ovision.hh"
static void
callback (void)
@@ -33,10 +36,10 @@ callback (void)
/// Constructeur
Ai::Ai(const Config & config)
:motor_(config), es_(config),
- roundDuration_(config.get<int>("ai.roundDuration")),
- vitesseAsc_(config.set<int>("ai.vitesseAsc")),
schedulableMotor_ (callback, motor_.getFd ()),
- schedulableEs_ (callback, es_.getFd ())
+ schedulableEs_ (callback, es_.getFd ()),
+ roundDuration_(config.get<int>("ai.roundDuration")),
+ vitesseAsc_(config.get<int>("ai.vitesseAsc"))
{
scheduler_.insert (schedulableMotor_);
scheduler_.insert (schedulableEs_);
@@ -50,8 +53,8 @@ void Ai::init(void)
// initialise la carte es
es_.init();
// on init la vision
- ovision_.init(es_.getColor() ? Group::ZoneType::RedSkittle :
- Group::ZoneType::GreenColor);
+ oVision_.init(motor_.colorState() ? Group::redSkittle :
+ Group::greenSkittle);
}
/// stop le robot
@@ -75,16 +78,16 @@ void Ai::run(void)
// Attend la seconde sortie du jack(Daniel)
waitJack(true);
// on lance le temps
- Timer::start_round();
+ Timer::startRound();
// Aller devant la boule
- goTo(x, y, 0);
+ goTo(10, 10, 0); // XXX Mauvaise valeur, changer valeur
// Taper la boule
- basic(d);
+ basic(1245665486); // XXX Mauvaise valeur, changer valeur
// se placer devant nos quilles près du pont
- basic(-d);
+ basic(5568786); // XXX Mauvaise valeur, changer valeur
rotation(-M_PI / 2);
- goTo(x,y, M_PI);
- basic(-d);
+ goTo(4546,42424242, M_PI); // XXX Mauvaise valeur, changer valeur
+ basic(56465456); // XXX Mauvaise valeur, changer valeur
// Après attendre... XXX Ou voir un truc qui bouge
// Un truc
// Detecter les quilles tombées (voir si se déplacer proches du rb adverses serait utiles)
@@ -94,10 +97,15 @@ void Ai::run(void)
// redetecter le tout
}
+/// Attend.
+void Ai::wait (int t)
+{
+}
+
// Attend le jack entré (false) ou sorti (true).
void Ai::waitJack (bool out)
{
- while (es_.stateJack() != out)
+ while (motor_.jackState() != out)
update();
}
@@ -115,11 +123,6 @@ void Ai::goTo (double x, double y ,double a)
// XXX Voir ca plus précisemment
void Ai::recale (void)
{
- while(!es_.capteursContact())
- {
- motor_.recalage();
- update();
- }
}
/// Mouvement basic.
@@ -146,9 +149,9 @@ void Ai::rotation (double a)
/// Monte(vrai) ou descend(faux) l'ascenceur
void Ai::ascenceur (bool monte)
{
- while(es_.stateAsc() != monte ? true : false)
+ while(es_.getAscCurPos() != monte ? true : false)
{
- es_.moveAsc(monte);
+ //es_.moveAsc(monte);
// XXX On peut régler la vitesse de l'asc( config min max acc haut et bas entier unité ons'entape)
update();
}
@@ -158,7 +161,8 @@ void Ai::ascenceur (bool monte)
void Ai::ventouses (void) /// XXX Temps à régler dans la config
{
es_.ventouses();
- while(!es_.stateVentouses()) // XXX Ca, ca doit servir à rien
- update();
}
+void Ai::update (void)
+{
+}