Eyebot 7  7.16
A Hardware API to control various hardware
eyebot.h File Reference

Header file for the EyeBot 7 functions. More...

#include "types.h"

Functions

LCD

Available functions for the LCD

int LCDPrintf (const char *format,...)
 Print formatted string to LCD and refresh LCD. Cursor position is updated. More...
 
int LCDSetPrintf (int row, int column, const char *format,...)
 LCDPrintf with text position specified. More...
 
int LCDClear (void)
 Clear the LCD display and all display buffers ie. turn it black. More...
 
int LCDSetPos (int row, int column)
 Set the text cursor position to (row, column). More...
 
int LCDGetPos (int *row, int *column)
 Get the text cursor position. More...
 
int LCDSetColor (COLOR fg, COLOR bg)
 Set the default color for text (including background). More...
 
int LCDSetFont (int font, int variation)
 Sets the font using font type and variation. More...
 
int LCDSetFontSize (int fontsize)
 Sets the font size. More...
 
int LCDSetMode (int mode)
 Update the internal mode flag bits. More...
 
int LCDMenu (char *st1, char *st2, char *st3, char *st4)
 Set menu entries in KEY_CLASSIC mode (4-buttons). More...
 
int LCDMenuI (int pos, char *string, COLOR fg, COLOR bg)
 Set specific menu entry in KEY_CLASSIC mode (index given by pos). More...
 
int LCDGetSize (int *x, int *y)
 Get LCD resolution in pixels. More...
 
int LCDPixel (int x, int y, COLOR col)
 Sets the color of the pixel at (x,y) coordinate to color. More...
 
int LCDPixelInvert (int x, int y)
 Bit-invert the color of the pixel at (x,y) coordinate. More...
 
COLOR LCDGetPixel (int x, int y)
 Get the RGB color value of the pixel at (x,y) coordinate. More...
 
int LCDLine (int x1, int y1, int x2, int y2, COLOR col)
 Draw a color line from (x1,y1) to (x2,y2). More...
 
int LCDLineInvert (int x1, int y1, int x2, int y2)
 Draw a line from (x1,y1) to (x2,y2). The line pixels will invert the color of existing pixels. More...
 
int LCDArea (int x1, int y1, int x2, int y2, COLOR col, int fill)
 Draw a color-filled rectangle with (x1,y1) as top-left coordinate and (x2,y2) as the bottom-right coordinate. More...
 
int LCDAreaInvert (int x1, int y1, int x2, int y2)
 Draw a rectangle with (x1,y1) as top-left coordinate and (x2,y2) as the bottom-right coordinate. The pixels in the specified area will invert the color of existing pixels. More...
 
int LCDCircle (int x1, int y1, int size, COLOR col, int fill)
 Draws a circle. More...
 
int LCDCircleInvert (int x1, int y1, int size)
 Inverts the pixels inside of the given circle. More...
 
int LCDImageSize (int t)
 Specifies the size of subsequent LCDImage functions. More...
 
int LCDImageStart (int x, int y, int xs, int ys)
 Sets the location and size parameters for subsequent image draws. More...
 
int LCDImage (BYTE *img)
 Draws a colour (RGB) image to the LCD. More...
 
int LCDImageGray (BYTE *g)
 Draws a greyscale [0..255] image to the LCD. More...
 
int LCDImageBinary (BYTE *b)
 Draws a binary [0..1] image to the LCD. More...
 
int LCDRefresh (void)
 Refresh the screen. Refreshes the menu. More...
 
KEY

Available functions for usage of the Keys

int KEYGet (void)
 Blocking read (and wait) for key press (returns KEY1..KEY4) More...
 
int KEYRead (void)
 Non-blocking read of key press (returns NOKEY=0 if no key) More...
 
int KEYWait (int key)
 Wait for specific keys to be pressed. (use ANYKEY for any key) More...
 
int KEYGetXY (int *x, int *y)
 Blocking read for touch at any position, and returns the coordinates of the pressed position. More...
 
int KEYReadXY (int *x, int *y)
 Non-blocking read for touch at any position, returns coordinates of pressed position. More...
 
CAM

Available functions for usage of the Camera

int CAMInit (int resolution)
 Initialises the camera. More...
 
int CAMRelease (void)
 Stops and releases all camera structures. More...
 
int CAMGet (BYTE *buf)
 Retrieve a camera frame into the provided buffer. More...
 
int CAMGetGray (BYTE *buf)
 Grabs a gray image off the camera. More...
 
IP

Available functions for image processing

int IPSetSize (int resolution)
 Sets the size for the image processing (also automatically set by CAMInit). More...
 
int IPReadFile (char *filename, BYTE *img)
 Read PNM file, fill/crop if req.; return 0 for color, 1 for gray image. More...
 
int IPWriteFile (char *filename, BYTE *img)
 Write color PNM file. More...
 
int IPWriteFileGray (char *filename, BYTE *gray)
 Write greyscale PNM file. More...
 
void IPLaplace (BYTE *grayIn, BYTE *grayOut)
 apply Laplace tranform to the image More...
 
void IPSobel (BYTE *imageIn, BYTE *imageOut)
 apply Sobel tranform to the image More...
 
void IPCol2Gray (BYTE *imgIn, BYTE *grayOut)
 Transfer color to gray image. More...
 
