kerl.cpp File Reference

Functions for robot control from Erlang. More...

#include "erl_driver.h"
#include <string.h>
#include <libplayerc/playerc.h>
#include "common_kerl.h"
#include "player_kerl.h"
#include "kerl.h"
#include "ei_extended.h"
#include "ei.h"

Include dependency graph for kerl.cpp:


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


Function Documentation

void 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>>}

void 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}

void 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}}

void 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}

void 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

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

void 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

void 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}

void 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