BeoMonkey.H
Go to the documentation of this file.00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 
00017 
00018 
00019 
00020 
00021 
00022 
00023 
00024 
00025 
00026 
00027 
00028 
00029 
00030 
00031 
00032 
00033 
00034 
00035 
00036 
00037 
00038 
00039 #ifndef BEOMONKEY_H_DEFINED
00040 #define BEOMONKEY_H_DEFINED
00041 
00042 #include "Component/ModelComponent.H"
00043 #include "Component/ModelParam.H"
00044 #include "Devices/BeoChip.H"
00045 #include "Devices/BeoMonkeyTypes.H"
00046 #include "Util/Types.H"
00047 #include <deque>
00048 #include <pthread.h>
00049 #include <stdarg.h>
00050 
00051 class BeoMonkey : public BeoChip
00052 {
00053 public:
00054   
00055   BeoMonkey(OptionManager& mgr,
00056           const std::string& descrName = "BeoMonkey",
00057           const std::string& tagName = "BeoMonkey");
00058 
00059   
00060   
00061   void setHEyePos(const float position,const int velocity);
00062 
00063   std::deque<Position> getPathHEyePos(const float position,
00064                                        const int velocity,
00065                                       const float starpos = -999);
00066 
00067   void setHEyePosRel(const float offset,const int velocity);
00068 
00069   void setVEyePos(const float position,const int velocity);
00070 
00071   std::deque<Position> getPathVEyePos(const float position,
00072                                       const int velocity,
00073                                       const float starpos = -999);
00074 
00075   void setVEyePosRel(const float offset,const int velocity);
00076 
00077   void setEyeLidsPos(const float position,const int velocity);
00078 
00079   std::deque<Position> getPathEyeLidsPos(const float position,
00080                                          const int velocity,
00081                                       const float starpos = -999);
00082 
00083   void setEyeLidsRel(const float offset,const int velocity);
00084 
00085   void setEyeBrowPos(const float position,const int velocity);
00086 
00087   std::deque<Position> getPathEyeBrowPos(const float position,
00088                                           const int velocity,
00089                                       const float starpos = -999);
00090 
00091   void setEyeBrowPosRel(const float offset,const int velocity);
00092 
00093   void setMouthPos(const float position,const int velocity);
00094 
00095   std::deque<Position> getPathMouthPos(const float position,
00096                                         const int velocity,
00097                                       const float starpos = -999);
00098 
00099   void setMouthPosRel(const float offset,const int velocity);
00100 
00101   void setMuzzlePos(const float position,const int velocity);
00102 
00103   std::deque<Position> getPathMuzzlePos(const float position,
00104                                          const int velocity,
00105                                       const float starpos = -999);
00106 
00107   void setMuzzlePosRel(const float offset,const int velocity);
00108 
00109   void setHHeadPos(const float position,const int velocity);
00110 
00111   std::deque<Position> getPathHHeadPos(const float position,
00112                                         const int velocity,
00113                                       const float starpos = -999);
00114 
00115   void setHHeadPosRel(const float offset,const int velocity);
00116 
00117   void setVHeadPos(const float position,const int velocity);
00118 
00119   std::deque<Position> getPathVHeadPos(const float position,
00120                                         const int velocity,
00121                                       const float starpos = -999);
00122 
00123   void setVHeadPosRel(const float offset,const int velocity);
00124 
00125   
00126   void surpriseFace(float surprise);
00127 
00128   
00129   void start2();
00130 
00131   
00132   void initializeServos();
00133 
00134   
00135   void addSequence(const byte servo, std::deque<float> sequence);
00136 
00137   
00138   void addSequence(std::deque<Position> pos);
00139 
00140   
00141   void addEndSequence(std::deque<Position> pos);
00142 
00143   
00144   std::deque<Position> addEndSequence(std::deque<Position> sequence,
00145                                       std::deque<Position> pos);
00146 
00147   
00148   std::deque<Position> getSequence(const byte servo,
00149                                    std::deque<float> sequence);
00150 
00151   
00152   void blendSequence(std::deque< std::deque<Position> > elements);
00153 
00154    
00155   std::deque<Position> getBlendSequence(std::deque<
00156                                          std::deque<Position> > elements);
00157 
00158   
00159   std::deque<Position> blend(std::deque<Position> p1,
00160                              std::deque<Position> p2);
00161 
00162   
00163   void setServo(const byte servo,const float pos, const int velocity);
00164 
00165   
00166   std::deque<Position> getPathServo(const byte servo, const float pos,
00167                                      const int velocity,
00168                                      const float startpos = -999);
00169 
00170   
00171   std::deque<Position> concatSequence(std::deque< std::deque<Position> >);
00172 
00173   
00174   std::deque<Position> getQue();
00175 
00176   
00177   bool isQueEmpty();
00178 
00179   
00180   bool nextTimeStep();
00181 
00182   
00183   void clearQue();
00184 
00185   
00186   void removeServo(const byte servo);
00187 
00188   
00189   void printPath(std::deque<Position> p);
00190 
00191   
00192   float isServoInQue(byte servo);
00193 
00194   
00195   int queSize();
00196 
00197 
00198   
00199   static const int H_EYE   = 1;
00200   static const int V_EYE   = 3;
00201   static const int EYELIDS = 2;
00202   static const int EYEBROW = 4;
00203   static const int MOUTH   = 0;
00204   static const int MUZZLE  = 6;
00205   static const int H_HEAD  = 7;
00206   static const int V_HEAD  = 5;
00207 
00208   
00209   static const byte H_EYE_MIN= 56;
00210   static const byte V_EYE_MIN= 16;
00211   static const byte EYELIDS_MIN= 5;
00212   static const byte EYEBROW_MIN= 85;
00213   static const byte MOUTH_MIN= 85;
00214   static const byte MUZZLE_MIN= 255;
00215   static const byte H_HEAD_MIN= 10;
00216   static const byte V_HEAD_MIN= 10;
00217 
00218   
00219   static const byte H_EYE_MID= 115;
00220   static const byte V_EYE_MID= 55;
00221   static const byte EYELIDS_MID= 90;
00222   static const byte EYEBROW_MID= 100;
00223   static const byte MOUTH_MID= 180;
00224   static const byte MUZZLE_MID= 127;
00225   static const byte H_HEAD_MID= 90;
00226   static const byte V_HEAD_MID= 60;
00227 
00228   
00229   static const byte H_EYE_MAX= 190;
00230   static const byte V_EYE_MAX= 110;
00231   static const byte EYELIDS_MAX= 150;
00232   static const byte EYEBROW_MAX= 165;
00233   static const byte MOUTH_MAX= 215;
00234   static const byte MUZZLE_MAX= 0;
00235   static const byte H_HEAD_MAX= 235;
00236   static const byte V_HEAD_MAX= 190;
00237 
00238 private:
00239 
00240   
00241   std::deque<Position> moveQue;
00242 
00243 };
00244 
00245 
00246 #endif
00247 
00248 
00249 
00250 
00251 
00252