void IPGray2Col (BYTE *imgIn, BYTE *colOut)
 Transfer grey to color (3-byte) image. More...
 
void IPRGB2Col (BYTE *r, BYTE *g, BYTE *b, BYTE *imgOut)
 Transfer grey to color (3-byte) image. More...
 
void IPCol2HSI (BYTE *img, BYTE *h, BYTE *s, BYTE *i)
 Transfer color image to hue sat int. More...
 
void IPOverlay (BYTE *c1, BYTE *c2, BYTE *cOut)
 Overlay c2 onto c1, all color images. More...
 
void IPOverlayGray (BYTE *g1, BYTE *g2, COLOR col, BYTE *cOut)
 Overlay gray image g2 onto g1, using col. More...
 
COLOR IPPRGB2Col (BYTE r, BYTE g, BYTE b)
 Transforms RGB to a COLOR (for one Pixel) More...
 
void IPPCol2RGB (COLOR col, BYTE *r, BYTE *g, BYTE *b)
 Transforms COLOR to RGB (for one Pixel) More...
 
void IPPCol2HSI (COLOR c, BYTE *h, BYTE *s, BYTE *i)
 Transforms RGB to HSI (for one pixel) More...
 
BYTE IPPRGB2Hue (BYTE r, BYTE g, BYTE b)
 Convert RGB to hue (0 for gray values) More...
 
void IPPRGB2HSI (BYTE r, BYTE g, BYTE b, BYTE *h, BYTE *s, BYTE *i)
 Convert RGB to hue, sat, int; hue=0 for gray values. More...
 
OS

Available functions for obtaining system information

char * OSExecute (char *command)
 Executes a system command and obtains the string returned after the command. More...
 
int OSVersion (char *buf)
 Returns string containing running RoBIOS version. More...
 
int OSVersionIO (char *buf)
 Gives the version of the IO board. More...
 
int OSMachineSpeed (void)
 Inform the user how fast the processor runs. More...
 
int OSMachineType (void)
 Inform the user in which environment the program runs. More...
 
int OSMachineName (char *buf)
 Inform the user with which name the Eyebot is titled. More...
 
int OSMachineID (void)
 Inform the user with which ID the Eyebot is titled. More...
 
MT

Available functions for usage of the Multitasking

int MTInit (void)
 initialises the threads More...
 
int MTSleep (int n)
 sleeps for 10ms ie n/100s More...
 
TASK MTSpawn (void *(*fct)(void *), int id)
 Create and initialize thread with given ID. More...
 
int MTGetUID (TASK t)
 gets the ID of the taks More...
 
int MTKill (TASK t)
 kills the task t More...
 
int MTExit (void)
 kills current task More...
 
int SEMAInit (SEMA *sem, int val)
 initialises the semaphores More...
 
int SEMALock (SEMA *sem)
 locks the given semaphoe More...
 
int SEMAUnlock (SEMA *sem)
 unlocks the given semaphore More...
 
int OSWait (int n)
 Waits for 1 ms. More...
 
TIMER OSAttachTimer (int scale, void(*fct)(void))
 adds a function to a 1kHz/scale timer, ie. executes every 1ms*scale usage: OSAttachTimer(<scale>, &<function>); More...
 
int OSDetachTimer (TIMER t)
 removes the Timer from the list More...
 
int OSSetTime (int hrs, int mins, int secs)
 sets the system time More...
 
int OSGetTime (int *hrs, int *mins, int *secs, int *ticks)
 Get system time (ticks in 1/100 sec) More...
 
int OSGetCount (void)
 gives you the count in 1/100 sec since the system start More...
 
SER

Available functions for usage of the serial communication

int SERInit (int interface, int baud, int handshake)
 Initialises the port. More...
 
int SERSendChar (int interface, char ch)
 Sends a single character to the given port handle. More...
 
int SERSend (int interface, char *buf)
 Sends a string to the given port handle. More...
 
char SERReceiveChar (int interface)
 Receives a single character from the given port handle. More...
 
int SERReceive (int interface, char *buf)
 Receives a string from port handle. More...
 
bool SERCheck (int interface)
 checks and flushes the port by sending enter until seeing prompt More...
 
int SERFlush (int interface)
 flushes the port More...
 
int SERClose (int interface)
 closes the port More...
 
AU

Available functions for usage of the audio on the eyebot

int AUBeep (void)
 Play beep sound. More...
 
int AUTone (int freq, int time)
 Play tone with FREQ for time/100 sec. More...
 
int AUCheckTone (void)
 Non-blocking test if tone has finished. More...
 
int AUPlay (BYTE *sample)
 Play audio sample. More...
 
int AUCheckPlay (void)
 Non-blocking test if playing has finished. More...
 
int AUMicrophone (void)
 Return microphone A-to-D sample value. More...
 
int AURecord (BYTE *buf, int time, long freq)
 Record sound for time/100sec using sample FREQ. More...
 
int AUCheckRecord (void)
 Non-blocking check whether recording has finished. More...
 
PSD

Available functions for access of the IR PSDs

int PSDGet (int psd)
 Delivers actual timestamp or distance measured by the selected PSD. More...
 
int PSDGetRaw (int psd)
 Delivers raw-data measured by the selected PSD. More...
 
