Main Page | Class Hierarchy | Alphabetical List | Data Structures | Directories | File List | Data Fields | Globals | Related Pages | Examples

aiboled.h

Go to the documentation of this file.
00001 // ***************************************************************************
00002 //                           aiboled.h
00003 //
00004 //    copyright            : (C) 2003 by tbaier
00005 //    email                : tbaier@informatik.uni-hamburg.de
00006 // ***************************************************************************
00007 
00008 #ifndef AIBOLED_H
00009 #define AIBOLED_H
00010 
00011 
00012 //std includes
00013 #include <math.h>
00014 
00015 //AIBO includes
00016 #include <OPENR/ODataFormats.h>
00017 #include <OPENR/OObject.h>
00018 #include <OPENR/OPENRAPI.h>
00019 #include <OPENR/OSyslog.h>
00020 #include <Types.h>
00021 
00022 
00023 
00024 
00026 static const int NUM_LEDS = 20;
00027 
00031 enum LED{
00032     FL, 
00033     CL, 
00034     BL, 
00035     FR, 
00036     CR, 
00037     BR, 
00038     BC, 
00039     FA, 
00040     FB, 
00041     FC, 
00042     HL, 
00043     B3, 
00044     B2, 
00045     B1, 
00046     B4, 
00047     B5, 
00048     B6, 
00049     TC, 
00050     TL, 
00051     TR  
00052 };
00053 
00057 static const char* const LED_ARRAY[] = {
00058   
00059   // Head Lights
00060   "PRM:/r1/c1/c2/c3/l1-LED2:l1",       //front left
00061   "PRM:/r1/c1/c2/c3/l2-LED2:l2",       //center left
00062   "PRM:/r1/c1/c2/c3/l3-LED2:l3",       //back left
00063   "PRM:/r1/c1/c2/c3/l4-LED2:l4",       //front right
00064   "PRM:/r1/c1/c2/c3/l5-LED2:l5",       //center right
00065   "PRM:/r1/c1/c2/c3/l6-LED2:l6",       //back right
00066   "PRM:/r1/c1/c2/c3/l7-LED2:l7",       //back center (head indicator)
00067   
00068    //Face lights
00069   "PRM:/r1/c1/c2/c3/l8-LED2:l8",       //front light B
00070   "PRM:/r1/c1/c2/c3/l9-LED2:l9",       //front light A
00071   "PRM:/r1/c1/c2/c3/la-LED2:la",       //front light C
00072   "PRM:/r1/c1/c2/c3/lb-LED2:lb",        //Retractable head light
00073 
00074   //Back lights
00075   "PRM:/r6/l1-LED2:l1",                //first from left
00076   "PRM:/r6/l2-LED2:l2",                //second from left
00077   "PRM:/r6/l3-LED2:l3",                //third from left
00078   "PRM:/r6/l4-LED2:l4",                //fourth from left
00079   "PRM:/r6/l5-LED2:l5",                //fifth from left
00080   "PRM:/r6/l6-LED2:l6",                //sixth from left
00081   
00082   //Tail lights
00083   "PRM:/r6/l7-LED2:l7",                //center
00084   "PRM:/r6/l8-LED2:l8",                //right
00085   "PRM:/r6/l9-LED2:l9"                 //left
00086  };
00087 
00110 class AiboLed {
00111   
00112  public:
00114   AiboLed();
00115   
00117   virtual ~AiboLed(){};
00118   
00122 
00126   void OpenPrimitives();
00128 
00132  
00137   RCRegion* FindFreeRegion() const;
00138   
00143   int FindFreeRegionIndex() const;
00144   
00151   RCRegion* GetRegion(int index = 0);
00152 
00156   int GetValidRegions() const;
00157 
00162   void NewCommandVectorData(int numVecs = 1);
00163   
00164 
00168   //  void NewCommandVectorData();
00169 
00177   void SetCommandVector(int index, OCommandVectorData *vec);
00179 
00183 
00193   void SetLed(LED led, bool on, int time, int cmdVecIndex = 0);
00194   
00195 
00202   void SetLed(LED led, int time, int cmdVecIndex);
00203   
00204   
00211   void SetLed(LED led, int time, bool on = true,int cmdVecIndex = 0);
00212   
00219   void SetLedTime(LED led, int time, bool on = true, int cmdVecIndex = 0);
00220   
00221   
00222 
00229   void SetHeadLight(int time, bool on = true, int cmdVecIndex = 0);
00230   
00232 
00234   static const int MaxLedRegions = 3;
00235 
00237   RCRegion*         Region[MaxLedRegions];
00238 
00239  protected:
00240   
00241   
00243   int LedIndex[NUM_LEDS];
00244   
00246   int ValidRegions;
00247   
00249   OPrimitiveID      LedID[NUM_LEDS];
00250  
00251   
00252 };
00253 
00254 // ******************************************
00255 // **                                      **
00256 // ******************************************
00257 inline void AiboLed::SetHeadLight(int time, bool on, int cmdVecIndex)
00258 {
00259   SetLed(HL, time, on, cmdVecIndex);
00260 };
00261   
00262 
00263 // ******************************************
00264 // **                                      **
00265 // ******************************************
00266 inline RCRegion* AiboLed::GetRegion(int index)
00267 {
00268     return Region[index];
00269 };
00270 
00271 // ******************************************
00272 // **                                      **
00273 // ******************************************
00274 inline int AiboLed::GetValidRegions() const
00275 {
00276   return ValidRegions;
00277 };
00278 
00279 
00280 #endif //define AIBOLED_H


tams Tim Baier AiboLib v0.2.4
Generated Thu Jan 19 11:54:29 2006 by doxygen 1.4.3