Elib 0.7
C# library for e-Puck robot

Elib.Epuck Class Reference

A virtual representation of e-Puck, which allows control the robot with its methods. More...

List of all members.

Public Member Functions

delegate void OkfActuators (object data)
 A format of functions, which are called if the command for an actuator is successfully confirmed in timeout.
void SetEncoders (int leftMotor, int rightMotor, OkfActuators okf, KofCallback kof, object state, double timeout)
 Sets encoders values. One revolution corresponds to 1000 steps.
void CalibrateIRSensors (OkfActuators okf, KofCallback kof, object state, double timeout)
 Calibrates proximity IR sensors, which makes IR sensors more accurate for measuring proximity. Calibration adapts sensor for different reflection of IR light in the current environment.
void Stop (OkfActuators okf, KofCallback kof, object state, double timeout)
 It stops e-Puck and turn off leds.
void Reset (OkfActuators okf, KofCallback kof, object state, double timeout)
 It restars e-Puck.
void Motors (double leftMotor, double rightMotor, OkfActuators okf, KofCallback kof, object state, double timeout)
 Sets Left and Right Motor speed. Acceptable values are from -1 to 1. Value 1 corresponds to 1 revolution per second. Wheels have perimeter of 12,88 mm.
void LightX (int num, Turn how, OkfActuators okf, KofCallback kof, object state, double timeout)
 Sets a LED with number n on,off or into inverse state. Acceptable values are 0..7(resp. 8). Value 8 represents all diodes at once.
void BodyLight (Turn how, OkfActuators okf, KofCallback kof, object state, double timeout)
 Sets Body led on, off or into an inverse state.
void FrontLight (Turn how, OkfActuators okf, KofCallback kof, object state, double timeout)
 Sets Front led on, off or into an inverse state. It can produce enough light for capturing close obstacles with e-Puck's camera.
void SetCam (int width, int height, Zoom zoom, CamMode mode, OkfActuators okf, KofCallback kof, object state, double timeout)
 It sets the parameters of a camera. Maximum size of a picture can be 3200 bytes. The picture size S = width*height bytes; for black and white mode S = width*height*2 bytes; for colourful mode.
void PlaySound (int SoundNum, OkfActuators okf, KofCallback kof, object state, double timeout)
 It begins to play sound. Values 0-5 are for different sounds. 6 turns speaker off.
void EndFtion (IAsyncResult ar)
 It waits synchronously until the function, which created the instance ofAsyncNoResult ar finished.
int[] EndGetFtion (IAsyncResult ar)
 It waits synchronously until a function, which asked for sensors with values, gets the desired answer or timeout elapses. It uses ar in order to get the values.
string EndInfoFtion (IAsyncResult ar)
 It waits synchronously until a function, which asked for sensors with values, gets the desired answer or timeout elapses. It uses ar in order to get the values.
Bitmap EndGetImage (IAsyncResult ar)
 It waits synchronously until a function, which asked for an image, gets the System.Drawing.Bitmap or timeout elapses. It uses ar in order to get the System.Drawing.Bitmap.
IAsyncResult BeginSetEncoders (int leftTicks, int rightTicks, double timeout, AsyncCallback callback, Object state)
 Sets Left and Right Motor Encoder value.
IAsyncResult BeginCalibrateIRSensors (double timeout, AsyncCallback callback, Object state)
 Calibrates proximity IR sensors, which makes IR sensors more accurate for measuring proximity. Calibration adapts sensor for different reflection of IR light in the current environment.
IAsyncResult BeginMotors (double leftMotor, double rightMotor, double timeout, AsyncCallback callback, Object state)
 Sets Left and Right Motor speed. Acceptable values are from -1 to 1. Value 1 corresponds to 1 revolution per second. Wheels have perimeter of 12,88 mm.
IAsyncResult BeginGetMikes (double timeout, AsyncCallback callback, object state)
 It gets the current amplitude of sound from e-Puck's 3 speakers.
IAsyncResult BeginGetLight (double timeout, AsyncCallback callback, object state)
 Returns a command to get the array of integers from IR sensors. The more ambient light, the lower the values. Usual values are above 3000. Maximal value is 5000.
IAsyncResult BeginStop (double timeout, AsyncCallback callback, Object state)
 It stops e-Puck and turn off leds.
IAsyncResult BeginReset (double timeout, AsyncCallback callback, Object state)
 It restarts e-Puck.
IAsyncResult BeginFrontLight (Turn how, double timeout, AsyncCallback callback, Object state)
 Sets Front led on, off or into an inverse state. It can produce enough light for capturing close obstacles with e-Puck's camera.
IAsyncResult BeginLightX (int num, Turn how, double timeout, AsyncCallback callback, Object state)
 Sets a LED with number n on,off or into inverse state. Acceptable values are 0..7(resp. 8). Value 8 represents all diodes at once.
IAsyncResult BeginBodyLight (Turn how, double timeout, AsyncCallback callback, Object state)
 Sets Body led on, off or into an inverse state.
IAsyncResult BeginGetIRData (double timeout, AsyncCallback callback, Object state)
 It gets the IR data in in array of 6 integers with following meaning IR check : 0xx, address : 0xx, data : 0xx.