SERVO

Available functions for usage of the Servos

int SERVOSet (int servo, int angle)
 Set the given servos to the same given angle depending on table value. More...
 
int SERVOSetRaw (int servo, int angle)
 Set the given servos to the same given angle in raw mode. More...
 
int SERVORange (int servo, int low, int high)
 Sets the range for the servos. More...
 
MOTOR

Available functions for usage of the Motors

int MOTORDrive (int motor, int speed)
 Set the given motors to the same given speed dependant on hdt table. More...
 
int MOTORDriveRaw (int motor, int speed)
 Set the given motor to a given speed. More...
 
int MOTORPID (int motor, int p, int i, int d)
 Set the given motors with PID control. More...
 
int MOTORPIDOff (int motor)
 Shuts off PID control. More...
 
int MOTORSpeed (int motor, int ticks)
 Sets the controlled motor speed in ticks/sec. More...
 
ENCODER

Available functions for usage of the encoders

int ENCODERRead (int quad)
 Reads the value from the encoder. More...
 
int ENCODERReset (int quad)
 Resets the encoder to 0. More...
 
VW

Available functions for usage of VW drive functions

int VWSetSpeed (int linSpeed, int angSpeed)
 Sets the VW speed, angle. More...
 
int VWGetSpeed (int *linSspeed, int *angSpeed)
 Obtains the current speeds. More...
 
int VWSetPosition (int x, int y, int phi)
 Sets the position wrt current position. More...
 
int VWGetPosition (int *x, int *y, int *phi)
 Gets the position wrt original position. More...
 
int VWControl (int Vv, int Tv, int Vw, int Tw)
 Set PI params. for v and w (typical 70 30 70 10) More...
 
int VWControlOff (void)
 Stop PI control for v and w. More...
 
int VWStraight (int dist, int lin_speed)
 Drives straight. More...
 
int VWTurn (int angle, int ang_speed)
 Turns the vehicle on the spot. More...
 
int VWCurve (int dist, int angle, int lin_speed)
 Turns the vehicle in a curve. More...
 
int VWDrive (int dx, int dy, int lin_speed)
 Turns the vehicle in a curve: x[mm] straight and y[mm] left, x>|y|. More...
 
int VWDriveRemain (void)
 Checks the remaining drive time. More...
 
int VWDriveDone (void)
 Checks to see if the current drive is complete. More...
 
int VWDriveWait (void)
 Blocks until the drive is complete. More...
 
int VWStalled (void)
 Checks to see if the vehicle is stalled. More...
 
DIGITAL

Available functions for usage of the IO pins

int DIGITALSetup (int io, char direction)
 Sets up the digital input/output pins. More...
 
int DIGITALRead (int io)
 Reads the digital input/output pins. More...
 
int DIGITALReadAll (void)
 Reads all digital pins. More...
 
int DIGITALWrite (int io, int state)
 Writes to the digital input/output pins. More...
 
int ANALOGRead (int channel)
 Reads the analog channel on the IO board. More...
 
int ANALOGVoltage (void)
 Finds the Analog Voltage as read from the IO board. More...
 
IRTV

Available functions for usage of the IR remote control

int IRTVGet (void)
 Blocking read of IRTV command and returns the keycode. More...
 
int IRTVRead (void)
 Non-blocking read, return 0 if nothing and returns the keycode. More...
 
int IRTVFlush (void)
 Terminates the remote control decoder and releases the irtv thread. More...
 
int IRTVGetStatus (void)
 Checks to see if IR input is enabled;. More...
 
RADIO

Available functions for usage of the radio communication to the other eyebots

int RADIOInit (void)
 Starts radio communication between the Eyebots. More...
 
int RADIOGetID (void)
 Get own radio ID. More...
 
int RADIOSend (int id_no, BYTE *buf, int size)
 Send spec. number of bytes to ID destination. More...
 
int RADIOReceive (int *id_no, BYTE *buf, int *size)
 Read num. of bytes from ID source. More...
 
int RADIOCheck (int *id_no)
 Non-blocking check whether message is waiting. More...
 
int RADIOStatus (int IDlist[])
 Returns number of robots (incl. self) and list of IDs in network. More...
 
int RADIORelease (void)
 Terminate radio communication. More...
 

Detailed Description

Header file for the EyeBot 7 functions.

Author
Marcus Pham, Thomas Braunl, June 2016

Function Documentation

int ANALOGRead ( int  channel)

Reads the analog channel on the IO board.

Parameters
thechannel to read from [1..8]
Returns
a hex value representing the analog value
int ANALOGVoltage ( void  )

Finds the Analog Voltage as read from the IO board.

Returns
the voltage*100, on failure returns -1
int AUBeep ( void  )

Play beep sound.

Returns
0 always
int AUCheckPlay ( void  )

Non-blocking test if playing has finished.

int AUCheckRecord ( void  )

Non-blocking check whether recording has finished.

Returns
0 if incomplete, 1 if complete
int AUCheckTone ( void  )

Non-blocking test if tone has finished.

int AUMicrophone ( void  )

Return microphone A-to-D sample value.

Returns
the Analog to Digital value
int AUPlay ( BYTE sample)

Play audio sample.

