summaryrefslogtreecommitdiff
path: root/i/marvin/src/es
diff options
context:
space:
mode:
authordufourj2006-05-24 20:13:50 +0000
committerdufourj2006-05-24 20:13:50 +0000
commit08c46b0aa2c1791ca404a60ca0f75e4687553076 (patch)
treed0b97fb8acc6da521a1be51de87c113090be0d91 /i/marvin/src/es
parent78a8f07f655dc7ff426d87001f3ca4d6a8365ded (diff)
Ai :
- rajout de parametres ; - rajout de fonctions. Es : - fonctions de gettage de jack/couleur de sélection.
Diffstat (limited to 'i/marvin/src/es')
-rw-r--r--i/marvin/src/es/es.cc36
-rw-r--r--i/marvin/src/es/es.hh11
-rw-r--r--i/marvin/src/es/test_es.cc2
3 files changed, 30 insertions, 19 deletions
diff --git a/i/marvin/src/es/es.cc b/i/marvin/src/es/es.cc
index 8bc90ec..ab73b3e 100644
--- a/i/marvin/src/es/es.cc
+++ b/i/marvin/src/es/es.cc
@@ -32,7 +32,7 @@
/// Constructeur
Es::Es (const Config & config)
: proto_ (*this), log_ ("Es"), lcdKeyPressed_ (-1),
- front_sensor_ (false), jack_ (false), colorModeBlue_ (false)
+ front_sensor_ (false), jackIn_ (false), colorModeBlue_ (false)
{
// Récupération des valeurs de configuration dans le fichier
loadConfig (config);
@@ -73,7 +73,6 @@ Es::loadConfig (const Config & config)
rvbSniffClearLimit_ = config.get<int> ("es.rvb_sniff_clear_limit");
rvbSensorMaskStat_ = config.get<int> ("es.rvb_sensor_mask_stat");
rvbSensorStat_ = config.get<int> ("es.rvb_sensor_stat");
- rvbSniffRefMask_ = config.get<int> ("es.rvb_sniff_ref_mask");
rvbSniffMaskStat_ = config.get<int> ("es.rvb_sniff_mask_stat");
rvbSniffStat_ = config.get<int> ("es.rvb_sniff_stat");
rvbSniffFrontStat_ = config.get<int> ("es.rvb_sniff_front_stat");
@@ -90,7 +89,6 @@ Es::reset (void)
// First, enable all sensors
setRVBSensorsConfig (rvbSensorFalseIC_, rvbSensorMaxOv_);
- enableAllSensors (true);
// Send configurations
setMainStat (mainStat_);
@@ -104,11 +102,7 @@ Es::reset (void)
setRVBSniffFrontStat (rvbSniffFrontStat_);
lcdGetKey (lcdKeyStat_);
- // We want to reference some sensors
- // XXX We should wait !
- setRefColor (rvbSniffRefMask_);
- // Disable useless sensors
- enableAllSensors (false);
+ enableAllSensors (true);
}
/// Stat for the main ()
@@ -133,6 +127,20 @@ Es::setAckStat (int freq)
proto_.send ('F', "b", ackFreq_);
}
+/// Get the state of the jack
+bool
+Es::isJackOut (void)
+{
+ return !jackIn_;
+}
+
+/// Get the color mode of the button
+bool
+Es::isColorModeBlue (void)
+{
+ return colorModeBlue_;
+}
+
// Envoie de la config des sensors RVB
void Es::setRVBSensorsConfig(int false_ic, int max_ov)
{
@@ -152,7 +160,7 @@ void Es::setRVBSensorsStat(int mask_captor, int freq)
}
// règle la couleur actuelle comme référente
-void Es::setRefColor(int mask_captor, int mode)
+void Es::refColor(int mask_captor, int mode)
{
proto_.send ('r', "wb", mask_captor, mode);
}
@@ -373,22 +381,22 @@ void Es::receive(char command, const Proto::Frame & frame)
switch (value)
{
case 0:
- jack_ = colorModeBlue_ = false;
+ jackIn_ = colorModeBlue_ = false;
break;
case 1:
- jack_ = true;
+ jackIn_ = true;
colorModeBlue_ = false;
break;
case 2:
- jack_ = false;
+ jackIn_ = false;
colorModeBlue_ = true;
break;
case 3:
- jack_ = colorModeBlue_ = true;
+ jackIn_ = colorModeBlue_ = true;
break;
}
log_ ("Others", Log::debug) << "Color mode " << (colorModeBlue_ ? "Blue" : "Red")
- << (jack_ ? ", jack in..." : ", jack out !!!");
+ << (jackIn_ ? ", jack in..." : ", jack out !!!");
}
break;
/* LCD */
diff --git a/i/marvin/src/es/es.hh b/i/marvin/src/es/es.hh
index dd9ac1c..cbf989e 100644
--- a/i/marvin/src/es/es.hh
+++ b/i/marvin/src/es/es.hh
@@ -59,8 +59,6 @@ class Es : public Proto::Receiver
int rvbSniffRefRatio_, rvbSniffGreenLimit_, rvbSniffClearLimit_;
/// RVB Sensors raw stats
int rvbSensorMaskStat_, rvbSensorStat_;
- /// Reference which sensor at boot time
- int rvbSniffRefMask_;
/// RVB Sniff stats
int rvbSniffMaskStat_, rvbSniffStat_;
/// RVB Sensors raw stats
@@ -70,7 +68,7 @@ class Es : public Proto::Receiver
/// Sharps
Sharps sharps_;
/// Others module, jack & colour
- bool jack_, colorModeBlue_;
+ bool jackIn_, colorModeBlue_;
int othersStat_;
/// Stat of front sensors
int rvbSniffFrontStat_;
@@ -97,6 +95,10 @@ class Es : public Proto::Receiver
void shutUp (void);
/// Set frequency of ack
void setAckStat (int freq);
+ /// Get the state of the jack
+ bool isJackOut (void);
+ /// 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);
@@ -105,7 +107,7 @@ class Es : public Proto::Receiver
/// Règle les stats des sensors RVB
void setRVBSensorsStat(int mask_captor, int freq);
/// règle la couleur actuelle comme référente
- void setRefColor(int mask_captor, int mode = 0);
+ 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
@@ -116,6 +118,7 @@ class Es : public Proto::Receiver
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...
diff --git a/i/marvin/src/es/test_es.cc b/i/marvin/src/es/test_es.cc
index 4213ebb..e5c90e5 100644
--- a/i/marvin/src/es/test_es.cc
+++ b/i/marvin/src/es/test_es.cc
@@ -65,7 +65,7 @@ class TestEs : public Tester
"Blocking wait (time)\n"
" - time : time to wait in ms");
interpreter.add
- ("colorRef", Interpreter::memFunc (es_, &Es::setRefColor),
+ ("colorRef", Interpreter::memFunc (es_, &Es::refColor),
"Reference current color as green for sensors (mask)");
interpreter.add
("rvbAll", Interpreter::memFunc (es_, &Es::enableAllSensors),