Elib 0.7
C# library for e-Puck robot
|
A virtual representation of e-Puck, which allows control the robot with its methods. More...
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 () | ||
| |||
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. |
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
Elib.Epuck.Epuck | ( | string | Port, |
string | Name | ||
) |
Initializes a new instance of the Epuck class.
Port | The port. |
Name | Choose a name for your robot! It is useful for logging. |
IAsyncResult Elib.Epuck.BeginBodyLight | ( | Turn | how, |
double | timeout, | ||
AsyncCallback | callback, | ||
Object | state | ||
) |
Sets Body led on, off or into an inverse state.
how | Turn change state of the LED? |
timeout | Timeout[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 |
callback | A function which is called, after the confirmation answer is received. |
state | An instance of any class, which is passed to the callback function as an argument. |
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.
timeout | Timeout[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 |
callback | A function which is called, after the confirmation answer is received. |
state | An instance of any class, which is passed to the callback function as an argument. |
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.
how | Turn change state of the LED? |
timeout | Timeout[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 |
callback | A function which is called, after the confirmation answer is received. |
state | An instance of any class, which is passed to the callback function as an argument. |
IAsyncResult Elib.Epuck.BeginGetAccelerometer | ( | double | timeout, |
AsyncCallback | callback, | ||
object | state | ||
) |
It returns vector of values, which indicates the slant of e-Puck.
timeout | Timeout[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 |
callback | A function which is called, after the confirmation answer is received. |
state | An instance of any class, which is passed to the callback function as an argument. |
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.
timeout | Timeout[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 |
callback | A function which is called, after the confirmation answer is received. |
state | An instance of any class, which is passed to the callback function as an argument. |
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.
timeout | Timeout[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 |
callback | A function which is called, after the confirmation answer is received. |
state | An instance of any class, which is passed to the callback function as an argument. |
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.
timeout | Timeout[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 |
callback | A function which is called, after the confirmation answer is received. |
state | An instance of any class, which is passed to the callback function as an argument. |
IAsyncResult Elib.Epuck.BeginGetInfoHelp | ( | double | timeout, |
AsyncCallback | callback, | ||
Object | state | ||
) |
It shows Epuck's help sent from e-Puck.
timeout | Timeout[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 |
callback | A function which is called, after the confirmation answer is received. |
state | An instance of any class, which is passed to the callback function as an argument. |
IAsyncResult Elib.Epuck.BeginGetInfoVersion | ( | double | timeout, |
AsyncCallback | callback, | ||
Object | state | ||
) |
It gets the BTCom version from e-Puck.
timeout | Timeout[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 |
callback | A function called after the confirmation answer is received. |
state | An instance of any class, which is passed to the callback function as an argument. |
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.
timeout | Timeout[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 |
callback | A function which is called, after the confirmation answer is received. |
state | An instance of any class, which is passed to the callback function as an argument. |
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.
timeout | Timeout[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 |
callback | A function which is called, after the confirmation answer is received. |
state | An instance of any class, which is passed to the callback function as an argument. |
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.
timeout | Timeout[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 |
callback | A function which is called, after the confirmation answer is received. |
state | An instance of any class, which is passed to the callback function as an argument. |
IAsyncResult Elib.Epuck.BeginGetMikes | ( | double | timeout, |
AsyncCallback | callback, | ||
object | state | ||
) |
It gets the current amplitude of sound from e-Puck's 3 speakers.
timeout | Timeout[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 |
callback | A function which is called, after the confirmation answer is received. |
state | An instance of any class, which is passed to the callback function as an argument. |
IAsyncResult Elib.Epuck.BeginGetSelector | ( | double | timeout, |
AsyncCallback | callback, | ||
object | state | ||
) |
It returns a selector position.
timeout | Timeout[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 |
callback | A function which is called, after the confirmation answer is received. |
state | An instance of any class, which is passed to the callback function as an argument. |
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.
timeout | Timeout[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 |
callback | A function which is called, after the confirmation answer is received. |
state | An instance of any class, which is passed to the callback function as an argument. |
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.
num | Number of the LED which is changed. |
how | Turn change state of the LED? |
timeout | Timeout[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 |
callback | A function which is called, after the confirmation answer is received. |
state | An instance of any class, which is passed to the callback function as an argument. |
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.
leftMotor | Sets the left motor speed. |
rightMotor | Sets the right motor speed. |
timeout | Timeout[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 |
callback | A function which is called, after the confirmation answer is received. |
state | An instance of any class, which is passed to the callback function as an argument. |
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.
SoundNum | The SoundNum can be between 0 and 6. 6 turns speakers off other numbers plays a sound. |
timeout | Timeout[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 |
callback | A function called after the confirmation answer is received. |
state | An instance of any class, which is passed to the callback function as an argument. |
IAsyncResult Elib.Epuck.BeginReset | ( | double | timeout, |
AsyncCallback | callback, | ||
Object | state | ||
) |
It restarts e-Puck.
timeout | Timeout[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 |
callback | A function which is called, after the confirmation answer is received. |
state | An instance of any class, which is passed to the callback function as an argument. |
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.
width | The width of the picture in pixels. |
height | The height of the picture in pixels |
zoom | The zoom of a cam. The lowest is the most useful. |
mode | The mode. Can be black and white or colourful. |
timeout | Timeout[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 |
callback | A function which is called, after the confirmation answer is received. |
state | An instance of any class, which is passed to the callback function as an argument. |
IAsyncResult Elib.Epuck.BeginSetEncoders | ( | int | leftTicks, |
int | rightTicks, | ||
double | timeout, | ||
AsyncCallback | callback, | ||
Object | state | ||
) |
Sets Left and Right Motor Encoder value.
leftMotor | Sets the left motor value. |
rightMotor | Sets the right motor value. |
timeout | Timeout[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 |
callback | A function which is called, after the confirmation answer is received. |
state | An instance of any class, which is passed to the callback function as an argument. |
IAsyncResult Elib.Epuck.BeginStop | ( | double | timeout, |
AsyncCallback | callback, | ||
Object | state | ||
) |
It stops e-Puck and turn off leds.
timeout | Timeout[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 |
callback | A function which is called, after the confirmation answer is received. |
state | An instance of any class, which is passed to the callback function as an argument. |
void Elib.Epuck.BodyLight | ( | Turn | how, |
OkfActuators | okf, | ||
KofCallback | kof, | ||
object | state, | ||
double | timeout | ||
) |
Sets Body led on, off or into an inverse state.
how | Off/On/InverseState. |
okf | A function called after the confirmation answer is received. |
kof | A function called after the timeout is elapsed if the confirmation answer has not been received. |
state | An instance of any class, which is passed to the callback function as an argument. |
timeout | Timeout[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.
okf | A function called after the confirmation answer is received. |
kof | A function called after the timeout is elapsed if the confirmation answer has not been received. |
state | An instance of any class, which is passed to the callback function as an argument. |
timeout | Timeout[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.
disposing | true 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.
ar | The 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.
ar | Instance of AsyncResult serves to connect the BeginGet... function with EndGetFtion(IAsyncResult) method |
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.
ar | Instance of AsyncResult serves to connect the BeginGet. function with EndGetFtion(IAsyncResult) method |
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.
ar | Instance of AsyncResult serves to connect the BeginGetInfo... function with EndGetFtion(IAsyncResult) method |
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.
how | Off/On/InverseState. |
okf | A function called after the confirmation answer is received. |
kof | A function called after the timeout is elapsed if the confirmation answer has not been received. |
state | An instance of any class, which is passed to the callback function as an argument. |
timeout | Timeout[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.
okf | A function called after the confirmation answer is received. |
kof | A function called after the timeout is elapsed if the confirmation of command has not been received. |
state | An instance of any class, which is passed to the callback function as an argument. |
timeout | Timeout[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.
okf | A function called after the confirmation answer is received. |
kof | A function called after the timeout is elapsed if the confirmation of command has not been received. |
state | An instance of any class, which is passed to the callback function as an argument. |
timeout | Timeout[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.
okf | A function called after the confirmation answer is received. |
kof | A function called after the timeout is elapsed if the confirmation of command has not been received. |
state | An instance of any class, which is passed to the callback function as an argument. |
timeout | Timeout[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.
okf | The okf. |
kof | The kof. |
state | The state. |
timeout | The 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 //////////////////////////
okf | A function called after the confirmation answer is received. |
kof | A function called after the timeout is elapsed if the confirmation of command has not been received. |
state | An instance of any class, which is passed to the callback function as an argument. |
timeout | Timeout[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.
okf | A function called after the confirmation answer is received. |
kof | A function called after the timeout is elapsed if the confirmation of command has not been received. |
state | An instance of any class, which is passed to the callback function as an argument. |
timeout | Timeout[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.
okf | A function called after the confirmation answer is received. |
kof | A function called after the timeout is elapsed if the confirmation of command has not been received. |
state | An instance of any class, which is passed to the callback function as an argument. |
timeout | Timeout[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.
okf | A function called after the confirmation answer is received. |
kof | A function called after the timeout is elapsed if the confirmation of command has not been received. |
state | An instance of any class, which is passed to the callback function as an argument. |
timeout | Timeout[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.
okf | A function called after the confirmation answer is received. |
kof | A function called after the timeout is elapsed if the confirmation of command has not been received. |
state | An instance of any class, which is passed to the callback function as an argument. |
timeout | Timeout[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.
okf | A function called after the confirmation answer is received. |
kof | A function called after the timeout is elapsed if the confirmation of command has not been received. |
state | An instance of any class, which is passed to the callback function as an argument. |
timeout | Timeout[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.
okf | A function called after the confirmation answer is received. |
kof | A function called after the timeout is elapsed if the confirmation of command has not been received. |
state | An instance of any class, which is passed to the callback function as an argument. |
timeout | Timeout[ 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.
okf | A function called after the confirmation answer is received. |
kof | A function called after the timeout is elapsed if the confirmation of command has not been received. |
state | An instance of any class, which is passed to the callback function as an argument. |
timeout | Timeout[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.
num | The nummber of the LED. |
how | Off/On/InverseState. |
okf | A function called after the confirmation answer is received. |
kof | A function called after the timeout is elapsed if the confirmation answer has not been received. |
state | An instance of any class, which is passed to the callback function as an argument. |
timeout | Timeout[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.
leftMotor | The left motor. |
rightMotor | The right motor. |
okf | A function called after the confirmation answer is received. |
kof | A function called after the timeout is elapsed if the confirmation answer has not been received. |
state | An instance of any class, which is passed to the callback function as an argument. |
timeout | Timeout[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.
SoundNum | The SoundNum can be between 0 and 6. 6 turns speakers off. Other numbers play a sound. |
okf | A function called after receiving the confirmation answer. |
kof | A function called after the timeout is elapsed if the confirmation answer has not been received. |
state | An instance of any class, which is passed to the callback function as an argument. |
timeout | Timeout[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.
okf | A function called after the confirmation answer is received. |
kof | A function called after the timeout is elapsed if the confirmation answer has not been received. |
state | An instance of any class, which is passed to the callback function as an argument. |
timeout | Timeout[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.
width | The width of picture in pixels. |
height | The height of picture in pixels |
zoom | The zoom of a cam. The lowest is the most useful. |
mode | The mode. Can be black and white or colourful. |
okf | A function called after the confirmation answer is received. |
kof | A function called after the timeout is elapsed if the confirmation answer has not been received. |
state | An instance of any class, which is passed to the callback function as an argument. |
timeout | Timeout[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 ///////////////////////////////////
leftMotor | |
rightMotor | |
okf | A function called after the confirmation answer is received. |
kof | A function called after the timeout is elapsed if the confirmation answer has not been received. |
state | An instance of any class, which is passed to the callback function as an argument. |
timeout | Timeout[seconds] set how long are you willing to wait for the command confirmation answer. |
void Elib.Epuck.StartLogging | ( | ) |
T:ElibException | is 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.
okf | A function called after the confirmation answer is received. |
kof | A function called after the timeout is elapsed if the confirmation answer has not been received. |
state | An instance of any class, which is passed to the callback function as an argument. |
timeout | Timeout[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.
void Elib.Epuck.WriteToLogStream | ( | string | comment | ) |
WriteToLogStream adds to LogStream a comment. (Before passed strings puts '#'.)
comment |
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]
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.