Parameters
samplethe raw audio file
Returns
0 always
int AURecord ( BYTE buf,
int  time,
long  freq 
)

Record sound for time/100sec using sample FREQ.

Parameters
bufthe buffer to record audio to
timethe length of the recording
freqthe sample freq
Returns
0 always
int AUTone ( int  freq,
int  time 
)

Play tone with FREQ for time/100 sec.

Parameters
freqthe frequency of the beep
timethe time/100s for the beep to play
Returns
0 always
int CAMGet ( BYTE buf)

Retrieve a camera frame into the provided buffer.

Parameters
BYTE*buf: the buffer to store the image
Returns
Nonzero on success, zero on failure.
int CAMGetGray ( BYTE buf)

Grabs a gray image off the camera.

Parameters
thebyte stream to store the image data, data in Gray format
Returns
0 iff initialised correctly, otherwise 1
int CAMInit ( int  resolution)

Initialises the camera.

Parameters
intresolution The resolution of the camera (QQVGA, QVGA, VGA, CAM1MP, CAMHD, CAM5MP, CUSTOM) default QVGA
Returns
Nonzero on success, zero on failure.
int CAMRelease ( void  )

Stops and releases all camera structures.

Returns
Nonzero on success, zero on failure.

Releases all allocated memory and stops video capture.

int DIGITALRead ( int  io)

Reads the digital input/output pins.

Parameters
iothe pin to check status [1..16]
Returns
the status of the pin
int DIGITALReadAll ( void  )

Reads all digital pins.

Returns
an integer representing the value current status of all pins MSB first
int DIGITALSetup ( int  io,
char  direction 
)

Sets up the digital input/output pins.

Parameters
iothe pin to setup [1..16]
direction[i-n/o-ut/I-n pull-up/J-n pull-down]
Returns
0 on success, 1 on failure
int DIGITALWrite ( int  io,
int  state 
)

Writes to the digital input/output pins.

Parameters
iothe pin to set [1..16]
statethe state of the pin [0 or 1]
Returns
0 on success, 1 on failure
int ENCODERRead ( int  quad)

Reads the value from the encoder.

Parameters
quadthe encoder to read from [1..4]
Returns
the encoder value on success, 1 on failure
int ENCODERReset ( int  quad)

Resets the encoder to 0.

Parameters
quadthe encoder to reset [1..4]
Returns
0 on success, 1 on failure
void IPCol2Gray ( BYTE imgIn,
BYTE grayOut 
)

Transfer color to gray image.

Parameters
imgInthe input image
grayOutthe formatted output image
void IPCol2HSI ( BYTE img,
BYTE h,
BYTE s,
BYTE i 
)

Transfer color image to hue sat int.

Parameters
imgthe input image
hthe hue
sthe saturation
ithe intensity
void IPGray2Col ( BYTE imgIn,
BYTE colOut 
)

Transfer grey to color (3-byte) image.

Parameters
imgInthe input image
colOutthe formatted output image
void IPLaplace ( BYTE grayIn,
BYTE grayOut 
)

apply Laplace tranform to the image

Parameters
grayInthe input image
grayOutthe formatted output image
void IPOverlay ( BYTE c1,
BYTE c2,
BYTE cOut 
)

Overlay c2 onto c1, all color images.

Parameters
c2
c1
cOutthe output image
void IPOverlayGray ( BYTE g1,
BYTE g2,
COLOR  col,
BYTE cOut 
)

Overlay gray image g2 onto g1, using col.

Parameters
g1
g2
col
cOutthe output image
void IPPCol2HSI ( COLOR  c,
BYTE h,
BYTE s,
BYTE i 
)

Transforms RGB to HSI (for one pixel)

Parameters
COLORc the color to transform
hthe hue
sthe saturation
ithe intensity
void IPPCol2RGB ( COLOR  col,
BYTE r,
BYTE g,
BYTE b 
)

Transforms COLOR to RGB (for one Pixel)

Parameters
rthe red
gthe green
bthe blue
COLORthe COLOR
COLOR IPPRGB2Col ( BYTE  r,
BYTE  g,
BYTE  b 
)

Transforms RGB to a COLOR (for one Pixel)

Parameters
rthe red
gthe green
bthe blue
Returns
COLOR the COLOR
void IPPRGB2HSI ( BYTE  r,
BYTE  g,
BYTE  b,
BYTE h,
BYTE s,
BYTE i 
)

Convert RGB to hue, sat, int; hue=0 for gray values.

Parameters
rthe red
gthe green
bthe blue
hthe hue
sthe saturation
ithe intensity
BYTE IPPRGB2Hue ( BYTE  r,
BYTE  g,
BYTE  b 
)

Convert RGB to hue (0 for gray values)

Parameters
rthe red
gthe green
bthe blue
Returns
BYTE a hue value
int IPReadFile ( char *  filename,
BYTE img 
)

Read PNM file, fill/crop if req.; return 0 for color, 1 for gray image.

Parameters
filenamethe file to open
imgthe buffer to store the image
Returns
Returns: 1 =PBM, 2 =PGM, 3 =PPM (or 4, 5, 6 for binary versions)
void IPRGB2Col ( BYTE r,
BYTE g,
BYTE b,
BYTE imgOut 
)

Transfer grey to color (3-byte) image.