IAsyncResult BeginGetInfoHelp (double timeout, AsyncCallback callback, Object state)
 It shows Epuck's help sent from e-Puck.
IAsyncResult BeginSetCam (int width, int height, Zoom zoom, CamMode mode, double timeout, AsyncCallback callback, Object state)
 It sets the parameters of a camera. Maximum size of a picture can be 3200 bytes. The picture size S = width*height bytes; for black and white mode S = width*height*2 bytes; for colourful mode.
IAsyncResult BeginPlaySound (int SoundNum, double timeout, AsyncCallback callback, Object state)
 It begins to play sound. Values 0-5 are for different sounds. 6 turns speaker off.
IAsyncResult BeginGetInfoVersion (double timeout, AsyncCallback callback, Object state)
 It gets the BTCom version from e-Puck.
IAsyncResult BeginGetIR (double timeout, AsyncCallback callback, object state)
 It gets the proximity from IR sensors. Obstacle can be recognized up to 4 cm.
IAsyncResult BeginGetAccelerometer (double timeout, AsyncCallback callback, object state)
 It returns vector of values, which indicates the slant of e-Puck.
IAsyncResult BeginGetSelector (double timeout, AsyncCallback callback, object state)
 It returns a selector position.
IAsyncResult BeginGetSpeed (double timeout, AsyncCallback callback, object state)
 It gets the current speed of both wheels. Speed on a wheel is from -1 to 1. Value 1 corresponds to 1 revolution per second. Wheels have perimeter of 12,88 mm.
IAsyncResult BeginGetCamParams (double timeout, AsyncCallback callback, object state)
 It gets current camera settings. The picture size S = width*height, black or white mode and zoom.
IAsyncResult BeginGetEncoders (double timeout, AsyncCallback callback, object state)
 It gets a current state of encoders. It is measured in steps. One forward revolution corresponds to +1000 steps.It is nulled if the e-Puck resets.
IAsyncResult BeginGetImage (double timeout, AsyncCallback callback, object state)
 It gets a picture. It can take a long time. E.g. picture 40*40 in colour takes more than 0.4 sec under good light conditions and with battery fully charged.
 Epuck (string Port, string Name)
 Initializes a new instance of the Epuck class.
void WriteToLogStream (string comment)
 WriteToLogStream adds to LogStream a comment. (Before passed strings puts '#'.)
void Dispose ()
 Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. It takes under 0.5 s.
override string ToString ()
 Returns a System.String that represents this instance. A user defined robot name and Sercom parameters are returned.
void StartLogging ()
 
Exceptions:
T:ElibExceptionis thrown when LogStream is null.

void StopLogging ()
 Disables logging.
delegate void OkfIntsSensors (int[] ans, object data)
 A format of functions, which are called when a command requiring an array of int is confirmed in timeout.
delegate void OkfStringSensors (string ans, object data)
 A format of functions, which are called when a command requiring a string is confirmed in timeout.
delegate void OkfKofCamSensor (Bitmap ans, object data)
 A format of functions, which are called when a command requiring a Bitmap is confirmed in timeout.
void GetImage (OkfKofCamSensor okf, OkfKofCamSensor kof, object state, double timeout)
 It gets a picture. It can take a long time. E.g. picture 40*40 in colour takes more than 0.4 sec under good light conditions and with battery fully charged.
void GetIR (OkfIntsSensors okf, KofCallback kof, object state, double timeout)
 It gets the proximity from IR sensors. Obstacle can be recognized up to 4 cm.
void GetAccelerometer (OkfIntsSensors okf, KofCallback kof, object state, double timeout)
 It returns vector of values, which indicates the slant of e-Puck.
void GetSelector (OkfIntsSensors okf, KofCallback kof, object state, double timeout)
 It returns a selector position.
void GetSpeed (OkfIntsSensors okf, KofCallback kof, object state, double timeout)
 It gets the current speed of both wheels. Speed on a wheel is from -1 to 1. Value 1 corresponds to 1 revolution per second. Wheels have perimeter of 12,88 mm.
void GetCamParams (OkfIntsSensors okf, KofCallback kof, object state, double timeout)
 It gets current camera settings. The picture size S = width*height, black or white mode and zoom.
void GetLight (OkfIntsSensors okf, KofCallback kof, object state, double timeout)
 Returns a command to get the array of integers from IR sensors. The more ambient light, the lower the values. Usual values are above 3000. Maximal value is 5000.
void GetEncoders (OkfIntsSensors okf, KofCallback kof, object state, double timeout)
 It gets a current state of encoders. It is measured in steps. One forward revolution corresponds to +1000 steps.It is nulled if the e-Puck resets.
void GetMikes (OkfIntsSensors okf, KofCallback kof, object state, double timeout)
 It gets the current amplitude of sound from e-Puck's 3 speakers.
void GetIRData (OkfIntsSensors okf, KofCallback kof, object state, double timeout)
 It gets the IR data in in array of 3 integers converted from hex number with following meaning. IR check : 0xx, address : 0xx, data : 0xx.
void GetHelpInfo (OkfStringSensors okf, KofCallback kof, object state, double timeout)
 It shows Epuck's help sent from e-Puck.
