Eyebot 7: eyebot/include/eyebot.h File Reference

Eyebot 7 7.17 A Hardware API to control various hardware

- Main Page
- Functions
- Types
- Data Structures
- Files

- File List
- Globals

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 Kernel to the image More...
void | IPSobel (BYTE *grayIn, BYTE *grayOut)
| apply Sobel Kernel 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 RGB image to HSI arrays. 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 COLOR to HSI (for one pixel) More...
BYTE | IPPRGB2Hue (BYTE r, BYTE g, BYTE b)
| Convert RGB to hue. 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 (single byte) 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. More...
int | VWDriveRemain (void)
| Checks the remaining drive distance. 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 Note the magnet is connected to pin 0
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

  the | channel 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

  sample | the raw audio file

Returns
  0 always

int AURecord | ( | BYTE * | buf,
|  | int | time,
|  | long | freq
| ) |  |

Record sound for time/100sec using sample FREQ.

Parameters

  buf | the buffer to record audio to
  time | the length of the recording
  freq | the sample freq

Returns
  0 always

int AUTone | ( | int | freq,
|  | int | time
| ) |  |

Play tone with FREQ for time/100 sec.

Parameters

  freq | the frequency of the beep
  time | the 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

  the | byte 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

  int | resolution 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

  io | the 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

  io | the 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

  io | the pin to set [1..16]
  state | the 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

  quad | the 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

  quad | the encoder to reset [1..4]

Returns
  0 on success, 1 on failure

void IPCol2Gray | ( | BYTE * | imgIn,
|  | BYTE * | grayOut
| ) |  |

Transfer color to gray image.

Parameters

  imgIn | the input image [RGB, 3 bytes per pixel]
  grayOut | the formatted output image [grayscale, 1 byte per pixel]

void IPCol2HSI | ( | BYTE * | img,
|  | BYTE * | h,
|  | BYTE * | s,
|  | BYTE * | i
| ) |  |

Transfer RGB image to HSI arrays.

Parameters

  img | the input RGB image
  h | the hue array
  s | the saturation array
  i | the intensity array

void IPGray2Col | ( | BYTE * | imgIn,
|  | BYTE * | colOut
| ) |  |

Transfer grey to color (3-byte) image.

Parameters

  imgIn | the input image [grayscale, 1 byte per pixel]
  colOut | the formatted output image [Gray image x3, 3 bytes per pixel]

void IPLaplace | ( | BYTE * | grayIn,
|  | BYTE * | grayOut
| ) |  |

apply Laplace Kernel to the image

Parameters

  grayIn | the input image in grayscale [0-255, 1 byte per pixel]
  grayOut | the formatted output image

void IPOverlay | ( | BYTE * | c1,
|  | BYTE * | c2,
|  | BYTE * | cOut
| ) |  |

Overlay c2 onto c1, all color images.

Parameters

  c2 |
  c1 |
  cOut | the output image

void IPOverlayGray | ( | BYTE * | g1,
|  | BYTE * | g2,
|  | COLOR | col,
|  | BYTE * | cOut
| ) |  |

Overlay gray image g2 onto g1, using col.

Parameters

  g1 |
  g2 |
  col |
  cOut | the output image

void IPPCol2HSI | ( | COLOR | c,
|  | BYTE * | h,
|  | BYTE * | s,
|  | BYTE * | i
| ) |  |

Transforms COLOR to HSI (for one pixel)

Parameters

  COLOR | c the color to transform
  h | the hue single byte
  s | the saturation single byte
  i | the intensity single byte

void IPPCol2RGB | ( | COLOR | col,
|  | BYTE * | r,
|  | BYTE * | g,
|  | BYTE * | b
| ) |  |

Transforms COLOR to RGB (for one Pixel)

Parameters

  r | the red
  g | the green
  b | the blue
  COLOR | the COLOR

COLOR IPPRGB2Col | ( | BYTE | r,
|  | BYTE | g,
|  | BYTE | b
| ) |  |

Transforms RGB to a COLOR (for one Pixel)

Parameters

  r | the red
  g | the green
  b | the blue

Returns
  COLOR the RGB integer representing colour

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 (single byte)

Parameters

  r | the red
  g | the green
  b | the blue
  h | the hue
  s | the saturation
  i | the intensity

BYTE IPPRGB2Hue | ( | BYTE | r,
|  | BYTE | g,
|  | BYTE | b
| ) |  |

Convert RGB to hue.