Parameters
imgInthe input image
colOutthe formatted output image
int IPSetSize ( int  resolution)

Sets the size for the image processing (also automatically set by CAMInit).

Parameters
modethe resolution (QQVGA, QVGA, VGA, CAM1MP, CAMHD, CAM5MP, CUSTOM) specifying the resolution of the camera
Returns
0 if initialised correctly, otherwise 1
void IPSobel ( BYTE imageIn,
BYTE imageOut 
)

apply Sobel tranform to the image

Parameters
imageInthe input image
imageOutthe formatted output image
int IPWriteFile ( char *  filename,
BYTE img 
)

Write color PNM file.

Parameters
filenamethe file to save to
imgthe buffer to store the image
Returns
0 always
int IPWriteFileGray ( char *  filename,
BYTE gray 
)

Write greyscale PNM file.

Parameters
filenamethe file to save to
imgthe buffer to store the image
Returns
0 always
int IRTVFlush ( void  )

Terminates the remote control decoder and releases the irtv thread.

Returns
0 always
int IRTVGet ( void  )

Blocking read of IRTV command and returns the keycode.

Returns
Next code from the buffer
int IRTVGetStatus ( void  )

Checks to see if IR input is enabled;.

Returns
int retVal: whether IR input is enabled [on = 1, off =0]
int IRTVRead ( void  )

Non-blocking read, return 0 if nothing and returns the keycode.

Returns
Next code from the buffer
int KEYGet ( void  )

Blocking read (and wait) for key press (returns KEY1..KEY4)

Returns
(int) KEYCODE retKey : Keycode value
int KEYGetXY ( int *  x,
int *  y 
)

Blocking read for touch at any position, and returns the coordinates of the pressed position.

Returns
0 always
int KEYRead ( void  )

Non-blocking read of key press (returns NOKEY=0 if no key)

Returns
(int) KEYCODE retKey : Keycode value
int KEYReadXY ( int *  x,
int *  y 
)

Non-blocking read for touch at any position, returns coordinates of pressed position.

Returns
0 on a keypress, 1 otherwise
int KEYWait ( int  key)

Wait for specific keys to be pressed. (use ANYKEY for any key)

Parameters
intkey : Expected keycode values (KEY1..KEY4)
Returns
(int) KEYCODE retKey : Keycode value
int LCDArea ( int  x1,
int  y1,
int  x2,
int  y2,
COLOR  col,
int  fill 
)

Draw a color-filled rectangle with (x1,y1) as top-left coordinate and (x2,y2) as the bottom-right coordinate.

Parameters
intx1 : X-coordinate of top-left pixel
inty1 : Y-coordinate of top-left pixel
intx2 : X-coordinate of bottom-right pixel
inty2 : Y-coordinate of bottom-right pixel
COLORcol : RGB fill color value
Returns
int retVal : always 0
int LCDAreaInvert ( int  x1,
int  y1,
int  x2,
int  y2 
)

Draw a rectangle with (x1,y1) as top-left coordinate and (x2,y2) as the bottom-right coordinate. The pixels in the specified area will invert the color of existing pixels.

Parameters
intx1 : X-coordinate of top-left pixel
inty1 : Y-coordinate of top-left pixel
intx2 : X-coordinate of bottom-right pixel
inty2 : Y-coordinate of bottom-right pixel
Returns
int retVal : always 0
int LCDCircle ( int  x1,
int  y1,
int  size,
COLOR  col,
int  fill 
)

Draws a circle.

Parameters
intx1 : X-coordinate of the centre
inty1 : Y-coordinate of the centre
intsize : radius of the circle
COLORcol: the color of the circle
intfill : fill(1) or no fill(0)
Returns
int retVal : always 0
int LCDCircleInvert ( int  x1,
int  y1,
int  size 
)

Inverts the pixels inside of the given circle.

Parameters
intx1 : X-coordinate of the centre
inty1 : Y-coordinate of the centre
intr the radius of the circle
Returns
int retVal : always 0
int LCDClear ( void  )

Clear the LCD display and all display buffers ie. turn it black.

Returns
int retVal : always 0
COLOR LCDGetPixel ( int  x,
int  y 
)

Get the RGB color value of the pixel at (x,y) coordinate.

Parameters
intx : X-coordinate of the pixel
inty : Y-coordinate of the pixel
Returns
COLOR color : RGB color value
int LCDGetPos ( int *  row,
int *  column 
)

Get the text cursor position.

Parameters
int*row : Pointer to cursor row index
int*column : Pointer to cursor column index
Returns
int retVal : always 0
int LCDGetSize ( int *  x,
int *  y 
)

Get LCD resolution in pixels.

Parameters
x: Where to store the width of the LCD
y: Where to store the height of the LCD
Returns
int retVal : always 0
int LCDImage ( BYTE img)

Draws a colour (RGB) image to the LCD.

Parameters
img: A pointer to the BYTE buffer of the image
Returns
int retVal : always 0
int LCDImageBinary ( BYTE b)

Draws a binary [0..1] image to the LCD.

Parameters
img: A pointer to the BYTE buffer of the image
Returns
int retVal : always 0
int LCDImageGray ( BYTE g)

Draws a greyscale [0..255] image to the LCD.

