My Project
 All Classes Files Functions Variables
MyroC.h
Go to the documentation of this file.
1 
25  /*
26  Index of all functions
27 
28  1. GENERAL 2. SENSOR
29  rConnect a. Scribbler Sensors
30  rDisconnect rGetLightsAll
31  rSetConnection rGetLightTxt
32  rBeep rGetIRAll
33  rBeep2 rGetIRTxt
34  rSetName rGetLine
35  rGetName
36  rSetForwardness b. Fluke Sensors
37  rGetForwardness rSetIRPower
38  rSetLEDFront rGetObstacleAll
39  rSetLEDBack rGetObstacleTxt
40  rGetBattery rGetBrightAll
41  rGetStall rGetBrightTxt
42  rSetBluetoothEcho
43 
44 3. MOVEMENT 4. PICTURES
45  rTurnLeft rTakePicture
46  rTurnRight rSavePicture
47  rTurnSpeed rLoadPicture
48  rForward rDisplayPicture
49  rFastForward
50  rBackward
51  rMotors
52  rStop
53  rHardStop
54 */
55 
56 #ifndef _MyroC
57 #define _MyroC
58 
61 typedef struct
62 {
63  unsigned char R;
64  unsigned char G;
65  unsigned char B;
66 } Pixel;
67 
75 typedef struct
76 {
77  int height;
78  int width;
79  Pixel pix_array[192][256];
80 } Picture;
81 /* ***************************************************************/
82 /* 1. GENERAL - GENERAL - GENERAL - GENERAL - GENERAL - GENERAL */
83 /*****************************************************************/
84 
103 int rConnect (const char * address);
104 
108 void rDisconnect();
109 
116 void rSetConnection (int new_socket_num);
117 
124 void rBeep(double duration, int frequency);
125 
133 void rBeep2(double duration, int freq1, int freq2);
134 
141 void rSetName (const char * name);
142 
148 const char * rGetName();
149 
156 void rSetForwardness(char * direction);
157 
161 void rSetForwardnessTxt (char * direction);
162 
167 char * rGetForwardness ();
168 
175 void rSetLEDFront(int led);
176 
185 void rSetLEDBack(double led);
186 
191 double rGetBattery();
192 
203 int rGetStall (int sampleSize);
204 
216 void rSetBluetoothEcho (char onOff);
217 
218 
219 /**************************************************************************/
220 /* 2. SENSORS - SENSORS - SENSORS - SENSORS - SENSORS - SENSORS - SENSORS */
221 /**************************************************************************/
222 
223 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
224 /* Group a: Scribbler Sensors */
225 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
226 
243 void rGetLightsAll (int lightSensors[3], int sampleSize);
244 
245 
262 int rGetLightTxt (const char * sensorName, int sampleSize);
263 
280 void rGetIRAll (int irSensors[2], int sampleSize);
281 
282 
298 int rGetIRTxt (const char * sensorName, int sampleSize);
299 
316 void rGetLine (int lineSensors[2], int sampleSize);
317 
318 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
319 /* Group b: Fluke Sensors */
320 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
321 
327 void rSetIRPower (int power);
328 
346 void rGetObstacleAll (int obstSensors[3], int sampleSize);
347 
368 int rGetObstacleTxt (const char * sensorName, int sampleSize);
369 
385 void rGetBrightAll (int brightSensors[3], int sampleSize);
386 
404 int rGetBrightTxt (char * sensorName, int sampleSize);
405 
412 void rGetInfo (char * infoBuffer);
413 
414 
415 /***********************************************************************/
416 /* 3. MOVEMENT - MOVEMENT - MOVEMENT - MOVEMENT - MOVEMENT - MOVEMENT */
417 /***********************************************************************/
418 
419 /* In this section, "non-blocking" refers to commands that do not prevent
420  the robot from executing other non-movement commands at the same time.
421  For example, a call to rForward in the non-blocking mode with a
422  consecutive call to rBeep will result in the Scribbler moving forward
423  while beeping.
424 */
425 
426 
438 void rTurnLeft (double speed, double time);
439 
451 void rTurnRight (double speed, double time);
452 
468 void rTurnSpeed (char * direction, double speed, double time);
469 
483 void rForward (double speed, double time);
484 
494 void rFastForward (double time);
495 
509 void rBackward (double speed, double time);
510 
523 void rMotors (double leftSpeed, double rightSpeed);
524 
528 void rStop();
529 
533 void rHardStop();
534 
535 /***********************************************************************/
536 /* 4.) PICTURES PICTURES PICTURES PICTURES PICTURES PICTURES PICTURES */
537 /***********************************************************************/
538 /* In this section we deal with taking and manipulating pictures produced
539  from the Scribbler 2 camera. These pictures will always be 192x256
540  (192 rows by 256 columns) and internally are defined as type Picture,
541  which hold a 2D array of type of Pixel. These can be saved and loaded
542  as .jpeg files.
543 
544  Following standard mathematical convention for a 2D matrix,
545  all references to a pixel are given within an array as [row][col]
546  */
547 
552 Picture rTakePicture();
553 
562 void rSavePicture(Picture pic, char * filename);
563 
571 Picture rLoadPicture(char * filename);
572 
573 
587 void rDisplayPicture(Picture pic, double duration, const char * windowTitle);
588 
589 
590 #endif