kerl.h File Reference

Functions for robot control from Erlang. More...

This graph shows which files directly or indirectly include this file:


Data Structures

struct  KerlData

Defines

#define CALL(command, length, function)   if(!strncmp(state->fn, command, length) ){ function(state); return; }

Functions

void kerlCreateRobot (KerlData *state)
void kerlDestroyRobot (KerlData *state)
void kerlMove (KerlData *state)
void kerlRotate (KerlData *state)
void kerlGetPosition (KerlData *state)
void kerlUpdate (KerlData *state)
void kerlResults (KerlData *state)
void kerlSetOption (KerlData *state)
void query (KerlData *state)

Detailed Description

Functions for robot control from Erlang.

Author:
Thomas Lorentsen, Sten Gruener
In order to control our robot from Erlang we need some functions that will interpret erlang function calls and pass them to player functions. They will then pass back to erlang a response.

These function require no return value as all data and error codes are passed onto erlang.


Define Documentation

#define CALL ( command,
length,
function   )     if(!strncmp(state->fn, command, length) ){ function(state); return; }

Defines a call from erlang atom where command is the atom value, size of atom as a string and the function to call. Then it will return out of the function it is in.


Function Documentation

kerlCreateRobot ( KerlData state  ) 

Parameters:
state ei struct Creates a Player connection Pass in a unique name to identify the robot, hostname, ip and a index number to connect to player {create, <<rid>>, <<hostname>>, ip, index}
state ei struct Creates a Player connection Pass in a unique name to identify the robot, hostname, ip and a index number to connect to player {create, <<hostname>>, ip, index, <<robotID>>}

kerlDestroyRobot ( KerlData state  ) 

Parameters:
state ei struct Destroys the robot who has the robot id name {destroy, <<rid>>}
state ei struct Destroys the robot who has the robot id name {destroy}

kerlGetPosition ( KerlData state  ) 

Parameters:
state ei struct Return the robot current position back to erlang {getpos, <<rid>>}
state ei struct Return the robot current position back to erlang {Port, tuple_float_3, {x, y, a}}

kerlMove ( KerlData state  ) 

Parameters:
state ei struct Choose to move at a speed or move a certain distance for example {move, <<rid>>, speed, 1.0}, {move, <<rid>>, distance, 15.0}
state ei struct Choose to move at a speed or move a certain distance for example {move, speed, 1.0}, {move, distance, 15.0}, {move, position, 0, 0, 3.14}, {move, full, 1, 1}

kerlResults ( KerlData state  ) 

Parameters:
state ei struct Grab results from a device, you need to select the device from the tuple you pass from erlang This will pass the a list back to erlang For example you pass {results, <<rid>>, lasers} This function should return something like {lasers, [1, 2, 3], [1, 2, 3]} where lasers is the name of the device, a list of laser results and a list of angles
state ei struct Grab results from a device, you need to select the device from the tuple you pass from erlang This will pass the a list back to erlang For example you pass {results, lasers} This function should return something like {[1, 2, 3], [1, 2, 3]} This function can also return an empty lists but this is usually rare and only happens on the first few reads. where lasers is the name of the device, a list of list of angles and a list of laser results

kerlRotate ( KerlData state  ) 

Parameters:
state ei struct Choose to rotate either by amount of degrees or set the speed for example: {rotate, <<rid>>, degrees, 180}, {rotate, <<rid>>, speed, 20} This function will need to decide which function to call in player_kerl depending on the tuple passed.
state ei struct Choose to rotate either by amount of degrees or set the speed for example: {rotate, degrees, 180}, {rotate, speed, 20} This function will need to decide which function to call in player_kerl depending on the tuple passed.

kerlSetOption ( KerlData state  ) 

Parameters:
state ei struct Allows to set driver`s options from erlang List of supported options: update_timeout (default: 0.00)
state ei struct Allows to set driver`s options from erlang

kerlUpdate ( KerlData state  ) 

Parameters:
state ei struct Force player to update its data This will allow us to grab results for devices {update, <<rid>>}
state ei struct Force player to update its data This will allow us to grab results for devices {update}

query ( KerlData state  ) 

Parameters:
state ei struct Returns a tuple containing useful information about the robot
Runs a query on a robot and returns a tuple containing useful information about it.


Generated on Thu Aug 13 23:20:22 2009 for KERL by  doxygen 1.5.8