Parameters
img: A pointer to the BYTE buffer of the image
Returns
int retVal : always 0
int LCDImageSize ( int  t)

Specifies the size of subsequent LCDImage functions.

Parameters
inttype: the size of the image (QQVGA, QVGA, VGA, CAM1MP, CAMHD, CAM5MP, CUSTOM), default QVGA
Returns
int ret: always 0
int LCDImageStart ( int  x,
int  y,
int  xs,
int  ys 
)

Sets the location and size parameters for subsequent image draws.

Parameters
intt : the image type
intx : x-coordinate of top-left image position
inty : y-coordinate of top-left image position
intxs : Image width
intys : Image height
Returns
int retVal : always 0
int LCDLine ( int  x1,
int  y1,
int  x2,
int  y2,
COLOR  col 
)

Draw a color line from (x1,y1) to (x2,y2).

Parameters
intx1 : X-coordinate of first pixel
inty1 : Y-coordinate of first pixel
intx2 : X-coordinate of second pixel
inty2 : Y-coordinate of second pixel
COLORcolor : RGB color value for the pixel
Returns
int retVal : always 0
int LCDLineInvert ( int  x1,
int  y1,
int  x2,
int  y2 
)

Draw a line from (x1,y1) to (x2,y2). The line pixels will invert the color of existing pixels.

Parameters
intx1 : X-coordinate of first pixel
inty1 : Y-coordinate of first pixel
intx2 : X-coordinate of second pixel
inty2 : Y-coordinate of second pixel
Returns
int retVal : always 0
int LCDMenu ( char *  st1,
char *  st2,
char *  st3,
char *  st4 
)

Set menu entries in KEY_CLASSIC mode (4-buttons).

Parameters
char*string1 : Menu entry for KEY1 in classic mode
char*string2 : Menu entry for KEY2 in classic mode
char*string3 : Menu entry for KEY3 in classic mode
char*string4 : Menu entry for KEY4 in classic mode
Returns
int retVal : always 0
int LCDMenuI ( int  pos,
char *  string,
COLOR  fg,
COLOR  bg 
)

Set specific menu entry in KEY_CLASSIC mode (index given by pos).

Parameters
intpos : Select menu entry in classic mode (from 1->4)
char*string : Menu entry for the key at specified index
XColorfgcol : Textcolor for the menu
XColorbgcol : Background color for the menu
Returns
int retVal : always 0
int LCDPixel ( int  x,
int  y,
COLOR  col 
)

Sets the color of the pixel at (x,y) coordinate to color.

Parameters
intx : X-coordinate of the pixel
inty : Y-coordinate of the pixel
col: RGB color value for the pixel
Returns
int retVal : always 0
int LCDPixelInvert ( int  x,
int  y 
)

Bit-invert the color of the pixel at (x,y) coordinate.

Parameters
intx : X-coordinate of the pixel
inty : Y-coordinate of the pixel
Returns
int retVal : always 0
int LCDPrintf ( const char *  format,
  ... 
)

Print formatted string to LCD and refresh LCD. Cursor position is updated.

Parameters
constchar* format : Formatted string
Returns
int retVal : always 0
int LCDRefresh ( void  )

Refresh the screen. Refreshes the menu.

Returns
int retVal : always 0
int LCDSetColor ( COLOR  fg,
COLOR  bg 
)

Set the default color for text (including background).

Parameters
fg: Default color for text
bg: Default color for text background
Returns
0 always
int LCDSetFont ( int  font,
int  variation 
)

Sets the font using font type and variation.

Parameters
intfont: The type of font (HELVETICA/TIMES/COURIER)
intvariation: The variation (NORMAL/BOLD/ITALICS)
Returns
0 always
int LCDSetFontSize ( int  fontsize)

Sets the font size.

Parameters
intfontsize: The size of subsequent printf (8, 12, 14, 18, 24)
Returns
0 on success, 1 for invalid fontsize
int LCDSetMode ( int  mode)

Update the internal mode flag bits.

Parameters
intmode : LCD Mode flag (default = 0)
Returns
int retVal : always 0
int LCDSetPos ( int  row,
int  column 
)

Set the text cursor position to (row, column).

Parameters
introw : Text cursor row index
intcolumn : Text cursor column index
Returns
int retVal : always 0
int LCDSetPrintf ( int  row,
int  column,
const char *  format,
  ... 
)

LCDPrintf with text position specified.

Parameters
introw : Cursor position
intcolumn : Cursor position
constchar* format : Formatted string
Returns
int retVal : always 0
int MOTORDrive ( int  motor,
int  speed 
)

Set the given motors to the same given speed dependant on hdt table.

Parameters
motorthe motor to set [1..4]
speed: motor speed in percent [-100 ..+100]
Returns
0 on success, 1 on failure
int MOTORDriveRaw ( int  motor,
int  speed 
)

Set the given motor to a given speed.

Parameters
motorthe motor to set [1..4]
speed: motor speed [-100 ..+100]
Returns
0 on success, 1 on failure
int MOTORPID ( int  motor,
int  p,
int  i,
int  d 
)

Set the given motors with PID control.

Parameters
motorthe motor to set [1..4]
pthe p setting [1..255]
ithe i setting [1..255]
dthe d setting [1..255]
Returns
0 on success, 1 on failure
int MOTORPIDOff ( int  motor)