void GetVersionInfo (OkfStringSensors okf, KofCallback kof, object state, double timeout)
 It gets the BTCom version.

Public Attributes

const double WheelDiameter = 4.1
 units: [cm]
const double Perch = 5.3
 Distance between wheels of an e-Puck in cm.
const double MaxSpeed = 12.88
 12.88 cm/s is a maximum speed of e-Puck. In Elib 13cm/sec corresponds to 1.00. From -1.00 to 1.00 is the speed linearly growing.

Static Public Attributes

static readonly int[] IRSensorsDegrees = new int[8] { 10, 30, 90, 170, 190, 270, 330, 350 }
 Eight Infra Red sensors are placed on the perimeter of e-Puck, which can be obtained on the instance e of e-Puck by e.BeginGetIRSensors(..) method or by e.GetIRSensors(..) method. IrSensorsDegrees describes the degrees measured from front(There is a cam.) As you can see most of the sensors are on the front side of e-Puck.

Protected Member Functions

virtual void Dispose (bool disposing)
 It releases unmanaged(Serial Port in Sercom and access to log file) and - optionally - managed resources.

Properties

static string BTComHelp [get]
 It gets the BTCom help.
int Working [get]
 Gets the number of unconfirmed commands in the Epuck instance.
int NotSent [get]
 Gets the number of waiting commands in the notSent queue = commands waiting to be sent via Serial Port(Bluetooth).
string Name [get]
 Gets the name specified in a constructor.
string Port [get]
 Gets the port specified in the constructor.
bool Log [get]
 Return a bool flag, which indicates whether logging is on.
TextWriter LogStream [get, set]
 Enables sets or get TextWriter of e-Puck, where all actions of e-Puck are logged if logging is turned on.

Detailed Description

A virtual representation of e-Puck, which allows control the robot with its methods.