Parameters

  r | the red
  g | the green
  b | the 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

  filename | the file to open
  img | the 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

  r | the RED colour pixel array
  g | the GREEN colour pixel array
  b | the BLUE colour pixel array
  colOut | the formatted colour output image [RGB, 3 bytes per pixel]

int IPSetSize | ( | int | resolution | ) |

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

Parameters

  mode | the resolution (QQVGA, QVGA, VGA, CAM1MP, CAMHD, CAM5MP, CUSTOM) specifying the resolution of the camera

Returns
  0 if initialised correctly, otherwise 1

void IPSobel | ( | BYTE * | grayIn,
|  | BYTE * | grayOut
| ) |  |

apply Sobel Kernel to the image

Parameters

  grayIn | the input image in grayscale [0-255, 1 byte per pixel]
  grayOut | the formatted output image

int IPWriteFile | ( | char * | filename,
|  | BYTE * | img
| ) |  |

Write color PNM file.

Parameters

  filename | the file to save to
  img | the buffer to store the image

Returns
  0 always

int IPWriteFileGray | ( | char * | filename,
|  | BYTE * | gray
| ) |  |

Write greyscale PNM file.

Parameters

  filename | the file to save to
  img | the 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

  int | key : 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

  int | x1 : X-coordinate of top-left pixel
  int | y1 : Y-coordinate of top-left pixel
  int | x2 : X-coordinate of bottom-right pixel
  int | y2 : Y-coordinate of bottom-right pixel
  COLOR | col : 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

  int | x1 : X-coordinate of top-left pixel
  int | y1 : Y-coordinate of top-left pixel
  int | x2 : X-coordinate of bottom-right pixel
  int | y2 : 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

  int | x1 : X-coordinate of the centre
  int | y1 : Y-coordinate of the centre
  int | size : radius of the circle
  COLOR | col: the color of the circle
  int | fill : 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

  int | x1 : X-coordinate of the centre
  int | y1 : Y-coordinate of the centre
  int | r 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

  int | x : X-coordinate of the pixel
  int | y : 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

  int | type: 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

  int | t : the image type
  int | x : x-coordinate of top-left image position
  int | y : y-coordinate of top-left image position
  int | xs : Image width
  int | ys : 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

  int | x1 : X-coordinate of first pixel
  int | y1 : Y-coordinate of first pixel
  int | x2 : X-coordinate of second pixel
  int | y2 : Y-coordinate of second pixel
  COLOR | color : 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

  int | x1 : X-coordinate of first pixel
  int | y1 : Y-coordinate of first pixel
  int | x2 : X-coordinate of second pixel
  int | y2 : 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

  int | pos : Select menu entry in classic mode (from 1->4)
  char* | string : Menu entry for the key at specified index
  XColor | fgcol : Textcolor for the menu
  XColor | bgcol : 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

  int | x : X-coordinate of the pixel
  int | y : 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

  int | x : X-coordinate of the pixel
  int | y : 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

  const | char* 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

  int | font: The type of font (HELVETICA/TIMES/COURIER)
  int | variation: The variation (NORMAL/BOLD/ITALICS)

Returns
  0 always

int LCDSetFontSize | ( | int | fontsize | ) |

Sets the font size.

Parameters

  int | fontsize: 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

  int | mode : 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

  int | row : Text cursor row index
  int | column : Text cursor column index

Returns
  int retVal : always 0

int LCDSetPrintf | ( | int | row,
|  | int | column,
|  | const char * | format,
|  |  | ...
| ) |  |

LCDPrintf with text position specified.

Parameters

  int | row : Cursor position
  int | column : Cursor position
  const | char* 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

  motor | the 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

  motor | the 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

  motor | the motor to set [1..4]
  p | the p setting [1..255]
  i | the i setting [1..255]
  d | the d setting [1..255]

Returns
  0 on success, 1 on failure

int MOTORPIDOff | ( | int | motor | ) |

Shuts off PID control.

Parameters

  motor | the 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

  motor | the motor to set [1..4]
  ticks | the 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

  TASK | t 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

  TASK | t the task to kill

Returns
  0 on success, 1 otherwise

int MTSleep | ( | int | n | ) |

sleeps for 10ms ie n/100s

Parameters

  n | the number of periods waited

Returns
  0 always

TASK MTSpawn | ( | void *(*)(void *) | fct,
|  | int | id
| ) |  |

Create and initialize thread with given ID.

Parameters

  fct | the function to spawn
  if | td 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

  scale | the rate to run the function
  fct | the 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

  handle | the timer to remove

Returns
  0 always

