00001
00002
00003
00004
00005
00006
00007
00008 #ifndef AIBOLED_H
00009 #define AIBOLED_H
00010
00011
00012
00013 #include <math.h>
00014
00015
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
00060 "PRM:/r1/c1/c2/c3/l1-LED2:l1",
00061 "PRM:/r1/c1/c2/c3/l2-LED2:l2",
00062 "PRM:/r1/c1/c2/c3/l3-LED2:l3",
00063 "PRM:/r1/c1/c2/c3/l4-LED2:l4",
00064 "PRM:/r1/c1/c2/c3/l5-LED2:l5",
00065 "PRM:/r1/c1/c2/c3/l6-LED2:l6",
00066 "PRM:/r1/c1/c2/c3/l7-LED2:l7",
00067
00068
00069 "PRM:/r1/c1/c2/c3/l8-LED2:l8",
00070 "PRM:/r1/c1/c2/c3/l9-LED2:l9",
00071 "PRM:/r1/c1/c2/c3/la-LED2:la",
00072 "PRM:/r1/c1/c2/c3/lb-LED2:lb",
00073
00074
00075 "PRM:/r6/l1-LED2:l1",
00076 "PRM:/r6/l2-LED2:l2",
00077 "PRM:/r6/l3-LED2:l3",
00078 "PRM:/r6/l4-LED2:l4",
00079 "PRM:/r6/l5-LED2:l5",
00080 "PRM:/r6/l6-LED2:l6",
00081
00082
00083 "PRM:/r6/l7-LED2:l7",
00084 "PRM:/r6/l8-LED2:l8",
00085 "PRM:/r6/l9-LED2:l9"
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
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