Shuts off PID control.

Parameters
motorthe motor to set [1..4]
Returns
0 on success, 1 on failure
int MOTORSpeed ( int  motor,
int  ticks 
)

Sets the controlled motor speed in ticks/sec.

Parameters
motorthe motor to set [1..4]
ticksthe number of ticks per sec
Returns
0 on success, 1 on failure
int MTExit ( void  )

kills current task

Returns
0 on success, 1 otherwise
int MTGetUID ( TASK  t)

gets the ID of the taks

Parameters
TASKt the task to search for ID
Returns
0 on success, 1 otherwise
int MTInit ( void  )

initialises the threads

Returns
0 always
int MTKill ( TASK  t)

kills the task t

Parameters
TASKt the task to kill
Returns
0 on success, 1 otherwise
int MTSleep ( int  n)

sleeps for 10ms ie n/100s

Parameters
nthe number of periods waited
Returns
0 always
TASK MTSpawn ( void *(*)(void *)  fct,
int  id 
)

Create and initialize thread with given ID.

Parameters
fctthe function to spawn
iftd the id of the function
Returns
the task item
TIMER OSAttachTimer ( int  scale,
void(*)(void)  fct 
)

adds a function to a 1kHz/scale timer, ie. executes every 1ms*scale usage: OSAttachTimer(<scale>, &<function>);

Parameters
scalethe rate to run the function
fctthe function to run, note must return void and have no arguments
Returns
the Timer struct for the timer
int OSDetachTimer ( TIMER  t)

removes the Timer from the list

Parameters
handlethe timer to remove
Returns
0 always
char* OSExecute ( char *  command)

Executes a system command and obtains the string returned after the command.

Parameters
commandthe command to run
Returns
the string returned after execution
int OSGetCount ( void  )

gives you the count in 1/100 sec since the system start

Returns
the count
int OSGetTime ( int *  hrs,
int *  mins,
int *  secs,
int *  ticks 
)

Get system time (ticks in 1/100 sec)

Parameters
hrsthe pointer to the hours integer
minsthe pointer to the mins integer
secsthe pointer to the secs integer
ticksthe pointer to the ticks integer
Returns
0 always
int OSMachineID ( void  )

Inform the user with which ID the Eyebot is titled.

Returns
the ID of actual Eyebot
int OSMachineName ( char *  buf)

Inform the user with which name the Eyebot is titled.

Returns
the Name of actual Eyebot
int OSMachineSpeed ( void  )

Inform the user how fast the processor runs.

Returns
the actual clockrate of CPU in Hz
int OSMachineType ( void  )

Inform the user in which environment the program runs.

Returns
the Type of used hardware

Valid values are: VEHICLE, PLATFORM, WALKER

int OSSetTime ( int  hrs,
int  mins,
int  secs 
)

sets the system time

Parameters
hrsthe hours
minsthe mins
secsthe secs
Returns
0 always
int OSVersion ( char *  buf)

Returns string containing running RoBIOS version.

Returns
the RoBIOS version
int OSVersionIO ( char *  buf)

Gives the version of the IO board.

Parameters
version,thestring to store the version string
Returns
0 on success, 1 on failure
int OSWait ( int  n)

Waits for 1 ms.

Parameters
nthe number of ms to wait for
Returns
0 always
int PSDGet ( int  psd)

Delivers actual timestamp or distance measured by the selected PSD.

Parameters
psdthe number of the psd to read
Returns
the actual distance in mm (converted through internal table in hdt.txt)
int PSDGetRaw ( int  psd)

Delivers raw-data measured by the selected PSD.

Parameters
psdthe psd to read [1..6]
Returns
the raw value
int RADIOCheck ( int *  id_no)

Non-blocking check whether message is waiting.

Parameters
id_nothe id number of the eyebot to check
Returns
0 always
int RADIOGetID ( void  )

Get own radio ID.

Returns
0 always
int RADIOInit ( void  )

Starts radio communication between the Eyebots.

Returns
0 always
int RADIOReceive ( int *  id_no,
BYTE buf,
int *  size 
)

Read num. of bytes from ID source.

Parameters
id_nothe id number of the eyebot
bufthe bytes to receive
sizethe size of the buffer to receive
Returns
0 always
int RADIORelease ( void  )

Terminate radio communication.

Returns
0 always
int RADIOSend ( int  id_no,
BYTE buf,
int  size 
)

Send spec. number of bytes to ID destination.

Parameters
id_nothe id number of the eyebot
bufthe bytes to send
sizethe size of the buffer to send
Returns
0 always
int RADIOStatus ( int  IDlist[])

Returns number of robots (incl. self) and list of IDs in network.

Parameters
IDList[]the list of robots and ids
Returns
0 always
int SEMAInit ( SEMA *  sem,
int  val 
)

initialises the semaphores

Parameters
SEMAsem the semaphore
valthe value to set it at
Returns
0 on success, 1 otherwise
int SEMALock ( SEMA *  sem)

locks the given semaphoe

Parameters
SEMAsem the semaphore to lock
Returns
0 on success, 1 otherwise
int SEMAUnlock ( SEMA *  sem)

unlocks the given semaphore

Parameters
SEMAsem the semaphore to unlock
Returns
0 on success, 1 otherwise
bool SERCheck ( int  interface)

