From 56e637ec77fc6c220009663dcc35712e399bfd5d Mon Sep 17 00:00:00 2001 From: dufourj Date: Fri, 26 May 2006 08:12:24 +0000 Subject: Général : - commit du programme d'après premier match. --- i/marvin/src/es/es.cc | 30 ++++++++++++++++++++---------- i/marvin/src/es/es.hh | 6 ++++++ 2 files changed, 26 insertions(+), 10 deletions(-) (limited to 'i/marvin/src/es') diff --git a/i/marvin/src/es/es.cc b/i/marvin/src/es/es.cc index 8c4c6fb..7b0505b 100644 --- a/i/marvin/src/es/es.cc +++ b/i/marvin/src/es/es.cc @@ -617,27 +617,27 @@ Es::newBallFront(void) switch (positionBarillet_) { case avant0: - stockBarillet[0] = colorSeen(frontBallRVB_)==whiteColor_?white:black; + 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:black; + 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:black; + 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:black; + 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:black; + stockBarillet[4] = ((colorSeen(frontBallRVB_))==whiteColor_)?white:white; positionBarillet_ = avant3; log_ ("Es::Barillet", Log::debug) << "trou 4:" << ((stockBarillet[4] == white)?"white":"pas white"); break; @@ -659,27 +659,27 @@ Es::newBallRear(void) switch (positionBarillet_) { case arriere0: - stockBarillet[0] = colorSeen(frontBallRVB_)==whiteColor_?white:black; + 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:black; + 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:black; + 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:black; + 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:black; + stockBarillet[4] = ((colorSeen(frontBallRVB_))==whiteColor_)?white:white; positionBarillet_ = arriere3; log_ ("Es::Barillet", Log::debug) << "trou 4"; break; @@ -719,3 +719,13 @@ 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/marvin/src/es/es.hh b/i/marvin/src/es/es.hh index 8abcca4..94bb68d 100644 --- a/i/marvin/src/es/es.hh +++ b/i/marvin/src/es/es.hh @@ -185,6 +185,12 @@ class Es : public Proto::Receiver 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; } private: /// Decode a color into a string -- cgit v1.2.3