Epuck

This module allows you to control the e-puck robot and to get data from it. By connecting channels to the inputs and outputs of this module, you activate which functionality will be used in the e-puck (e.g. if you do not connect anything to the VELOCITY channel, there will not be any velocity commands sent to the e-puck). However, the outputs can also be activated by the xoutput_on parameters to the module in the ikc file. The reason for this is that even though nothing is connected to them, you might still want to observe them through the WebUI. Just observing the outputs through the WebUI does not make the OutputConnected() function return true.

Example XML definition

A simple example

  <module
      class = "Epuck"
      name = "EPUCK"
      port = "/dev/rfcomm0"
  />

Parameters

NameDescriptionTypeDefault
classThe class name for the module; must be "Epuck".string
nameThe name of this instance of the module.string
portDecides the device used for Bluetooth communication.string/dev/rfcomm
calibrateDecides if the e-puck should calibrate itself at start-up.booltrue
cameraDecides if, and which, camera type should be used.choices:
none
gray
color
none
heightHeight of the camera image.int32
widthWidth of the camera image.int32
zoomZoom of the camera. Should be 2, 4 or 8.int8
proximity_onDecides if the PROXIMITY output channel should be on even if it is not connected.boolfalse
acceleration_onDecides if the ACCELERATION output channel should be on even if it is not connected.boolfalse
acceleration_plain_onDecides if the ACCELERATION_PLAIN output channel should be on even if it is not connected.boolfalse
orientation_onDecides if the ORIENTATION output channel should be on even if it is not connected.boolfalse
inclination_onDecides if the INCLINATION output channel should be on even if it is not connected.boolfalse
encoder_onDecides if the ENCODER output channel should be on even if it is not connected.boolfalse
microphone_volume_onDecides if the MICROPHONE_VOLUME output channel should be on even if it is not connected.boolfalse
microphone_buffer_onDecides if the MICROPHONE_BUFFER output channel should be on even if it is not connected.boolfalse

Module Connections

Inputs

NameDescription
VELOCITYThis channel controls the wheels of the e-puck (binary command -'D'). Positive values make the wheel spin forward, negative backward. Array of size 2. First value is left wheel, second value is right wheel. Values from -0.129 to 0.129 are allowed. These values are meters/second.
LEDArray of size 8, where each element corresponds to one of the LEDs on the e-puck. Values accepted are natural numbers 0 (turn off led), 1 (turn on led) and 2 (toggle the led). Other values will be changed to one of the above mentioned numbers (values less than 0 become 0 and the rest become 1). The command used is binary -'L'.
LIGHTArray of size 1. This controls the front light of the e-puck. Values accepted are natural numbers 0 (turn off light), 1 (turn on light) and 2 (toggle the light). Other values will be changed to one of the above mentioned numbers (values less than 0 become 0 and the rest become 1). The command used is ascii 'F\n'.
BODYArray of size 1. This controls the body light of the e-puck. Values accepted are natural numbers 0 (turn off body light), 1 (turn on body light) and 2 (toggle the body light). Other values will be changed to one of the above mentioned numbers (values less than 0 become 0 and the rest become 1). The command used is ascii 'B\n'.
SOUNDArray of size 1. Values accepted are natural numbers 0-5. Numbers 1-5 play the corresponding sounds in the e-puck (ascii command 'T,x\n') and number 0 means no sound. When you want to play sound #2, you send 2 to this channel and the sound will be played. Until it has finished it does no matter if something else is sent on this channel, the sound is played to the end. When the sound has stopped playing, this module sends a command to the e-puck to make it quiet, and then the next time it sees something else than 0 in this channel, it starts playing the next sound. The sounds are of varying length, the longest is just under 1.5s. The e-puck is made quiet after this length of time no matter which sound is played, so at some sounds there is a short while when the e-puck makes a quiet sparkeling noise.

Outputs

NameDescription
PROXIMITYArray of size 8. Each value corresponds to one of the readings from the IR sensors (binary command -'N'). These readings seem slightly unreliable, it is only at close range (an inch or two) that you see differences in the output.
ACCELERATION_PLAINArray of size 3. Gives you the values that the e-puck sends back when given the ascii acceleration command ('A\n'). Values are unmodified.
ACCELERATIONArray of size 1. Gives you part of the values that the e-puck sends back when given the binary acceleration command (-'A'). This value is the first int of the three ints that the e-puck sends. The value is divided by 4000, and hence between 0.0 and 1.0. All of the ACCELERATION, ORIANTATION and INCLINATION output channels get their data from the same e-puck command, so if one of them is activated, they all automatically become activated.
ORIENTATIONArray of size 2. Gives you part of the values that the e-puck sends back when given the binary acceleration command (-'A'). This value is the second int of the three ints that the e-puck sends. The output is modified like this: element0 = cos( epuck_out * (2.0 * pi / 360.0) ) and element1 = sin( epuck_out * (2.0 * pi / 360.0) ). All of the ACCELERATION, ORIANTATION and INCLINATION output channels get their data from the same e-puck command, so if one of them is activated, they all automatically become activated.
INCLINATIONArray of size 2. Gives you part of the values that the e-puck sends back when given the binary acceleration command (-'A'). This value is the third int of the three ints that the e-puck sends. The output is modified like this: element0 = cos( epuck_out * (2.0 * pi / 360.0) ) and element1 = sin( epuck_out * (2.0 * pi / 360.0) ). All of the ACCELERATION, ORIANTATION and INCLINATION output channels get their data from the same e-puck command, so if one of them is activated, they all automatically become activated.
ENCODERArray of size 1. This channel gives info about how many steps the wheels have turned since last tick (binary command -'Q'). One full circle (12.9cm distance) is 1000 steps.
MICROPHONE_VOLUMEArray of size 3. Gives the sound volumes of the three microphones in the e-puck (ascii command 'U\n').
MICROPHONE_BUFFERMatrix of size 3x100. These are the values that the e-puck gets via the binary command -'U'. The values are the recordings in the e-pucks rotating microphone buffer. When this channel is activated, the MICROPHONE_SCAN_ID channel is also activated.
MICROPHONE_SCAN_IDArray of size 1. This value is also gotten via the binary command -'U'. This channel is activated when the MICROPHONE_BUFFER channel is activated.
IMAGEMatrix with output from camera when in gray scale mode. Sizes vary depending on the image sizes. The output will be matrix[height][width].
REDMatrix with output for red color from camera when in color mode. Sizes vary depending on the image sizes. The output will be matrix[height][width].
GREENMatrix with output for green color from camera when in color mode. Sizes vary depending on the image sizes. The output will be matrix[height][width].
BLUEMatrix with output for blue color from camera when in color mode. Sizes vary depending on the image sizes. The output will be matrix[height][width].

Author

Christian Balkenius, Birger Johansson and Alexander Kolodziej

Lund University Cognitive Science

Files

Epuck.h
Epuck.cc
Epuck.ikc

blog comments powered by Disqus