checks and flushes the port by sending enter until seeing prompt

Parameters
interfacethe inteface type
Returns
0 on success, 1 otherwise
int SERClose ( int  interface)

closes the port

Parameters
interfacethe inteface type
Returns
0 on success, 1 otherwise
int SERFlush ( int  interface)

flushes the port

Parameters
interfacethe inteface type
Returns
0 on success, 1 otherwise
int SERInit ( int  interface,
int  baud,
int  handshake 
)

Initialises the port.

Parameters
interfacethe inteface type
baudthe baud rate
handshakethe handshake type
Returns
0 on success, 1 otherwise
int SERReceive ( int  interface,
char *  buf 
)

Receives a string from port handle.

Parameters
interfacethe inteface type
bufthe string to store the received bytes
sizethe length of the string to receive
Returns
n the length of the received string
char SERReceiveChar ( int  interface)

Receives a single character from the given port handle.

Parameters
interfacethe inteface type
Returns
the character received
int SERSend ( int  interface,
char *  buf 
)

Sends a string to the given port handle.

Parameters
interfacethe inteface type
bufthe string to send
sizethe length of the string to send
Returns
0 on success, 1 otherwise
int SERSendChar ( int  interface,
char  ch 
)

Sends a single character to the given port handle.

Parameters
interfacethe inteface type
chthe character to send
Returns
0 on success, 1 otherwise
int SERVORange ( int  servo,
int  low,
int  high 
)

Sets the range for the servos.

Parameters
servothe servo to set [1..14] limits in 1/100 sec
lowthe lower limit
highthe upper limit
Returns
0 on success, 1 otherwise
int SERVOSet ( int  servo,
int  angle 
)

Set the given servos to the same given angle depending on table value.

Parameters
servothe servo number [1..14]
anglethe angle to set it to [1..255]
Returns
0 on success, 1 on failure
int SERVOSetRaw ( int  servo,
int  angle 
)

Set the given servos to the same given angle in raw mode.

Parameters
servothe servo to set [1..14]
intangle : valid values = 0-255
Returns
0 on success, 1 otherwise
int VWControl ( int  Vv,
int  Tv,
int  Vw,
int  Tw 
)

Set PI params. for v and w (typical 70 30 70 10)

Parameters
Vv
Tv
Vw
Vw
Returns
0 on success, 1 othewrise
int VWControlOff ( void  )

Stop PI control for v and w.

Returns
0 on success, 1 othewrise
int VWCurve ( int  dist,
int  angle,
int  lin_speed 
)

Turns the vehicle in a curve.

Parameters
distthe radial distance [mm]
anglethe angle to rotate in Radians * 100 (eg. 314 = half circle)
lin_speedthe speed to rotate [mm/s]
Returns
0 on success, 1 othewrise
int VWDrive ( int  dx,
int  dy,
int  lin_speed 
)

Turns the vehicle in a curve: x[mm] straight and y[mm] left, x>|y|.

Parameters
dxthe distance in front of the vehicle to drive (in mm)
dythe distance perpendicular to the direction of travel (in mm)
lin_speedthe speed to rotate
Returns
0 on success, 1 othewrise
int VWDriveDone ( void  )

Checks to see if the current drive is complete.

Returns
1 on completion, 0 for still driving, -1 on failure
int VWDriveRemain ( void  )

Checks the remaining drive time.

Returns
the remaining time
int VWDriveWait ( void  )

Blocks until the drive is complete.

Returns
0 on success, 1 othewrise
int VWGetPosition ( int *  x,
int *  y,
int *  phi 
)

Gets the position wrt original position.

Parameters
xstores the horizontal component (mm)
ystores the vertical component (mm)
phistores the turn angle (rad*100)
Returns
0 on success, 1 othewrise
int VWGetSpeed ( int *  linSspeed,
int *  angSpeed 
)

Obtains the current speeds.

Parameters
linspeedthe integer to store the linear speed (mm/s)
angSpeedthe integer to store the angular speed (100 * rad/s)
Returns
0 on success, 1 othewrise
int VWSetPosition ( int  x,
int  y,
int  phi 
)

Sets the position wrt current position.

Parameters
xthe horizontal component (mm)
ythe vertical component (mm)
phithe turn angle (rad*100)
Returns
0 on success, 1 othewrise
int VWSetSpeed ( int  linSpeed,
int  angSpeed 
)

Sets the VW speed, angle.

Parameters
linSpeedthe straightline speed (mm/s)
angSpeedthe angular turning speed (100 * rad/s)
Returns
0 on success, 1 othewrise
int VWStalled ( void  )

Checks to see if the vehicle is stalled.

Returns
0 on stalled, 1 othewrise
int VWStraight ( int  dist,
int  lin_speed 
)

Drives straight.

Parameters
distthe distance to travel [mm]
lin_speedthe speed to travel at [[mm/s]
Returns
0 on success, 1 otherwise
int VWTurn ( int  angle,
int  ang_speed 
)

Turns the vehicle on the spot.

Parameters
anglethe angle to turn to in Radians*100 (eg. 314 = Rotation Half Circle)
ang_speedthe speed to turn the angle [(rads/100)/s]
Returns
0 on success, 1 otherwise