MyroC  2.3
a C-based package to control Scribbler 2 robots
 All Data Structures 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 
72 typedef struct
73 {
74  int height;
75  int width;
76  Pixel pix_array[256][192];
77 } Picture;
78 /* ***************************************************************/
79 /* 1. GENERAL - GENERAL - GENERAL - GENERAL - GENERAL - GENERAL */
80 /*****************************************************************/
81 
100 int rConnect (const char * address);
101 
105 void rDisconnect();
106 
113 void rSetConnection (int new_socket_num);
114 
121 void rBeep(double duration, int frequency);
122 
130 void rBeep2(double duration, int freq1, int freq2);
131 
138 void rSetName (const char * name);
139 
145 const char * rGetName();
146 
153 void rSetForwardness(char * direction);
154 
158 void rSetForwardnessTxt (char * direction);
159 
164 char * rGetForwardness ();
165 
172 void rSetLEDFront(int led);
173 
182 void rSetLEDBack(double led);
183 
188 double rGetBattery();
189 
200 int rGetStall (int sampleSize);
201 
213 void rSetBluetoothEcho (char onOff);
214 
215 
216 /**************************************************************************/
217 /* 2. SENSORS - SENSORS - SENSORS - SENSORS - SENSORS - SENSORS - SENSORS */
218 /**************************************************************************/
219 
220 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
221 /* Group a: Scribbler Sensors */
222 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
223 
240 void rGetLightsAll (int lightSensors[3], int sampleSize);
241 
242 
259 int rGetLightTxt (const char * sensorName, int sampleSize);
260 
277 void rGetIRAll (int irSensors[2], int sampleSize);
278 
279 
295 int rGetIRTxt (const char * sensorName, int sampleSize);
296 
313 void rGetLine (int lineSensors[2], int sampleSize);
314 
315 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
316 /* Group b: Fluke Sensors */
317 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
318 
324 void rSetIRPower (int power);
325 
343 void rGetObstacleAll (int obstSensors[3], int sampleSize);
344 
365 int rGetObstacleTxt (const char * sensorName, int sampleSize);
366 
382 void rGetBrightAll (int brightSensors[3], int sampleSize);
383 
401 int rGetBrightTxt (char * sensorName, int sampleSize);
402 
409 void rGetInfo (char * infoBuffer);
410 
411 
412 /***********************************************************************/
413 /* 3. MOVEMENT - MOVEMENT - MOVEMENT - MOVEMENT - MOVEMENT - MOVEMENT */
414 /***********************************************************************/
415 
416 /* In this section, "non-blocking" refers to commands that do not prevent
417  the robot from executing other non-movement commands at the same time.
418  For example, a call to rForward in the non-blocking mode with a
419  consecutive call to rBeep will result in the Scribbler moving forward
420  while beeping.
421 */
422 
423 
435 void rTurnLeft (double speed, double time);
436 
448 void rTurnRight (double speed, double time);
449 
465 void rTurnSpeed (char * direction, double speed, double time);
466 
480 void rForward (double speed, double time);
481 
491 void rFastForward (double time);
492 
506 void rBackward (double speed, double time);
507 
520 void rMotors (double leftSpeed, double rightSpeed);
521 
525 void rStop();
526 
530 void rHardStop();
531 
532 /***********************************************************************/
533 /* 4.) PICTURES PICTURES PICTURES PICTURES PICTURES PICTURES PICTURES */
534 /***********************************************************************/
535 /* In this section we deal with taking and manipulating pictures produced
536  from the Scribbler 2 camera. These pictures will always be 256x192 and
537  internally are defined as type Picture, which hold a 2D array of type
538  of Pixel. These can be saved and loaded as .jpeg files.
539  */
540 
545 Picture rTakePicture();
546 
555 void rSavePicture(Picture pic, char * filename);
556 
564 Picture rLoadPicture(char * filename);
565 
566 
580 void rDisplayPicture(Picture pic, double duration, const char * windowTitle);
581 
582 
583 #endif