MyroC
2.1
a C-based package to control Scribbler 2 robots
Main Page
Data Structures
Files
File List
Globals
All
Data Structures
Files
Functions
Variables
MyroC.h
Go to the documentation of this file.
1
27
/*
28
Index of all functions
29
30
1. GENERAL 2. SENSOR
31
rConnect a. Scribbler Sensors
32
rDisconnect rGetLightsAll
33
rSetConnection rGetLightTxt
34
rBeep rGetIRAll
35
rBeep2 rGetIRTxt
36
rSetName rGetLine
37
rGetName
38
rSetForwardness b. Fluke Sensors
39
rGetForwardness rSetIRPower
40
rSetLEDFront rGetObstacleAll
41
rSetLEDBack rGetObstacleTxt
42
rGetBattery rGetBrightAll
43
rGetStall rGetBrightTxt
44
45
3. MOVEMENT 4. PICTURES
46
rTurnLeft rTakePicture
47
rTurnRight rSavePicture
48
rTurnSpeed rLoadPicture
49
rForward rDisplayPicture
50
rFastForward
51
rBackward
52
rMotors
53
rStop
54
rHardStop
55
*/
56
57
#ifndef _MyroC
58
#define _MyroC
59
62
typedef
struct
63
{
64
unsigned
char
R
;
65
unsigned
char
G
;
66
unsigned
char
B
;
67
}
Pixel
;
68
73
typedef
struct
74
{
75
int
height
;
76
int
width
;
77
Pixel
pix_array[256][192];
78
}
Picture
;
79
/* ***************************************************************/
80
/* 1. GENERAL - GENERAL - GENERAL - GENERAL - GENERAL - GENERAL */
81
/*****************************************************************/
82
101
int
rConnect (
const
char
* address);
102
106
void
rDisconnect();
107
114
void
rSetConnection (
int
socket_num);
115
122
void
rBeep(
double
duration,
int
frequency);
123
131
void
rBeep2(
double
duration,
int
freq1,
int
freq2);
132
139
void
rSetName (
const
char
* name);
140
146
const
char
* rGetName();
147
154
void
rSetForwardness(
char
* direction);
155
159
void
rSetForwardnessTxt (
char
* direction);
160
165
char
* rGetForwardness ();
166
173
void
rSetLEDFront(
int
led);
174
183
void
rSetLEDBack(
double
led);
184
189
double
rGetBattery();
190
201
int
rGetStall (
int
sampleSize);
202
203
204
/**************************************************************************/
205
/* 2. SENSORS - SENSORS - SENSORS - SENSORS - SENSORS - SENSORS - SENSORS */
206
/**************************************************************************/
207
208
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
209
/* Group a: Scribbler Sensors */
210
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
211
228
void
rGetLightsAll (
int
lightSensors[3],
int
sampleSize);
229
230
247
int
rGetLightTxt (
const
char
* sensorName,
int
sampleSize);
248
265
void
rGetIRAll (
int
irSensors[2],
int
sampleSize);
266
267
283
int
rGetIRTxt (
const
char
* sensorName,
int
sampleSize);
284
301
void
rGetLine (
int
lineSensors[2],
int
sampleSize);
302
303
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
304
/* Group b: Fluke Sensors */
305
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
306
312
void
rSetIRPower (
int
power);
313
331
void
rGetObstacleAll (
int
obstSensors[3],
int
sampleSize);
332
353
int
rGetObstacleTxt (
const
char
* sensorName,
int
sampleSize);
354
370
void
rGetBrightAll (
int
brightSensors[3],
int
sampleSize);
371
389
int
rGetBrightTxt (
char
* sensorName,
int
sampleSize);
390
397
void
rGetInfo (
char
* infoBuffer);
398
399
400
/***********************************************************************/
401
/* 3. MOVEMENT - MOVEMENT - MOVEMENT - MOVEMENT - MOVEMENT - MOVEMENT */
402
/***********************************************************************/
403
404
/* In this section, "non-blocking" refers to commands that do not prevent
405
the robot from executing other non-movement commands at the same time.
406
For example, a call to rForward in the non-blocking mode with a
407
consecutive call to rBeep will result in the Scribbler moving forward
408
while beeping.
409
*/
410
411
423
void
rTurnLeft (
double
speed,
double
time);
424
436
void
rTurnRight (
double
speed,
double
time);
437
453
void
rTurnSpeed (
char
* direction,
double
speed,
double
time);
454
468
void
rForward (
double
speed,
double
time);
469
479
void
rFastForward (
double
time);
480
494
void
rBackward (
double
speed,
double
time);
495
508
void
rMotors (
double
leftSpeed,
double
rightSpeed);
509
513
void
rStop();
514
518
void
rHardStop();
519
520
/***********************************************************************/
521
/* 4.) PICTURES PICTURES PICTURES PICTURES PICTURES PICTURES PICTURES */
522
/***********************************************************************/
523
/* In this section we deal with taking and manipulating pictures produced
524
from the Scribbler 2 camera. These pictures will always be 256x192 and
525
internally are defined as type Picture, which hold a 2D array of type
526
of Pixel. These can be saved and loaded as .jpeg files.
527
*/
528
533
Picture
rTakePicture();
534
543
void
rSavePicture(
Picture
pic,
char
* filename);
544
552
Picture
rLoadPicture(
char
* filename);
553
554
568
void
rDisplayPicture(
Picture
pic,
double
duration,
const
char
* windowTitle);
569
570
571
#endif
Generated on Wed Jan 7 2015 16:59:28 for MyroC by
1.8.1.2