Primitives.h

Go to the documentation of this file.
00001 /*
00002  * This file is part of openSDK.
00003  *
00004  * Copyright (C) 2006-2007 openSDK team
00005  *
00006  * openSDK is free software; you can redistribute it and/or modify
00007  * it under the terms of the GNU General Public License as published by
00008  * the Free Software Foundation; version 2.
00009  *
00010  * openSDK is distributed in the hope that it will be useful,
00011  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
00013  * GNU General Public License for more details.
00014  *
00015  * You should have received a copy of the GNU General Public License
00016  * along with openSDK; if not, write to the Free Software
00017  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
00018  *
00019  *     $Id: Primitives.h,v 1.8 2007/02/12 18:57:28 nuno-lopes Exp $
00020  */
00021 
00022 #ifndef __Primitives_h__
00023 #define __Primitives_h__
00024 
00025 #include <Types.h>
00026 
00027 #define CHECK_PRIMITIVEID() if (primitiveID >= num_of_primitives || primitiveID < 0) { return oINVALID_PRIMITIVE_ID; }
00028 #define CHECK_PRIMITIVEID_ALL() if ((primitiveID >= num_of_primitives || primitiveID < 0) && primitiveID != oprimitiveID_UNDEF) { return oINVALID_PRIMITIVE_ID; }
00029 
00030 struct primitiveTable {
00031         const char *locator;
00032         word pg, ig, dg, ps, is, ds;
00033 };
00034 
00035 // ERS-7 table
00036 // keep'em sorted (because of binary search)
00037 static primitiveTable primitives[] = {
00038         // CPC Primitive Locator                 PGAIN IGAIN DGAIN PSHIFT ISHOFT SHIFT
00039         {"PRM:/a1-Sensor:a1",                     0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // accelerometer Y
00040         {"PRM:/a2-Sensor:a2",                     0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // accelerometer X
00041         {"PRM:/a3-Sensor:a3",                     0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // accelerometer Z
00042         {"PRM:/b1-Sensor:b1",                     0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // WLAN switch
00043         {"PRM:/lu-LED3:lu",                       0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // back light (front, color)
00044         {"PRM:/lv-LED3:lv",                       0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // back light (front, white)
00045         {"PRM:/lw-LED3:lw",                       0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // back light (middle, color)
00046         {"PRM:/lx-LED3:lx",                       0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // back light (middle, white)
00047         {"PRM:/ly-LED3:ly",                       0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // back light (rear, color)
00048         {"PRM:/lz-LED3:lz",                       0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // back light (rear, white)
00049         {"PRM:/p1-Sensor:p1",                     0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // body PSD
00050         {"PRM:/r1/c1-Joint2:11",                  0x0A, 0x04, 0x02, 0x0E, 0x02, 0x0F}, // head tilt 1
00051         {"PRM:/r1/c1/c2-Joint2:12",               0x08, 0x02, 0x04, 0x0E, 0x02, 0x0F}, // head pan
00052         {"PRM:/r1/c1/c2/c3-Joint2:13",            0x08, 0x04, 0x02, 0x0E, 0x02, 0x0F}, // head tilt 2
00053         {"PRM:/r1/c1/c2/c3/c4-Joint2:14",         0x08, 0x00, 0x04, 0x0E, 0x02, 0x0F}, // mouth
00054         {"PRM:/r1/c1/c2/c3/c4/s5-Sensor:s5",      0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // chin switch
00055         {"PRM:/r1/c1/c2/c3/e5-Joint4:15",         0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // left ear
00056         {"PRM:/r1/c1/c2/c3/e6-Joint4:16",         0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // right ear
00057         {"PRM:/r1/c1/c2/c3/i1-FbkImageSensor:F1", 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // right ear
00058         {"PRM:/r1/c1/c2/c3/l1-LED2:l1",           0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // head light (color)
00059         {"PRM:/r1/c1/c2/c3/l2-LED2:l2",           0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // head light (white)
00060         {"PRM:/r1/c1/c2/c3/l3-LED2:l3",           0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // mode Indicator (red)
00061         {"PRM:/r1/c1/c2/c3/l4-LED2:l4",           0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // mode Indicator (green)
00062         {"PRM:/r1/c1/c2/c3/l5-LED2:l5",           0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // mode Indicator (blue)
00063         {"PRM:/r1/c1/c2/c3/l6-LED2:l6",           0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // wireless light
00064         {"PRM:/r1/c1/c2/c3/la-LED3:la",           0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // face light1
00065         {"PRM:/r1/c1/c2/c3/lb-LED3:lb",           0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // face light2
00066         {"PRM:/r1/c1/c2/c3/lc-LED3:lc",           0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // face light3
00067         {"PRM:/r1/c1/c2/c3/ld-LED3:ld",           0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // face light4
00068         {"PRM:/r1/c1/c2/c3/le-LED3:le",           0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // face light5
00069         {"PRM:/r1/c1/c2/c3/lf-LED3:lf",           0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // face light6
00070         {"PRM:/r1/c1/c2/c3/lg-LED3:lg",           0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // face light7
00071         {"PRM:/r1/c1/c2/c3/lh-LED3:lh",           0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // face light8
00072         {"PRM:/r1/c1/c2/c3/li-LED3:li",           0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // face light9
00073         {"PRM:/r1/c1/c2/c3/lj-LED3:lj",           0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // face light10
00074         {"PRM:/r1/c1/c2/c3/lk-LED3:lk",           0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // face light11
00075         {"PRM:/r1/c1/c2/c3/ll-LED3:ll",           0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // face light12
00076         {"PRM:/r1/c1/c2/c3/lm-LED3:lm",           0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // face light13
00077         {"PRM:/r1/c1/c2/c3/ln-LED3:ln",           0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // face light14
00078         {"PRM:/r1/c1/c2/c3/p1-Sensor:p1",         0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // head PSD (near)
00079         {"PRM:/r1/c1/c2/c3/p2-Sensor:p2",         0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // head PSD (far)
00080         {"PRM:/r1/c1/c2/c3/t1-Sensor:t1",         0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // head sensor
00081         {"PRM:/r2/c1-Joint2:21",                  0x1C, 0x08, 0x01, 0x0E, 0x02, 0x0F}, // left front leg J1
00082         {"PRM:/r2/c1/c2-Joint2:22",               0x14, 0x04, 0x01, 0x0E, 0x02, 0x0F}, // left front leg J2
00083         {"PRM:/r2/c1/c2/c3-Joint2:23",            0x1C, 0x08, 0x01, 0x0E, 0x02, 0x0F}, // left front leg J3
00084         {"PRM:/r2/c1/c2/c3/c4-Sensor:24",         0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // left front leg SW
00085         {"PRM:/r3/c1-Joint2:31",                  0x1C, 0x08, 0x01, 0x0E, 0x02, 0x0F}, // left rear leg J1
00086         {"PRM:/r3/c1/c2-Joint2:32",               0x14, 0x04, 0x01, 0x0E, 0x02, 0x0F}, // left rear leg J2
00087         {"PRM:/r3/c1/c2/c3-Joint2:33",            0x1C, 0x08, 0x01, 0x0E, 0x02, 0x0F}, // left rear leg J3
00088         {"PRM:/r3/c1/c2/c3/c4-Sensor:34",         0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // left rear leg SW
00089         {"PRM:/r4/c1-Joint2:41",                  0x1C, 0x08, 0x01, 0x0E, 0x02, 0x0F}, // right front leg J1
00090         {"PRM:/r4/c1/c2-Joint2:42",               0x14, 0x04, 0x01, 0x0E, 0x02, 0x0F}, // right front leg J2
00091         {"PRM:/r4/c1/c2/c3-Joint2:43",            0x1C, 0x08, 0x01, 0x0E, 0x02, 0x0F}, // right front leg J3
00092         {"PRM:/r4/c1/c2/c3/c4-Sensor:44",         0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // right front leg SW
00093         {"PRM:/r5/c1-Joint2:51",                  0x1C, 0x08, 0x01, 0x0E, 0x02, 0x0F}, // right rear leg J1
00094         {"PRM:/r5/c1/c2-Joint2:52",               0x14, 0x04, 0x01, 0x0E, 0x02, 0x0F}, // right rear leg J2
00095         {"PRM:/r5/c1/c2/c3-Joint2:53",            0x1C, 0x08, 0x01, 0x0E, 0x02, 0x0F}, // right rear leg J3
00096         {"PRM:/r5/c1/c2/c3/c4-Sensor:54",         0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // right rear leg SW
00097         {"PRM:/r6/c1-Joint2:61",                  0x0A, 0x04, 0x04, 0x0E, 0x02, 0x0F}, // tail tilt
00098         {"PRM:/r6/c2-Joint2:62",                  0x0A, 0x04, 0x04, 0x0E, 0x02, 0x0F}, // tail pan
00099         {"PRM:/s1-Speaker:S1",                    0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // speaker
00100         {"PRM:/t2-Sensor:t2",                     0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // rear back sensor
00101         {"PRM:/t3-Sensor:t3",                     0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // middle back sensor
00102         {"PRM:/t4-Sensor:t4",                     0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // front back sensor
00103 };
00104 
00105 
00106 #ifdef USARSIM
00107 // USARSim primitives name
00108 static const char* usarsim_primitives[] = {
00109         NULL, // accelerometer Y
00110         NULL, // accelerometer X
00111         NULL, // accelerometer Z
00112         NULL, // WLAN switch
00113         NULL, // back light (front, color)
00114         NULL, // back light (front, white)
00115         NULL, // back light (middle, color)
00116         NULL, // back light (middle, white)
00117         NULL, // back light (rear, color)
00118         NULL, // back light (rear, white)
00119         NULL, // body PSD
00120         "HA", // head tilt 1
00121         "HB", // head pan
00122         "HC", // head tilt 2
00123         NULL, // mouth
00124         NULL, // chin switch
00125         NULL, // left ear
00126         NULL, // right ear
00127         NULL, // right ear
00128         NULL, // head light (color)
00129         NULL, // head light (white)
00130         NULL, // mode Indicator (red)
00131         NULL, // mode Indicator (green)
00132         NULL, // mode Indicator (blue)
00133         NULL, // wireless light
00134         NULL, // face light1
00135         NULL, // face light2
00136         NULL, // face light3
00137         NULL, // face light4
00138         NULL, // face light5
00139         NULL, // face light6
00140         NULL, // face light7
00141         NULL, // face light8
00142         NULL, // face light9
00143         NULL, // face light10
00144         NULL, // face light11
00145         NULL, // face light12
00146         NULL, // face light13
00147         NULL, // face light14
00148         NULL, // head PSD (near)
00149         NULL, // head PSD (far)
00150         NULL, // head sensor
00151         "LFA", // left front leg J1
00152         "LFB", // left front leg J2
00153         "LFC", // left front leg J3
00154         NULL, // left front leg SW
00155         "LRA", // left rear leg J1
00156         "LRB", // left rear leg J2
00157         "LRC", // left rear leg J3
00158         NULL, // left rear leg SW
00159         "RFA", // right front leg J1
00160         "RFB", // right front leg J2
00161         "RFC", // right front leg J3
00162         NULL, // right front leg SW
00163         "RRA", // right rear leg J1
00164         "RRB", // right rear leg J2
00165         "RRC", // right rear leg J3
00166         NULL, // right rear leg SW
00167         NULL, // tail tilt
00168         NULL, // tail pan
00169         NULL, // speaker
00170         NULL, // rear back sensor
00171         NULL, // middle back sensor
00172         NULL, // front back sensor
00173 };
00174 #endif
00175 
00176 const unsigned int num_of_primitives = sizeof(primitives)/sizeof(*primitives);
00177 
00178 #endif

Generated on Sun Dec 2 23:04:30 2007 for openSDK by  doxygen 1.3.9.1