char* OSExecute | ( | char * | command | ) |

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

Parameters

  command | the 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

  hrs | the pointer to the hours integer
  mins | the pointer to the mins integer
  secs | the pointer to the secs integer
  ticks | the 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

  hrs | the hours
  mins | the mins
  secs | the 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,the | string to store the version string

Returns
  0 on success, 1 on failure

int OSWait | ( | int | n | ) |

Waits for 1 ms.

Parameters

  n | the number of ms to wait for

Returns
  0 always

int PSDGet | ( | int | psd | ) |

Delivers actual timestamp or distance measured by the selected PSD.

Parameters

  psd | the 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

  psd | the psd to read [1..6]

Returns
  the raw value

int RADIOCheck | ( | int * | id_no | ) |

Non-blocking check whether message is waiting.

Parameters

  id_no | the 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_no | the id number of the eyebot
  buf | the bytes to receive
  size | the 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_no | the id number of the eyebot
  buf | the bytes to send
  size | the 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

  SEMA | sem the semaphore
  val | the value to set it at

Returns
  0 on success, 1 otherwise

int SEMALock | ( | SEMA * | sem | ) |

locks the given semaphoe

Parameters

  SEMA | sem the semaphore to lock

Returns
  0 on success, 1 otherwise

int SEMAUnlock | ( | SEMA * | sem | ) |

unlocks the given semaphore

Parameters

  SEMA | sem 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

  interface | the inteface type

Returns
  0 on success, 1 otherwise

int SERClose | ( | int | interface | ) |

closes the port

Parameters

  interface | the inteface type

Returns
  0 on success, 1 otherwise

int SERFlush | ( | int | interface | ) |

flushes the port

Parameters

  interface | the inteface type

Returns
  0 on success, 1 otherwise

int SERInit | ( | int | interface,
|  | int | baud,
|  | int | handshake
| ) |  |

Initialises the port.

Parameters

  interface | the inteface type
  baud | the baud rate
  handshake | the handshake type

Returns
  0 on success, 1 otherwise

int SERReceive | ( | int | interface,
|  | char * | buf
| ) |  |

Receives a string from port handle.

Parameters

  interface | the inteface type
  buf | the string to store the received bytes
  size | the 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

  interface | the inteface type

Returns
  the character received

int SERSend | ( | int | interface,
|  | char * | buf
| ) |  |

Sends a string to the given port handle.

Parameters

  interface | the inteface type
  buf | the string to send
  size | the 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

  interface | the inteface type
  ch | the character to send

Returns
  0 on success, 1 otherwise

int SERVORange | ( | int | servo,
|  | int | low,
|  | int | high
| ) |  |

Sets the range for the servos.

Parameters

  servo | the servo to set [1..14] limits in 1/100 sec
  low | the lower limit
  high | the 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

  servo | the servo number [1..14]
  angle | the 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

  servo | the servo to set [1..14]
  int | angle : 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

  dist | the arc distance [mm]
  angle | the rotated orientation of the car [degrees]
  lin_speed | the speed to drive the arc [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.

Parameters

  dx | the distance in front of the vehicle to drive [mm]
  dy | the distance perpendicular to the direction of travel [mm]
  lin_speed | the speed to rotate [mm/s]

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 distance.

Returns
  the remaining time [mm]

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

  x | stores the horizontal component (mm)
  y | stores the vertical component (mm)
  phi | stores the turn angle (degrees)

Returns
  0 on success, 1 othewrise

int VWGetSpeed | ( | int * | linSspeed,
|  | int * | angSpeed
| ) |  |

Obtains the current speeds.

Parameters

  linspeed | the integer to store the linear speed (mm/s)
  angSpeed | the integer to store the angular speed (degrees/s)

Returns
  0 on success, 1 othewrise

int VWSetPosition | ( | int | x,
|  | int | y,
|  | int | phi
| ) |  |

Sets the position wrt current position.

Parameters

  x | the horizontal component (mm)
  y | the vertical component (mm)
  phi | the turn angle (rad*100)

Returns
  0 on success, 1 othewrise

int VWSetSpeed | ( | int | linSpeed,
|  | int | angSpeed
| ) |  |

Sets the VW speed, angle.

Parameters

  linSpeed | the straightline speed (mm/s)
  angSpeed | the angular turning speed (degrees/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

  dist | the distance to travel [mm]
  lin_speed | the 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

  angle | the angle to turn [degrees]
  ang_speed | the speed to turn [degrees/s]

Returns
  0 on success, 1 otherwise