From b22bb601a027ad33097f8bd0f3d34bc579718a75 Mon Sep 17 00:00:00 2001 From: dufourj Date: Fri, 18 May 2007 22:17:45 +0000 Subject: * General: - commit post hoomologation. * Ai: - add functions to manage sharps, "rouleau", ascensor and fuck the wall. * Motor & Asserv: - update fuck the wall. * Es: - ascensor management; - "rouleau" management. * ToDo: - too much functions to manage the ascensor, simplify! --- i/chuck/src/es/es.cc | 44 ++++++++++++++++++++++++++++---------------- i/chuck/src/es/es.hh | 10 ++++++---- i/chuck/src/es/test_es.cc | 2 ++ 3 files changed, 36 insertions(+), 20 deletions(-) (limited to 'i/chuck/src/es') diff --git a/i/chuck/src/es/es.cc b/i/chuck/src/es/es.cc index 1f32925..9927727 100644 --- a/i/chuck/src/es/es.cc +++ b/i/chuck/src/es/es.cc @@ -32,7 +32,7 @@ /// Constructeur Es::Es (const Config & config) : proto_ (*this), log_ ("Es"), lcdKeyPressed_ (-1), front_sensor_ (false), - jackIn_ (false),colorModeBlue_(false) + jackIn_ (false),colorModeBlue_(false),ackSharp_(false) { // Récupération des valeurs de configuration dans le fichier @@ -87,7 +87,6 @@ Es::reset (void) lcdGetKey (lcdKeyStat_); // XXX Hardcoded value ! setSharpThreshold (1, thresholdSharp_, thresholdSharp_); - launchSharpDetection (); log_ ("Es", Log::debug) << "Reset Es done."; } @@ -240,24 +239,26 @@ void Es::receive(char command, const Proto::Frame & frame) //Activation du truk ki monte et descend. void -Es::bouge_ascenceur(uint8_t vit,uint8_t tps,uint8_t sens) +Es::bouge_ascenceur(void) { - proto_.send('a',"bbb",vit,tps,0x00); - for(int cpt=0;cpt<5;cpt++) - { - 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. + proto_.send('a',"bbb",0x70,0xde,0x00); + + /*roulo_roule(0x00);*/ +} +void +Es::bougeascDown(void) +{ +proto_.send('a',"bbb",0x60,0xf0,0x01); + + + /* roulo_roule(0x00);*/ } + //le roulo qui roule void -Es::roulo_roule(int vit) //je c pas encore trop le type +Es::roulo_roule(uint8_t vit) { proto_.send('R',"b",vit); } @@ -276,12 +277,16 @@ Es::setcolorsens(void) } } - +void +Es::initservo(void) +{ + proto_.send('m',"bb",0x02,0x00); +} //Le roulo tombe grace au servo void Es::roulo_tombe(void) { - proto_.send('m',"bb",0x00,0x7b); + proto_.send('m',"bb",0x02,0x7b); } @@ -293,3 +298,10 @@ Es::launchSharpDetection (void) setSharpUpdate (2, freqSharp_); } +/// Move ascenseur +void +Es::moveAsc (int speed, int time, bool up) +{ + proto_.send ('a', "bbb", speed, time, up ? 0x0 : 0x1); +} + diff --git a/i/chuck/src/es/es.hh b/i/chuck/src/es/es.hh index f5eeff4..0c26df0 100644 --- a/i/chuck/src/es/es.hh +++ b/i/chuck/src/es/es.hh @@ -119,15 +119,17 @@ class Es : public Proto::Receiver /// Get the current pressed keys of the LCD void lcdGetKey (int freq); + void moveAsc (int speed, int time, bool way); ///Activé l'assenceur - void bouge_ascenceur(uint8_t vit,uint8_t tps,uint8_t sens); - ///rotate Left or Right + void bouge_ascenceur(void); + void bougeascDown(void); +///rotate Left or Right int setcolorsens(void); //a finir pour def le vit - void roulo_roule(int vit); + void roulo_roule(uint8_t vit); //le roulo tombe void roulo_tombe(void); - + void initservo(void); /// Get sharp ack bool getSharpAck (void) const { return ackSharp_; } diff --git a/i/chuck/src/es/test_es.cc b/i/chuck/src/es/test_es.cc index c6cbfb1..be8712e 100644 --- a/i/chuck/src/es/test_es.cc +++ b/i/chuck/src/es/test_es.cc @@ -65,6 +65,8 @@ class TestEs : public Tester "Blocking wait (time)\n" " - time : time to wait in ms"); + interpreter.add + ("down",Interpreter::memFunc (es_, &Es::bougeascDown), "fait descendre l'ascenseur"); interpreter.add ("sharpUp", Interpreter::memFunc (es_, &Es::setSharpUpdate), "Set sharp update frequency (mask, freq)"); -- cgit v1.2.3