It uses Sercom internally. Epuck class can log its commands. It has two interfaces (basic interface based on Sercom and IAsyncResult interface


Constructor & Destructor Documentation

Elib.Epuck.Epuck ( string  Port,
string  Name 
)

Initializes a new instance of the Epuck class.

Parameters:
PortThe port.
NameChoose a name for your robot! It is useful for logging.

Member Function Documentation

IAsyncResult Elib.Epuck.BeginBodyLight ( Turn  how,
double  timeout,
AsyncCallback  callback,
Object  state 
)

Sets Body led on, off or into an inverse state.

Parameters:
howTurn change state of the LED?
timeoutTimeout[sec] set how long are you willing to wait for the command confirmation answer. If the confirmation does not arrived until timeout exception is raised
callbackA function which is called, after the confirmation answer is received.
stateAn instance of any class, which is passed to the callback function as an argument.
Returns:
Returns an instance of AsyncNoResult.
IAsyncResult Elib.Epuck.BeginCalibrateIRSensors ( double  timeout,
AsyncCallback  callback,
Object  state 
)

Calibrates proximity IR sensors, which makes IR sensors more accurate for measuring proximity. Calibration adapts sensor for different reflection of IR light in the current environment.

Parameters:
timeoutTimeout[sec] set how long are you willing to wait for the command confirmation answer. If the confirmation does not arrived until timeout exception is raised
callbackA function which is called, after the confirmation answer is received.
stateAn instance of any class, which is passed to the callback function as an argument.
Returns:
IAsyncResult Elib.Epuck.BeginFrontLight ( Turn  how,
double  timeout,
AsyncCallback  callback,
Object  state 
)

Sets Front led on, off or into an inverse state. It can produce enough light for capturing close obstacles with e-Puck's camera.

Parameters:
howTurn change state of the LED?
timeoutTimeout[sec] set how long are you willing to wait for the command confirmation answer. If the confirmation does not arrived until timeout exception is raised
callbackA function which is called, after the confirmation answer is received.
stateAn instance of any class, which is passed to the callback function as an argument.
Returns:
Returns an instance of AsyncNoResult.
IAsyncResult Elib.Epuck.BeginGetAccelerometer ( double  timeout,
AsyncCallback  callback,
object  state 
)

It returns vector of values, which indicates the slant of e-Puck.

Parameters:
timeoutTimeout[sec] set how long are you willing to wait for the command confirmation answer. If the confirmation does not arrived until timeout exception is raised
callbackA function which is called, after the confirmation answer is received.
stateAn instance of any class, which is passed to the callback function as an argument.
Returns:
IAsyncResult Elib.Epuck.BeginGetCamParams ( double  timeout,
AsyncCallback  callback,
object  state 
)

It gets current camera settings. The picture size S = width*height, black or white mode and zoom.

Parameters:
timeoutTimeout[sec] set how long are you willing to wait for the command confirmation answer. If the confirmation does not arrived until timeout exception is raised
callbackA function which is called, after the confirmation answer is received.
stateAn instance of any class, which is passed to the callback function as an argument.
Returns:
IAsyncResult Elib.Epuck.BeginGetEncoders ( double  timeout,
AsyncCallback  callback,
object  state 
)

It gets a current state of encoders. It is measured in steps. One forward revolution corresponds to +1000 steps.It is nulled if the e-Puck resets.

Parameters:
timeoutTimeout[sec] set how long are you willing to wait for the command confirmation answer. If the confirmation does not arrived until timeout exception is raised
callbackA function which is called, after the confirmation answer is received.
stateAn instance of any class, which is passed to the callback function as an argument.
Returns:
IAsyncResult Elib.Epuck.BeginGetImage ( double  timeout,
AsyncCallback  callback,
object  state 
)

It gets a picture. It can take a long time. E.g. picture 40*40 in colour takes more than 0.4 sec under good light conditions and with battery fully charged.

Parameters:
timeoutTimeout[sec] set how long are you willing to wait for the command confirmation answer. If the confirmation does not arrived until timeout exception is raised
callbackA function which is called, after the confirmation answer is received.
stateAn instance of any class, which is passed to the callback function as an argument.
Returns:
IAsyncResult Elib.Epuck.BeginGetInfoHelp ( double  timeout,
AsyncCallback  callback,
Object  state 
)

It shows Epuck's help sent from e-Puck.

Parameters:
timeoutTimeout[sec] set how long are you willing to wait for the command confirmation answer. If the confirmation does not arrived until timeout exception is raised
callbackA function which is called, after the confirmation answer is received.
stateAn instance of any class, which is passed to the callback function as an argument.
Returns:
IAsyncResult Elib.Epuck.BeginGetInfoVersion ( double  timeout,
AsyncCallback  callback,
Object  state 
)

It gets the BTCom version from e-Puck.

Parameters:
timeoutTimeout[sec] set how long are you willing to wait for the command confirmation answer. If the confirmation does not arrived until timeout exception is raised
callbackA function called after the confirmation answer is received.
stateAn instance of any class, which is passed to the callback function as an argument.
Returns:
IAsyncResult Elib.Epuck.BeginGetIR ( double  timeout,
AsyncCallback  callback,
object  state 
)

It gets the proximity from IR sensors. Obstacle can be recognized up to 4 cm.

Parameters:
timeoutTimeout[sec] set how long are you willing to wait for the command confirmation answer. If the confirmation does not arrived until timeout exception is raised
callbackA function which is called, after the confirmation answer is received.
stateAn instance of any class, which is passed to the callback function as an argument.
Returns:
IAsyncResult Elib.Epuck.BeginGetIRData ( double  timeout,
AsyncCallback  callback,
Object  state 
)

It gets the IR data in in array of 6 integers with following meaning IR check : 0xx, address : 0xx, data : 0xx.

Parameters:
timeoutTimeout[sec] set how long are you willing to wait for the command confirmation answer. If the confirmation does not arrived until timeout exception is raised
callbackA function which is called, after the confirmation answer is received.
stateAn instance of any class, which is passed to the callback function as an argument.
Returns:
IAsyncResult Elib.Epuck.BeginGetLight ( double  timeout,
AsyncCallback  callback,
object  state 
)

Returns a command to get the array of integers from IR sensors. The more ambient light, the lower the values. Usual values are above 3000. Maximal value is 5000.

Parameters:
timeoutTimeout[sec] set how long are you willing to wait for the command confirmation answer. If the confirmation does not arrived until timeout exception is raised
callbackA function which is called, after the confirmation answer is received.
stateAn instance of any class, which is passed to the callback function as an argument.
Returns:
IAsyncResult Elib.Epuck.BeginGetMikes ( double  timeout,
AsyncCallback  callback,
object  state 
)

It gets the current amplitude of sound from e-Puck's 3 speakers.

Parameters:
timeoutTimeout[sec] set how long are you willing to wait for the command confirmation answer. If the confirmation does not arrived until timeout exception is raised
callbackA function which is called, after the confirmation answer is received.
stateAn instance of any class, which is passed to the callback function as an argument.
Returns:
IAsyncResult Elib.Epuck.BeginGetSelector ( double  timeout,
AsyncCallback  callback,
object  state 
)

It returns a selector position.

Parameters:
timeoutTimeout[sec] set how long are you willing to wait for the command confirmation answer. If the confirmation does not arrived until timeout exception is raised
callbackA function which is called, after the confirmation answer is received.
stateAn instance of any class, which is passed to the callback function as an argument.
Returns:
IAsyncResult Elib.Epuck.BeginGetSpeed ( double  timeout,
AsyncCallback  callback,
object  state 
)

It gets the current speed of both wheels. Speed on a wheel is from -1 to 1. Value 1 corresponds to 1 revolution per second. Wheels have perimeter of 12,88 mm.

Parameters:
timeoutTimeout[sec] set how long are you willing to wait for the command confirmation answer. If the confirmation does not arrived until timeout exception is raised
callbackA function which is called, after the confirmation answer is received.
stateAn instance of any class, which is passed to the callback function as an argument.
Returns:
IAsyncResult Elib.Epuck.BeginLightX ( int  num,
Turn  how,
double  timeout,
AsyncCallback  callback,
Object  state 
)

Sets a LED with number n on,off or into inverse state. Acceptable values are 0..7(resp. 8). Value 8 represents all diodes at once.

Parameters:
numNumber of the LED which is changed.
howTurn change state of the LED?
timeoutTimeout[sec] set how long are you willing to wait for the command confirmation answer. If the confirmation does not arrived until timeout exception is raised
callbackA function which is called, after the confirmation answer is received.
stateAn instance of any class, which is passed to the callback function as an argument.
Returns:
Returns an instance of AsyncNoResult.
IAsyncResult Elib.Epuck.BeginMotors ( double  leftMotor,
double  rightMotor,
double  timeout,
AsyncCallback  callback,
Object  state 
)

Sets Left and Right Motor speed. Acceptable values are from -1 to 1. Value 1 corresponds to 1 revolution per second. Wheels have perimeter of 12,88 mm.

Parameters:
leftMotorSets the left motor speed.
rightMotorSets the right motor speed.
timeoutTimeout[sec] set how long are you willing to wait for the command confirmation answer. If the confirmation does not arrived until timeout exception is raised
callbackA function which is called, after the confirmation answer is received.
stateAn instance of any class, which is passed to the callback function as an argument.
Returns:
IAsyncResult Elib.Epuck.BeginPlaySound ( int  SoundNum,
double  timeout,
AsyncCallback  callback,
Object  state 
)

It begins to play sound. Values 0-5 are for different sounds. 6 turns speaker off.

Parameters:
SoundNumThe SoundNum can be between 0 and 6. 6 turns speakers off other numbers plays a sound.
timeoutTimeout[sec] set how long are you willing to wait for the command confirmation answer. If the confirmation does not arrived until timeout exception is raised
callbackA function called after the confirmation answer is received.
stateAn instance of any class, which is passed to the callback function as an argument.
Returns:
IAsyncResult Elib.Epuck.BeginReset ( double  timeout,
AsyncCallback  callback,
Object  state 
)

It restarts e-Puck.

Parameters:
timeoutTimeout[sec] set how long are you willing to wait for the command confirmation answer. If the confirmation does not arrived until timeout exception is raised
callbackA function which is called, after the confirmation answer is received.
stateAn instance of any class, which is passed to the callback function as an argument.
Returns:
IAsyncResult Elib.Epuck.BeginSetCam ( int  width,
int  height,
Zoom  zoom,
CamMode  mode,
double  timeout,
AsyncCallback  callback,
Object  state 
)

It sets the parameters of a camera. Maximum size of a picture can be 3200 bytes. The picture size S = width*height bytes; for black and white mode S = width*height*2 bytes; for colourful mode.

Parameters:
widthThe width of the picture in pixels.
heightThe height of the picture in pixels
zoomThe zoom of a cam. The lowest is the most useful.
modeThe mode. Can be black and white or colourful.
timeoutTimeout[sec] set how long are you willing to wait for the command confirmation answer. If the confirmation does not arrived until timeout exception is raised
callbackA function which is called, after the confirmation answer is received.
stateAn instance of any class, which is passed to the callback function as an argument.
Returns:
IAsyncResult Elib.Epuck.BeginSetEncoders ( int  leftTicks,
int  rightTicks,
double  timeout,
AsyncCallback  callback,
Object  state 
)

Sets Left and Right Motor Encoder value.

Parameters:
leftMotorSets the left motor value.
rightMotorSets the right motor value.
timeoutTimeout[sec] set how long are you willing to wait for the command confirmation answer. If the confirmation does not arrived until timeout exception is raised
callbackA function which is called, after the confirmation answer is received.
stateAn instance of any class, which is passed to the callback function as an argument.
Returns:
IAsyncResult Elib.Epuck.BeginStop ( double  timeout,
AsyncCallback  callback,
Object  state 
)

It stops e-Puck and turn off leds.

Parameters:
timeoutTimeout[sec] set how long are you willing to wait for the command confirmation answer. If the confirmation does not arrived until timeout exception is raised
callbackA function which is called, after the confirmation answer is received.
stateAn instance of any class, which is passed to the callback function as an argument.
Returns:
void Elib.Epuck.BodyLight ( Turn  how,
OkfActuators  okf,
KofCallback  kof,
object  state,
double  timeout 
)

Sets Body led on, off or into an inverse state.

Parameters:
howOff/On/InverseState.
okfA function called after the confirmation answer is received.
kofA function called after the timeout is elapsed if the confirmation answer has not been received.
stateAn instance of any class, which is passed to the callback function as an argument.
timeoutTimeout[seconds] set how long are you willing to wait for the command confirmation answer.
void Elib.Epuck.CalibrateIRSensors ( OkfActuators  okf,
KofCallback  kof,
object  state,
double  timeout 
)

Calibrates proximity IR sensors, which makes IR sensors more accurate for measuring proximity. Calibration adapts sensor for different reflection of IR light in the current environment.

Parameters:
okfA function called after the confirmation answer is received.
kofA function called after the timeout is elapsed if the confirmation answer has not been received.
stateAn instance of any class, which is passed to the callback function as an argument.
timeoutTimeout[seconds] set how long are you willing to wait for the command confirmation answer.

remarks>E-Puck needs around 1s to calibrate its IR sensors.

virtual void Elib.Epuck.Dispose ( bool  disposing) [protected, virtual]

It releases unmanaged(Serial Port in Sercom and access to log file) and - optionally - managed resources.

Parameters:
disposingtrue to release both managed and unmanaged resources; false to release only unmanaged resources.
void Elib.Epuck.Dispose ( )

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. It takes under 0.5 s.

void Elib.Epuck.EndFtion ( IAsyncResult  ar)

It waits synchronously until the function, which created the instance ofAsyncNoResult ar finished.

Parameters:
arThe ar.
int [] Elib.Epuck.EndGetFtion ( IAsyncResult  ar)

It waits synchronously until a function, which asked for sensors with values, gets the desired answer or timeout elapses. It uses ar in order to get the values.

Parameters:
arInstance of AsyncResult serves to connect the BeginGet... function with EndGetFtion(IAsyncResult) method
Returns:
Returns an array of int.
Bitmap Elib.Epuck.EndGetImage ( IAsyncResult  ar)

It waits synchronously until a function, which asked for an image, gets the System.Drawing.Bitmap or timeout elapses. It uses ar in order to get the System.Drawing.Bitmap.

Parameters:
arInstance of AsyncResult serves to connect the BeginGet. function with EndGetFtion(IAsyncResult) method
Returns:
Returns array of int.
string Elib.Epuck.EndInfoFtion ( IAsyncResult  ar)

It waits synchronously until a function, which asked for sensors with values, gets the desired answer or timeout elapses. It uses ar in order to get the values.

Parameters:
arInstance of AsyncResult serves to connect the BeginGetInfo... function with EndGetFtion(IAsyncResult) method
Returns:
Returns a string.
void Elib.Epuck.FrontLight ( Turn  how,
OkfActuators  okf,
KofCallback  kof,
object  state,
double  timeout 
)

Sets Front led on, off or into an inverse state. It can produce enough light for capturing close obstacles with e-Puck's camera.

Parameters:
howOff/On/InverseState.
okfA function called after the confirmation answer is received.
kofA function called after the timeout is elapsed if the confirmation answer has not been received.
stateAn instance of any class, which is passed to the callback function as an argument.
timeoutTimeout[seconds] set how long are you willing to wait for the command confirmation answer.
void Elib.Epuck.GetAccelerometer ( OkfIntsSensors  okf,
KofCallback  kof,
object  state,
double  timeout 
)

It returns vector of values, which indicates the slant of e-Puck.

Parameters:
okfA function called after the confirmation answer is received.
kofA function called after the timeout is elapsed if the confirmation of command has not been received.
stateAn instance of any class, which is passed to the callback function as an argument.
timeoutTimeout[sec] set how long are you willing to wait for the command confirmation answer.
void Elib.Epuck.GetCamParams ( OkfIntsSensors  okf,
KofCallback  kof,
object  state,
double  timeout 
)

It gets current camera settings. The picture size S = width*height, black or white mode and zoom.

Parameters:
okfA function called after the confirmation answer is received.
kofA function called after the timeout is elapsed if the confirmation of command has not been received.
stateAn instance of any class, which is passed to the callback function as an argument.
timeoutTimeout[sec] set how long are you willing to wait for the command confirmation answer.
void Elib.Epuck.GetEncoders ( OkfIntsSensors  okf,
KofCallback  kof,
object  state,
double  timeout 
)

It gets a current state of encoders. It is measured in steps. One forward revolution corresponds to +1000 steps.It is nulled if the e-Puck resets.

Parameters:
okfA function called after the confirmation answer is received.
kofA function called after the timeout is elapsed if the confirmation of command has not been received.
stateAn instance of any class, which is passed to the callback function as an argument.
timeoutTimeout[sec] set how long are you willing to wait for the command confirmation answer.
void Elib.Epuck.GetHelpInfo ( OkfStringSensors  okf,
KofCallback  kof,
object  state,
double  timeout 
)

It shows Epuck's help sent from e-Puck.

Parameters:
okfThe okf.
kofThe kof.
stateThe state.
timeoutThe timeout.
void Elib.Epuck.GetImage ( OkfKofCamSensor  okf,
OkfKofCamSensor  kof,
object  state,
double  timeout 
)

It gets a picture. It can take a long time. E.g. picture 40*40 in colour takes more than 0.4 sec under good light conditions and with battery fully charged.

single functions //////////////////////////

Parameters:
okfA function called after the confirmation answer is received.
kofA function called after the timeout is elapsed if the confirmation of command has not been received.
stateAn instance of any class, which is passed to the callback function as an argument.
timeoutTimeout[sec] set how long are you willing to wait for the command confirmation answer.

remarks>In contrary to other methods the kof callback can be called later than timeout elapses. paramref name="kof"/> is delayed when data are still sending and the timeout has already elapsed.

void Elib.Epuck.GetIR ( OkfIntsSensors  okf,
KofCallback  kof,
object  state,
double  timeout 
)

It gets the proximity from IR sensors. Obstacle can be recognized up to 4 cm.

Parameters:
okfA function called after the confirmation answer is received.
kofA function called after the timeout is elapsed if the confirmation of command has not been received.
stateAn instance of any class, which is passed to the callback function as an argument.
timeoutTimeout[sec] set how long are you willing to wait for the command confirmation answer.
void Elib.Epuck.GetIRData ( OkfIntsSensors  okf,
KofCallback  kof,
object  state,
double  timeout 
)

It gets the IR data in in array of 3 integers converted from hex number with following meaning. IR check : 0xx, address : 0xx, data : 0xx.

Parameters:
okfA function called after the confirmation answer is received.
kofA function called after the timeout is elapsed if the confirmation of command has not been received.
stateAn instance of any class, which is passed to the callback function as an argument.
timeoutTimeout[sec] set how long are you willing to wait for the command confirmation answer.
void Elib.Epuck.GetLight ( OkfIntsSensors  okf,
KofCallback  kof,
object  state,
double  timeout 
)

Returns a command to get the array of integers from IR sensors. The more ambient light, the lower the values. Usual values are above 3000. Maximal value is 5000.

Parameters:
okfA function called after the confirmation answer is received.
kofA function called after the timeout is elapsed if the confirmation of command has not been received.
stateAn instance of any class, which is passed to the callback function as an argument.
timeoutTimeout[sec] set how long are you willing to wait for the command confirmation answer.
void Elib.Epuck.GetMikes ( OkfIntsSensors  okf,
KofCallback  kof,
object  state,
double  timeout 
)

It gets the current amplitude of sound from e-Puck's 3 speakers.

Parameters:
okfA function called after the confirmation answer is received.
kofA function called after the timeout is elapsed if the confirmation of command has not been received.
stateAn instance of any class, which is passed to the callback function as an argument.
timeoutTimeout[sec] set how long are you willing to wait for the command confirmation answer.
void Elib.Epuck.GetSelector ( OkfIntsSensors  okf,
KofCallback  kof,
object  state,
double  timeout 
)

It returns a selector position.

Parameters:
okfA function called after the confirmation answer is received.
kofA function called after the timeout is elapsed if the confirmation of command has not been received.
stateAn instance of any class, which is passed to the callback function as an argument.
timeoutTimeout[sec] set how long are you willing to wait for the command confirmation answer.
void Elib.Epuck.GetSpeed ( OkfIntsSensors  okf,
KofCallback  kof,
object  state,
double  timeout 
)

It gets the current speed of both wheels. Speed on a wheel is from -1 to 1. Value 1 corresponds to 1 revolution per second. Wheels have perimeter of 12,88 mm.

Parameters:
okfA function called after the confirmation answer is received.
kofA function called after the timeout is elapsed if the confirmation of command has not been received.
stateAn instance of any class, which is passed to the callback function as an argument.
timeoutTimeout[ sec ] set how long are you willing to wait for the command confirmation answer.
void Elib.Epuck.GetVersionInfo ( OkfStringSensors  okf,
KofCallback  kof,
object  state,
double  timeout 
)

It gets the BTCom version.

Parameters:
okfA function called after the confirmation answer is received.
kofA function called after the timeout is elapsed if the confirmation of command has not been received.
stateAn instance of any class, which is passed to the callback function as an argument.
timeoutTimeout[sec] set how long are you willing to wait for the command confirmation answer.
void Elib.Epuck.LightX ( int  num,
Turn  how,
OkfActuators  okf,
KofCallback  kof,
object  state,
double  timeout 
)

Sets a LED with number n on,off or into inverse state. Acceptable values are 0..7(resp. 8). Value 8 represents all diodes at once.

Parameters:
numThe nummber of the LED.
howOff/On/InverseState.
okfA function called after the confirmation answer is received.
kofA function called after the timeout is elapsed if the confirmation answer has not been received.
stateAn instance of any class, which is passed to the callback function as an argument.
timeoutTimeout[seconds] set how long are you willing to wait for the command confirmation answer.
void Elib.Epuck.Motors ( double  leftMotor,
double  rightMotor,
OkfActuators  okf,
KofCallback  kof,
object  state,
double  timeout 
)

Sets Left and Right Motor speed. Acceptable values are from -1 to 1. Value 1 corresponds to 1 revolution per second. Wheels have perimeter of 12,88 mm.

Parameters:
leftMotorThe left motor.
rightMotorThe right motor.
okfA function called after the confirmation answer is received.
kofA function called after the timeout is elapsed if the confirmation answer has not been received.
stateAn instance of any class, which is passed to the callback function as an argument.
timeoutTimeout[seconds] set how long are you willing to wait for the command confirmation answer.
delegate void Elib.Epuck.OkfActuators ( object  data)

A format of functions, which are called if the command for an actuator is successfully confirmed in timeout.

delegate void Elib.Epuck.OkfIntsSensors ( int[]  ans,
object  data 
)

A format of functions, which are called when a command requiring an array of int is confirmed in timeout.

delegate void Elib.Epuck.OkfKofCamSensor ( Bitmap  ans,
object  data 
)

A format of functions, which are called when a command requiring a Bitmap is confirmed in timeout.

delegate void Elib.Epuck.OkfStringSensors ( string  ans,
object  data 
)

A format of functions, which are called when a command requiring a string is confirmed in timeout.

void Elib.Epuck.PlaySound ( int  SoundNum,
OkfActuators  okf,
KofCallback  kof,
object  state,
double  timeout 
)

It begins to play sound. Values 0-5 are for different sounds. 6 turns speaker off.

Parameters:
SoundNumThe SoundNum can be between 0 and 6. 6 turns speakers off. Other numbers play a sound.
okfA function called after receiving the confirmation answer.
kofA function called after the timeout is elapsed if the confirmation answer has not been received.
stateAn instance of any class, which is passed to the callback function as an argument.
timeoutTimeout[seconds] set how long are you willing to wait for the command confirmation answer.
void Elib.Epuck.Reset ( OkfActuators  okf,
KofCallback  kof,
object  state,
double  timeout 
)

It restars e-Puck.

Parameters:
okfA function called after the confirmation answer is received.
kofA function called after the timeout is elapsed if the confirmation answer has not been received.
stateAn instance of any class, which is passed to the callback function as an argument.
timeoutTimeout[seconds] set how long are you willing to wait for the command confirmation answer.

remarks>E-Puck needs around 1.5s to restart.

void Elib.Epuck.SetCam ( int  width,
int  height,
Zoom  zoom,
CamMode  mode,
OkfActuators  okf,
KofCallback  kof,
object  state,
double  timeout 
)

It sets the parameters of a camera. Maximum size of a picture can be 3200 bytes. The picture size S = width*height bytes; for black and white mode S = width*height*2 bytes; for colourful mode.

Parameters:
widthThe width of picture in pixels.
heightThe height of picture in pixels
zoomThe zoom of a cam. The lowest is the most useful.
modeThe mode. Can be black and white or colourful.
okfA function called after the confirmation answer is received.
kofA function called after the timeout is elapsed if the confirmation answer has not been received.
stateAn instance of any class, which is passed to the callback function as an argument.
timeoutTimeout[seconds] set how long are you willing to wait for the command confirmation answer.
void Elib.Epuck.SetEncoders ( int  leftMotor,
int  rightMotor,
OkfActuators  okf,
KofCallback  kof,
object  state,
double  timeout 
)

Sets encoders values. One revolution corresponds to 1000 steps.

single functions ///////////////////////////////////

Parameters:
leftMotor
rightMotor
okfA function called after the confirmation answer is received.
kofA function called after the timeout is elapsed if the confirmation answer has not been received.
stateAn instance of any class, which is passed to the callback function as an argument.
timeoutTimeout[seconds] set how long are you willing to wait for the command confirmation answer.
void Elib.Epuck.StartLogging ( )

Exceptions:
T:ElibExceptionis thrown when LogStream is null.

void Elib.Epuck.Stop ( OkfActuators  okf,
KofCallback  kof,
object  state,
double  timeout 
)

It stops e-Puck and turn off leds.

Parameters:
okfA function called after the confirmation answer is received.
kofA function called after the timeout is elapsed if the confirmation answer has not been received.
stateAn instance of any class, which is passed to the callback function as an argument.
timeoutTimeout[seconds] set how long are you willing to wait for the command confirmation answer.
void Elib.Epuck.StopLogging ( )

Disables logging.

override string Elib.Epuck.ToString ( )

Returns a System.String that represents this instance. A user defined robot name and Sercom parameters are returned.

Returns:
A System.String that represents this instance.
void Elib.Epuck.WriteToLogStream ( string  comment)

WriteToLogStream adds to LogStream a comment. (Before passed strings puts '#'.)

Parameters:
comment

Member Data Documentation

readonly int [] Elib.Epuck.IRSensorsDegrees = new int[8] { 10, 30, 90, 170, 190, 270, 330, 350 } [static]

Eight Infra Red sensors are placed on the perimeter of e-Puck, which can be obtained on the instance e of e-Puck by e.BeginGetIRSensors(..) method or by e.GetIRSensors(..) method. IrSensorsDegrees describes the degrees measured from front(There is a cam.) As you can see most of the sensors are on the front side of e-Puck.

const double Elib.Epuck.MaxSpeed = 12.88

12.88 cm/s is a maximum speed of e-Puck. In Elib 13cm/sec corresponds to 1.00. From -1.00 to 1.00 is the speed linearly growing.

const double Elib.Epuck.Perch = 5.3

Distance between wheels of an e-Puck in cm.

const double Elib.Epuck.WheelDiameter = 4.1

units: [cm]


Property Documentation

string Elib.Epuck.BTComHelp [static, get]

It gets the BTCom help.

The BTCom help from static property.

bool Elib.Epuck.Log [get, protected]

Return a bool flag, which indicates whether logging is on.

TextWriter Elib.Epuck.LogStream [get, set]

Enables sets or get TextWriter of e-Puck, where all actions of e-Puck are logged if logging is turned on.

string Elib.Epuck.Name [get]

Gets the name specified in a constructor.

The name.

int Elib.Epuck.NotSent [get]

Gets the number of waiting commands in the notSent queue = commands waiting to be sent via Serial Port(Bluetooth).

The waiting commands.

string Elib.Epuck.Port [get]

Gets the port specified in the constructor.

The port.

int Elib.Epuck.Working [get]

Gets the number of unconfirmed commands in the Epuck instance.

The working.


The documentation for this class was generated from the following files:
 All Classes Namespaces Functions Variables Enumerations Properties Events