From 7bd4a027d0b22489c998c201987855d73c79bee1 Mon Sep 17 00:00:00 2001 From: becquet Date: Thu, 10 May 2007 21:07:51 +0000 Subject: --- i/chuck/src/ai/ai.cc | 13 +- i/chuck/src/ai/ai.hh | 12 +- i/chuck/src/es/es.cc | 519 +-------------------------------- i/chuck/src/es/es.hh | 93 +----- i/chuck/src/es/test_es.cc | 1 + i/chuck/src/interpreter/interpreter.hh | 3 +- 6 files changed, 31 insertions(+), 610 deletions(-) (limited to 'i') diff --git a/i/chuck/src/ai/ai.cc b/i/chuck/src/ai/ai.cc index c9be04a..7bf5c5a 100644 --- a/i/chuck/src/ai/ai.cc +++ b/i/chuck/src/ai/ai.cc @@ -1,7 +1,11 @@ -// AI.CC -// marvin - programme du robot 2006. {{{ +// ai.cc +// chuck - programme du robot 2007 {{{ // -// Copyright (C) 2006 Nicolas Haller +// Copyright (C) 2007 Romain Becquet +// +// Robot APB Team/Efrei 2007. +// Web: http://assos.efrei.fr/si2e/ +// Email: si2e AT efrei DOT fr // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by @@ -17,9 +21,6 @@ // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // -// Contact : -// Web: http://perso.efrei.fr/~haller/ -// Email: // }}} #include "ai.hh" #include "config/config.hh" diff --git a/i/chuck/src/ai/ai.hh b/i/chuck/src/ai/ai.hh index 29598b4..467955b 100644 --- a/i/chuck/src/ai/ai.hh +++ b/i/chuck/src/ai/ai.hh @@ -1,9 +1,13 @@ #ifndef ai_hh #define ai_hh // ai.hh -// marvin - programme du robot 2006. {{{ +// chuck - programme du robot 2007 {{{ // -// Copyright (C) 2006 Nicolas Haller +// Copyright (C) 2007 Romain Becquet +// +// Robot APB Team/Efrei 2007. +// Web: http://assos.efrei.fr/si2e/ +// Email: si2e AT efrei DOT frr // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by @@ -18,10 +22,6 @@ // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -// -// Contact : -// Web: http://perso.efrei.fr/~haller/ -// Email: // }}} /// Intelligence supérieur(à celui d'une balle de ping-pong) artificielle /// (comme une blonde) du robot. diff --git a/i/chuck/src/es/es.cc b/i/chuck/src/es/es.cc index 66a8fc9..12a6f3d 100644 --- a/i/chuck/src/es/es.cc +++ b/i/chuck/src/es/es.cc @@ -1,11 +1,11 @@ // es.cc -// robert - programme du robot 2005 {{{ +// chuck - programme du robot 2007 {{{ // -// Copyright (C) 2005 Nicolas Haller +// Copyright (C) 2007 Romain Becquet // -// Robot APB Team/Efrei 2005. -// Web: http://assos.efrei.fr/robot/ -// Email: robot AT efrei DOT fr +// Robot APB Team/Efrei 2007. +// Web: http://assos.efrei.fr/si2e/ +// Email: si2e AT efrei DOT fr // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by @@ -32,27 +32,14 @@ /// Constructeur Es::Es (const Config & config) : proto_ (*this), log_ ("Es"), lcdKeyPressed_ (-1), front_sensor_ (false), - jackIn_ (false), colorModeBlue_ -(false),positionBarillet_(avant0),frontTurbineIsFull_(false), unknownColor_ -(-2), redColor_ (2), blueColor_ (1), greenColor_ (0), whiteColor_ (5), - blackColor_ (4), leftFrontRVB_ (0), rightFrontRVB_ (1), holeRVB_ (2), - frontBallRVB_ (3), rearBallRVB_ (4) + jackIn_ (false),colorModeBlue_(false) + { // Récupération des valeurs de configuration dans le fichier loadConfig (config); proto_.open (tty_); sharps_.resize (3); - // Normalement, le barillet est vide... - for(int i = 0; i < 5 ; i++) - stockBarillet[i] = empty; - - for (int compt = 0; compt < 5; compt++) - { - seenColors_[compt] = unknownColor_; - lastSeenColors_[compt] = unknownColor_; - comptSeenColors_[compt] = 0; - } } bool @@ -79,21 +66,9 @@ Es::loadConfig (const Config & config) tty_ = config.get("es.tty"); ackFreq_ = config.get ("es.ack_freq"); mainStat_ = config.get ("es.main_stat"); - rvbSensorFalseIC_ = config.get ("es.rvb_sensors_false_ic"); - rvbSensorMaxOv_ = config.get ("es.rvb_sensors_max_ov"); - rvbSniffRefRatio_ = config.get ("es.rvb_sniff_ref_ratio"); - rvbSniffGreenLimit_ = config.get ("es.rvb_sniff_green_limit"); - rvbSniffClearLimit_ = config.get ("es.rvb_sniff_clear_limit"); - rvbSensorMaskStat_ = config.get ("es.rvb_sensor_mask_stat"); - rvbSensorStat_ = config.get ("es.rvb_sensor_stat"); - rvbSniffMaskStat_ = config.get ("es.rvb_sniff_mask_stat"); - rvbSniffStat_ = config.get ("es.rvb_sniff_stat"); - rvbSniffFrontStat_ = config.get ("es.rvb_sniff_front_stat"); - rvbBallStat_ = config.get ("es.rvb_ball_stat"); othersStat_ = config.get ("es.others_stat"); lcdKeyStat_ = config.get ("es.lcd_key_stat"); thresholdFrontSensors_ = config.get ("es.threshold_front_sensors"); - thresholdBallSensors_ = config.get ("es.threshold_ball_sensors"); thresholdHoleSensors_ = config.get ("es.threshold_hole_sensors"); } @@ -103,19 +78,10 @@ Es::reset (void) // On reset l'AVR proto_.send ('z'); - // First, enable all sensors - setRVBSensorsConfig (rvbSensorFalseIC_, rvbSensorMaxOv_); - // Send configurations setMainStat (mainStat_); setAckStat (ackFreq_); - setRVBSniffConfig (rvbSniffRefRatio_, rvbSniffGreenLimit_, - rvbSniffClearLimit_); - setRVBSensorsStat (rvbSensorMaskStat_, rvbSensorStat_); - setRVBSniffStat (rvbSniffMaskStat_, rvbSniffStat_); - setRVBBallStat (rvbBallStat_); setOthersStat (othersStat_); - setRVBSniffFrontStat (rvbSniffFrontStat_); lcdGetKey (lcdKeyStat_); enableAllSensors (true); @@ -158,51 +124,6 @@ Es::isColorModeBlue (void) return colorModeBlue_; } -// Envoie de la config des sensors RVB -void Es::setRVBSensorsConfig(int false_ic, int max_ov) -{ - proto_.send ('p',"bb", false_ic, max_ov); -} - -// Envoie de la config des sniff RVB -void Es::setRVBSniffConfig (int ref_ratio, int green_limit, int clear_limit) -{ - proto_.send ('x', "bww", ref_ratio, green_limit, clear_limit); -} - -// Règle les stats des sensors RVB -void Es::setRVBSensorsStat(int mask_captor, int freq) -{ - proto_.send ('S', "wb", mask_captor, freq); -} - -// règle la couleur actuelle comme référente -void Es::refColor(int mask_captor, int mode) -{ - proto_.send ('r', "wb", mask_captor, mode); -} - -/// Règle les stats d'affichage de la couleur -void -Es::setRVBSniffStat (int mask_captor, int freq) -{ - proto_.send ('A', "wb", mask_captor, freq); -} - -/// Configure statistic for the sensor of the ball -void -Es::setRVBBallStat (int freq) -{ - proto_.send ('B', "b", freq); -} - -/// Set frequency of front sensor in analyse mode -void -Es::setRVBSniffFrontStat (int freq) -{ - proto_.send ('C', "b", freq); -} - /// Enable all the sensors or just the 4 and 1 near the ground void Es::enableAllSensors (bool enable) @@ -265,205 +186,6 @@ Es::lcdGetKey (int freq) proto_.send ('L', "b", freq); } -// Règle la vitesse des turbines -void Es::setTurbineSpeed(int turbNb, int speed) -{ - proto_.send ('v', "bw", turbNb, speed); -} - -// Règle le sens de rotation du barillet -void Es::setTheMeaningOfRotationOfBarillet(int answer) -{ - proto_.send ('w', "b", answer); -} - -/// Init the barillet and put it at the right place -void -Es::barilletInit (void) -{ - proto_.send ('i'); - frontTurbineIsFull_ = false; -} - -/// Init turbine to minimal speed -void Es::barilletDebutLancement (void) -{ - proto_.send ('g'); - frontTurbineIsFull_ = false; -} - -/// Init front turbine to full speed -void Es::barilletLancement (void) -{ - proto_.send ('h'); - frontTurbineIsFull_ = true; - log_ ("Es::Barillet", Log::debug) << "Lancement turbine avant."; -} - -/// Put barillet in sleep mode -void -Es::barilletSleep (void) -{ - proto_.send ('s'); - frontTurbineIsFull_ = false; -} - -// Dépose une balle du barillet -void -Es::deposeBalle(void) -{ - proto_.send ('d'); - barilletDebutLancement(); - log_ ("Es::Barillet", Log::debug) << "DROP!! "; - frontTurbineIsFull_ = false; - wait (400); - barilletLancement(); -} - -/// Dépose une balle blanche -bool -Es::dropWhiteBall(void) -{ - for(int i = 0; i < 5; i++) - if(stockBarillet[i] == white) - { - log_ ("Es::Barillet", Log::debug) << "Balle blanche detected en trou: " << i; - switch (i) - { - case 0: - rotationBarillet(arriere0); - positionBarillet_ = arriere0; - stockBarillet[0] = empty; - break; - case 1: - rotationBarillet(arriere1); - positionBarillet_ = arriere1; - stockBarillet[1] = empty; - break; - case 2: - rotationBarillet(arriere2); - positionBarillet_ = arriere2; - stockBarillet[2] = empty; - break; - case 3: - rotationBarillet(arriere3); - positionBarillet_ = arriere3; - stockBarillet[3] = empty; - break; - case 4: - rotationBarillet(arriere4); - positionBarillet_ = arriere4; - stockBarillet[4] = empty; - break; - } - //deposeBalle(); - return true; - } - return false; -} - -/// Dépose une balle noire -bool -Es::dropBlackBall(void) -{ - for(int i = 0; i < 5; i++) - if(stockBarillet[i] == black) - { - log_ ("Es::Barillet", Log::debug) << "Balle noire detected en trou: " << i; - switch (i) - { - case 0: - rotationBarillet(arriere0); - positionBarillet_ = arriere0; - stockBarillet[0] = empty; - break; - case 1: - rotationBarillet(arriere1); - positionBarillet_ = arriere1; - stockBarillet[1] = empty; - break; - case 2: - rotationBarillet(arriere2); - positionBarillet_ = arriere2; - stockBarillet[2] = empty; - break; - case 3: - rotationBarillet(arriere3); - positionBarillet_ = arriere3; - stockBarillet[3] = empty; - break; - case 4: - rotationBarillet(arriere4); - positionBarillet_ = arriere4; - stockBarillet[4] = empty; - break; - } - //deposeBalle(); - return true; - } - return false; -} - -/// Place un trou vide à l'avant -bool -Es::setEmptyHoleFront(void) -{ - if(barilletIsFull()) - return false; - for(int i = 0; i < 5; i++) - if(stockBarillet[i] == empty) - { - log_ ("Es::Barillet", Log::debug) << "vide detected en trou: " << i; - switch (i) - { - case 0: - rotationBarillet(avant0); - positionBarillet_ = avant0; - break; - case 1: - rotationBarillet(avant1); - positionBarillet_ = avant1; - break; - case 2: - rotationBarillet(avant2); - positionBarillet_ = avant2; - break; - case 3: - rotationBarillet(avant3); - positionBarillet_ = avant3; - break; - case 4: - rotationBarillet(avant4); - positionBarillet_ = avant4; - break; - } - return true; - } - return false; -} -/// Extrait une balle -void -Es::extraitBalle(void) -{ - proto_.send ('e'); - frontTurbineIsFull_ = false; - log_ ("Es::Barillet", Log::debug) << "Extraction baballe."; -} - -/// Rotation du barillet -void Es::rotationBarillet(int posFinal) -{ - proto_.send ('t', "b", posFinal); - frontTurbineIsFull_ = false; -} - -/// Empty everything in the barillet -void Es::barilletEmpty (void) -{ - proto_.send ('n'); - frontTurbineIsFull_ = false; -} - void Es::receive(char command, const Proto::Frame & frame) { int errCode, red, blue, clear, green, compt, value; @@ -486,70 +208,10 @@ void Es::receive(char command, const Proto::Frame & frame) log_ ("Ack", Log::debug) << "ErrCode :" << errCode; switch (errCode) { - case 1: - front_sensor_ = true; - break; - case 2: // une balle miam par l'avant - newBallFront(); - break; - case 3: // une balle miam par l'arrière - newBallRear(); - break; - case 4: - // A ball has been by the sensor at the front of the barillet - enableAllSensors (true); - setRVBBallStat (5); - break; } shutUp (); } break; - /* RVB Sensors raw stat */ - case 'S': - if (proto_.decode (frame, "wwwww", compt, red, blue, clear, green)) - { - log_ ("Stats RVB Raw", Log::debug) << "[" << compt << "] = {" - << red << "," << blue << "," << clear << "," << green << "}"; - } - break; - /* RVB Sniff stats */ - case 'A': - if (proto_.decode (frame, "bb", compt, value)) - { - log_ ("Stats RVB Sniff", Log::debug) << "[" << compt << "] = " - << decodeColor (value); - } - break; - case 'C': - if (proto_.decode (frame, "bb", stat1, stat2)) - { - log_ ("Stats RVB Front", Log::debug) << decodeColor (stat1) - << " - " << decodeColor (stat2); - updateAnalysisSensor (stat2, leftFrontRVB_, thresholdFrontSensors_); - updateAnalysisSensor (stat1, rightFrontRVB_, thresholdFrontSensors_); - } - break; - /* RVB Hole */ - case 'D': - if (proto_.decode (frame, "b", stat1)) - { - log_ ("Stats RVB Hole", Log::debug) << decodeColor (stat1); - updateAnalysisSensor (stat1, holeRVB_, thresholdHoleSensors_); - } - break; - /* RVB Balls */ - case 'B': - if (proto_.decode (frame, "bb", stat1 /* Rear */, stat2 /* Front */)) - { -// log_ ("Stats RVB Ball", Log::debug) << "[" << decodeColor -// (stat1) << "] [" << decodeColor (stat2) << "]"; - updateAnalysisSensor (stat1, rearBallRVB_, thresholdBallSensors_); - updateAnalysisSensor (stat2, frontBallRVB_, thresholdBallSensors_); - log_ ("Ball") << "Devant : " << (colorSeen (frontBallRVB_) == - whiteColor_ ? "white" : "black") << " Arr : " << (colorSeen - (rearBallRVB_) == whiteColor_ ? "white" : "black"); - } - break; /* Others */ case 'O': if (proto_.decode (frame, "b", value)) @@ -580,173 +242,6 @@ void Es::receive(char command, const Proto::Frame & frame) sharps_[compt] = value; } break; - /* Barillet */ - case 'W': - if (proto_.decode (frame, "bb", stat1, stat2)) - { - log_ ("Barillet", Log::debug) << stat1 << " " << stat2; - } - break; - } -} - -void Es::setRVBHoleStat (int freq) -{ - proto_.send ('D', "b", freq); -} - -/// Decode a color into a string -std::string -Es::decodeColor (int color) -{ - switch (color) - { - case 0: - return "green"; - break; - case 1: - return "blue"; - break; - case 2: - return "red"; - break; - case 3: - return "other"; - break; - case 4: - return "black"; - break; - case 5: - return "white"; - break; - default: - return "unknow"; } } -/// Analyse une balle arrivant par devant -void -Es::newBallFront(void) -{ - /// La turbine est off - frontTurbineIsFull_ = false; - /// On analyse la baballe - switch (positionBarillet_) - { - case avant0: - stockBarillet[0] = ((colorSeen(frontBallRVB_))==whiteColor_)?white:white; - positionBarillet_ = avant4; - log_ ("Es::Barillet", Log::debug) << "trou 0:" << ((stockBarillet[0] == white)?"white":"pas white"); - break; - case avant1: - stockBarillet[1] = ((colorSeen(frontBallRVB_))==whiteColor_)?white:white; - positionBarillet_ = avant0; - log_ ("Es::Barillet", Log::debug) << "trou 1:" << ((stockBarillet[1] == white)?"white":"pas white"); - break; - case avant2: - stockBarillet[2] = ((colorSeen(frontBallRVB_))==whiteColor_)?white:white; - positionBarillet_ = avant1; - log_ ("Es::Barillet", Log::debug) << "trou 2:" << ((stockBarillet[2] == white)?"white":"pas white"); - break; - case avant3: - stockBarillet[3] = ((colorSeen(frontBallRVB_))==whiteColor_)?white:white; - positionBarillet_ = avant2; - log_ ("Es::Barillet", Log::debug) << "trou 3:" << ((stockBarillet[3] == white)?"white":"pas white"); - break; - case avant4: - stockBarillet[4] = ((colorSeen(frontBallRVB_))==whiteColor_)?white:white; - positionBarillet_ = avant3; - log_ ("Es::Barillet", Log::debug) << "trou 4:" << ((stockBarillet[4] == white)?"white":"pas white"); - break; - default: - log_ ("Es::Barillet", Log::debug) << "trou default..."; - break; - } - /// On regarde si on redémarre la turbine - if(!barilletIsFull()) - barilletLancement(); - log_ ("Es::Barillet", Log::debug) << "gobage balle par l'avant."; - enableAllSensors (false); - setRVBBallStat (0); -} - -/// Analyse une balle arrivant par derrière -void -Es::newBallRear(void) -{ - /// On analyse la baballe - switch (positionBarillet_) - { - case arriere0: - stockBarillet[0] = ((colorSeen(frontBallRVB_))==whiteColor_)?white:white; - positionBarillet_ = arriere4; - log_ ("Es::Barillet", Log::debug) << "trou 0"; - break; - case arriere1: - stockBarillet[1] = ((colorSeen(frontBallRVB_))==whiteColor_)?white:white; - positionBarillet_ = arriere0; - log_ ("Es::Barillet", Log::debug) << "trou 1"; - break; - case arriere2: - stockBarillet[2] = ((colorSeen(frontBallRVB_))==whiteColor_)?white:white; - positionBarillet_ = arriere1; - log_ ("Es::Barillet", Log::debug) << "trou 2"; - break; - case arriere3: - stockBarillet[3] = ((colorSeen(frontBallRVB_))==whiteColor_)?white:white; - positionBarillet_ = arriere2; - log_ ("Es::Barillet", Log::debug) << "trou 3"; - break; - case arriere4: - stockBarillet[4] = ((colorSeen(frontBallRVB_))==whiteColor_)?white:white; - positionBarillet_ = arriere3; - log_ ("Es::Barillet", Log::debug) << "trou 4"; - break; - default: - break; - } - log_ ("Es::Barillet", Log::debug) << "gobage balle par l'arriere."; - enableAllSensors (false); - setRVBBallStat (0); -} - -/// Update system for one sensor -void -Es::updateAnalysisSensor (int value, int index, int threshold) -{ - if (value == lastSeenColors_[index]) - comptSeenColors_[index]++; - else - { - comptSeenColors_[index] = 0; - lastSeenColors_[index] = value; - } - if (comptSeenColors_[index] > threshold) - seenColors_[index] = lastSeenColors_[index]; -} - -/// Say if barillet is full -bool -Es::barilletIsFull(void) -{ - for (int i = 0; i < 5; i++) - if (stockBarillet[i] == empty) - return false; - return true; -} -/// What color do you see my lord ? -int -Es::colorSeen (int sensor_num) -{ - return seenColors_[sensor_num]; -} - -/// Totems activator -void -Es::totemActivator (bool out) -{ - // Right - setServoPos (2, out ? 0 : 200); - // Left - setServoPos (4, out ? 200 : 0); -} diff --git a/i/chuck/src/es/es.hh b/i/chuck/src/es/es.hh index 0a53ff3..1d5c13d 100644 --- a/i/chuck/src/es/es.hh +++ b/i/chuck/src/es/es.hh @@ -1,13 +1,13 @@ #ifndef es_hh #define es_hh // es.hh -// robert - programme du robot 2005 {{{ +// chuck - programme du robot 2007 {{{ // -// Copyright (C) 2005 Nicolas Haller +// Copyright (C) 2007 Romain Becquet // -// Robot APB Team/Efrei 2005. -// Web: http://assos.efrei.fr/robot/ -// Email: robot AT efrei DOT fr +// Robot APB Team/Efrei 2007. +// Web: http://assos.efrei.fr/si2e/ +// Email: si2e AT efrei DOT fr // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by @@ -36,10 +36,6 @@ class Config; class Es : public Proto::Receiver { public: - enum etatBarillet{empty,white,black}; - enum posBar{avant0 = 0x00, arriere2 = 0x04, avant4 = 0x08, arriere1 = - 0x0C, avant3 = 0x10, arriere0 = 0x14, avant2 = 0x18, arriere4 = 0x1C, - avant1 = 0x20, arriere3 = 0x24}; typedef std::vector Sharps; private: @@ -59,16 +55,6 @@ class Es : public Proto::Receiver int ackFreq_; /// Main stat frequency int mainStat_; - /// Config of RVB sensors - int rvbSensorFalseIC_, rvbSensorMaxOv_; - /// Config of RVB sniff - int rvbSniffRefRatio_, rvbSniffGreenLimit_, rvbSniffClearLimit_; - /// RVB Sensors raw stats - int rvbSensorMaskStat_, rvbSensorStat_; - /// RVB Sniff stats - int rvbSniffMaskStat_, rvbSniffStat_; - /// RVB Sensors raw stats - int rvbBallStat_; /// Sharps Sharps sharps_; /// Others module, jack & colour @@ -77,21 +63,10 @@ class Es : public Proto::Receiver /// Stat of front sensors int rvbSniffFrontStat_; int thresholdFrontSensors_, thresholdBallSensors_, thresholdHoleSensors_; - /// Stock du barillet - etatBarillet stockBarillet[5]; - /// Position du barillet - posBar positionBarillet_; - /// System for analyse a ball - int seenColors_[5], lastSeenColors_[5], comptSeenColors_[5]; /// Si la turbine avant est allumé bool frontTurbineIsFull_; public: - // Some fucking defines ! - const int unknownColor_, redColor_, blueColor_, greenColor_, whiteColor_, - blackColor_; - const int leftFrontRVB_, rightFrontRVB_, holeRVB_, frontBallRVB_, - rearBallRVB_; /// Constructeur Es (const Config & config); /// On attend ... @@ -118,25 +93,8 @@ class Es : public Proto::Receiver /// Get the color mode of the button bool isColorModeBlue (void); - /// Envoie de la config des sensors RVB - void setRVBSensorsConfig(int false_ic, int max_ov); - /// Envoie de la config des sniff RVB - void setRVBSniffConfig(int ref_ratio, int green_limit, int clear_limit); - /// Règle les stats des sensors RVB - void setRVBSensorsStat(int mask_captor, int freq); - /// règle la couleur actuelle comme référente - void refColor(int mask_captor, int mode = 0); - /// Règle les stats d'affichage de la couleur - void setRVBSniffStat (int mask_captor, int freq); - /// Configure statistic for the sensor of the ball - void setRVBBallStat (int freq); - /// Set frequency of front sensor in analyse mode - void setRVBSniffFrontStat (int freq); /// Enable all the sensors or just the 4 and 1 near the ground void enableAllSensors (bool enable); - // - void setRVBHoleStat (int freq); - /// Set frequency of jack, selectoul printed out function /// Use this function with frequency 0 to disable this stat. void setOthersStat (int freq); @@ -157,50 +115,15 @@ class Es : public Proto::Receiver /// Get the current pressed keys of the LCD void lcdGetKey (int freq); - /// Règle la vitesse des turbines - void setTurbineSpeed (int turbNb, int speed); - /// Règle le sens de rotation du barillet - void setTheMeaningOfRotationOfBarillet (int answer); - /// Init the barillet and put it at the right place - void barilletInit (void); - /// Init turbine to minimal speed - void barilletDebutLancement (void); - /// Init front turbine to full speed - void barilletLancement (void); - /// Put barillet in sleep mode - void barilletSleep (void); - /// Dépose une balle du barillet - void deposeBalle(void); - /// Dépose une balle blanche - bool dropWhiteBall(void); - /// Dépose une balle noire - bool dropBlackBall(void); - /// Place un trou vide à l'avant - bool setEmptyHoleFront(void); - /// Extrait une balle - void extraitBalle(void); - /// Rotation du barillet - void rotationBarillet(int posFinal); - /// Empty everything in the barillet - void barilletEmpty (void); - /// Say if barillet is full - bool barilletIsFull(void); - /// What color do you see my lord ? - int colorSeen (int sensor_num); - /// Totems activator - void totemActivator (bool out); /// Front sensor bool frontSensor (void) { return front_sensor_; } /// Clear sensor void clearFrontSensor (void) { front_sensor_ = false; } + ///Activé l'assenceur + void bouge_ascenceur(int sensrot); + private: - /// Decode a color into a string - std::string decodeColor (int color); - /// Analyse une balle arrivant par devant - void newBallFront (void); - /// Analyse une balle arrivant par derrière - void newBallRear (void); /// Update system for one sensor void updateAnalysisSensor (int value, int index, int threshold); }; diff --git a/i/chuck/src/es/test_es.cc b/i/chuck/src/es/test_es.cc index 2990d73..1e39167 100644 --- a/i/chuck/src/es/test_es.cc +++ b/i/chuck/src/es/test_es.cc @@ -99,6 +99,7 @@ class TestEs : public Tester interpreter.add ("turbMinSpeed", Interpreter::memFunc (es_, &Es::barilletDebutLancement), + avant1 = 0x20, arriere3 = 0x24}; "Turbine minimal speed ()"); interpreter.add ("turbFrontFull", Interpreter::memFunc (es_, diff --git a/i/chuck/src/interpreter/interpreter.hh b/i/chuck/src/interpreter/interpreter.hh index 3341ea1..60b57cd 100644 --- a/i/chuck/src/interpreter/interpreter.hh +++ b/i/chuck/src/interpreter/interpreter.hh @@ -1,4 +1,5 @@ -#ifndef interpreter_hh +# +fndef interpreter_hh #define interpreter_hh // interpreter.hh // marvin - programme du robot 2006. {{{ -- cgit v1.2.3