summaryrefslogtreecommitdiff
path: root/i/chuck/src/es
diff options
context:
space:
mode:
Diffstat (limited to 'i/chuck/src/es')
-rw-r--r--i/chuck/src/es/es.cc40
-rw-r--r--i/chuck/src/es/es.hh23
-rw-r--r--i/chuck/src/es/test_es.cc55
3 files changed, 37 insertions, 81 deletions
diff --git a/i/chuck/src/es/es.cc b/i/chuck/src/es/es.cc
index 12a6f3d..452e689 100644
--- a/i/chuck/src/es/es.cc
+++ b/i/chuck/src/es/es.cc
@@ -83,8 +83,6 @@ Es::reset (void)
setAckStat (ackFreq_);
setOthersStat (othersStat_);
lcdGetKey (lcdKeyStat_);
-
- enableAllSensors (true);
log_ ("Es", Log::debug) << "Reset Es done.";
}
@@ -124,16 +122,6 @@ Es::isColorModeBlue (void)
return colorModeBlue_;
}
-/// Enable all the sensors or just the 4 and 1 near the ground
-void
-Es::enableAllSensors (bool enable)
-{
- if (enable)
- proto_.send ('u', "b", 1);
- else
- proto_.send ('u', "b", 0);
-}
-
/// Set frequency of jack, selectoul printed out function
void
Es::setOthersStat (int freq)
@@ -141,11 +129,11 @@ Es::setOthersStat (int freq)
proto_.send ('O', "b", freq);
}
-// Discute avec les servo...
-void Es::setServoPos (int servo_mask, int servoPos)
-{
- proto_.send ('m', "bb", servo_mask, servoPos);
-}
+
+
+
+
+
/// Set update frequency of sharps
void
@@ -188,7 +176,7 @@ Es::lcdGetKey (int freq)
void Es::receive(char command, const Proto::Frame & frame)
{
- int errCode, red, blue, clear, green, compt, value;
+ int errCode, clear, compt, value;
int stat1, stat2, stat3, stat4;
switch (command)
@@ -242,6 +230,22 @@ void Es::receive(char command, const Proto::Frame & frame)
sharps_[compt] = value;
}
break;
+ }
+}
+
+//Activation du truk ki monte et descend.
+void
+Es::bouge_ascenceur(int sens,uint8_t vit,uint8_t tps)
+{
+ if (sens == UP)
+ {
+ proto_.send('a',"bbb",vit,tps,0x01);
+ }
+ if (sens == DOWN)
+ {
+ proto_.send('a',"bbb",vit,tps,0x00);
}
+ //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 1d5c13d..0de1264 100644
--- a/i/chuck/src/es/es.hh
+++ b/i/chuck/src/es/es.hh
@@ -36,8 +36,8 @@ class Config;
class Es : public Proto::Receiver
{
public:
- typedef std::vector<int> Sharps;
-
+ enum ascen{UP,DOWN};
+ typedef std::vector<int> Sharps;
private:
// Objet Proto de communication vers la carte es
Proto proto_;
@@ -93,14 +93,14 @@ class Es : public Proto::Receiver
/// Get the color mode of the button
bool isColorModeBlue (void);
- /// Enable all the sensors or just the 4 and 1 near the ground
- void enableAllSensors (bool enable);
+
+
/// Set frequency of jack, selectoul printed out function
/// Use this function with frequency 0 to disable this stat.
void setOthersStat (int freq);
- /// Discute avec les servo...
- void setServoPos (int servo_mask, int servoPos);
+
+
/// Set update frequency of sharps
void setSharpUpdate (int sharp_mask, int freq);
@@ -115,14 +115,13 @@ class Es : public Proto::Receiver
/// Get the current pressed keys of the LCD
void lcdGetKey (int freq);
- /// Front sensor
- bool frontSensor (void) { return front_sensor_; }
- /// Clear sensor
- void clearFrontSensor (void) { front_sensor_ = false; }
+
+
+
///Activé l'assenceur
- void bouge_ascenceur(int sensrot);
-
+ void bouge_ascenceur(int sens,uint8_t vit,uint8_t tps);
+ //a faire
private:
/// 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 1e39167..b96baa5 100644
--- a/i/chuck/src/es/test_es.cc
+++ b/i/chuck/src/es/test_es.cc
@@ -64,15 +64,7 @@ class TestEs : public Tester
interpreter.add ("wait", Interpreter::memFunc (*this, &TestEs::wait),
"Blocking wait (time)\n"
" - time : time to wait in ms");
- interpreter.add
- ("colorRef", Interpreter::memFunc (es_, &Es::refColor),
- "Reference current color as green for sensors (mask)");
- interpreter.add
- ("rvbAll", Interpreter::memFunc (es_, &Es::enableAllSensors),
- "Drop a ball at the rear ()");
- interpreter.add
- ("servoPos", Interpreter::memFunc (es_, &Es::setServoPos),
- "Set servo position (mask, pos)");
+
interpreter.add
("sharpUp", Interpreter::memFunc (es_, &Es::setSharpUpdate),
"Set sharp update frequency (mask, freq)");
@@ -91,48 +83,9 @@ class TestEs : public Tester
interpreter.add
("lcdKey", Interpreter::memFunc (es_, &Es::lcdGetKey),
"Set stat for key if pressed (freq)");
- interpreter.add
- ("turbSpeed", Interpreter::memFunc (es_, &Es::setTurbineSpeed),
- "Set turbine speed (num, speed)\n"
- " - num : 1 front, 2 rear\n"
- " - speed : 256 - 819");
- interpreter.add
- ("turbMinSpeed", Interpreter::memFunc (es_,
- &Es::barilletDebutLancement),
- avant1 = 0x20, arriere3 = 0x24};
- "Turbine minimal speed ()");
- interpreter.add
- ("turbFrontFull", Interpreter::memFunc (es_,
- &Es::barilletLancement),
- "Turbine front full speed ()");
- interpreter.add
- ("barSleep", Interpreter::memFunc (es_, &Es::barilletSleep),
- "Barillet in sleep mode (low speed turbine)");
- interpreter.add
- ("turbDepose", Interpreter::memFunc (es_, &Es::deposeBalle),
- "Drop a ball at the rear ()");
- interpreter.add
- ("barDropWhite", Interpreter::memFunc (es_, &Es::dropWhiteBall),
- "drop une balle blanche");
- interpreter.add("barDropBlack", Interpreter::memFunc (es_,
- &Es::dropBlackBall),
- "drop une balle noire");
- interpreter.add("barSetEmpty", Interpreter::memFunc (es_,
- &Es::setEmptyHoleFront),
- "met un trou vide en position avale une balle");
- interpreter.add
- ("barExtract", Interpreter::memFunc (es_, &Es::extraitBalle),
- "Extract a ball ()");
- interpreter.add
- ("barInit", Interpreter::memFunc (es_, &Es::barilletInit),
- "Init barillet ()");
- interpreter.add
- ("barGoTo", Interpreter::memFunc (es_, &Es::rotationBarillet),
- "Barillet go to position (pos)\n"
- " - pos : in 40° of a round");
- interpreter.add
- ("barPurge", Interpreter::memFunc (es_, &Es::barilletEmpty),
- "Extract a ball ()");
+ interpreter.add ("ascenseur", Interpreter::memFunc(es_,
+ &Es::bouge_ascenceur),"Set sens , vitesse , tps\n" "sens : 0 UP 1 DOWN\n" "vit and tps : en hex");
+
interpreter.add ("_postcall",
Interpreter::memFunc (*this, &TestEs::postcall));
}