PC side Elisa-3 library
Functions
elisa3-lib.h File Reference
#include <stdio.h>
#include <sys/types.h>
#include <math.h>
#include <unistd.h>
#include "usb-comm.h"

Go to the source code of this file.

Functions

void startCommunication (int *robotAddr, int numRobots)
 To be called once at the beginning, it init the USB communication with the RF module that is responsible to send data to the robots and initialize the list of robots to be controlled; max number of simultaneous robots is 100.
void stopCommunication ()
 To be called once at the end, it closes the USB communication.
void setLeftSpeed (int robotAddr, char value)
 Set the left speed of the robot.
void setRightSpeed (int robotAddr, char value)
 Set the right speed of the robot.
void setLeftSpeedForAll (char *value)
 Set the left speed of all the robots specified in the list.
void setRightSpeedForAll (char *value)
 Set the right speed of all the robots specified in the list.
void setRed (int robotAddr, unsigned char value)
 Set the red intensity of the RGB led on the robot.
void setGreen (int robotAddr, unsigned char value)
 Set the green intensity of the RGB led on the robot.
void setBlue (int robotAddr, unsigned char value)
 Set the blue intensity of the RGB led on the robot.
void setRedForAll (unsigned char *value)
 Set the red intensity of the RGB led of all the robots specified in the list.
void setGreenForAll (unsigned char *value)
 Set the green intensity of the RGB led of all the robots specified in the list.
void setBlueForAll (unsigned char *value)
 Set the blue intensity of the RGB led of all all the robots specified in the list.
void turnOnFrontIRs (int robotAddr)
 Turn on both the front IRs transmitter on the robot.
void turnOffFrontIRs (int robotAddr)
 Turn off both the front IRs transmitter on the robot.
void turnOnBackIR (int robotAddr)
 Turn on the back IR transmitter on the robot.
void turnOffBackIR (int robotAddr)
 Turn off the back IR transmitter on the robot.
void turnOnAllIRs (int robotAddr)
 Turn on all the 3 IRs transmitter on the robot.
void turnOffAllIRs (int robotAddr)
 Turn off all the 3 IRs transmitter on the robot.
void enableTVRemote (int robotAddr)
 Enable the reception of commands from a TV remote.
void disableTVRemote (int robotAddr)
 Disable the reception of commands from a TV remote.
void enableSleep (int robotAddr)
 Put the robot in sleep mode (energy saving mode).
void disableSleep (int robotAddr)
 Put the robot in normal mode (out of sleep).
void calibrateSensors (int robotAddr)
 Calibrate the sensors of the robot (proximity, accelerometer).
void calibrateSensorsForAll ()
 Calibrate the sensors (proximity, accelerometer) of all the robots specified in the list.
void enableObstacleAvoidance (int robotAddr)
 Enable the onboard obstacle avoidance.
void disableObstacleAvoidance (int robotAddr)
 Disable the onboard obstacle avoidance.
void enableCliffAvoidance (int robotAddr)
 Enable the onboard cliff avoidance.
void disableCliffAvoidance (int robotAddr)
 Disable the onboard cliff avoidance.
void setRobotAddress (int robotIndex, int robotAddr)
 Set the address of a robot related to a particular index, the index must be in the range of the robot list size.
void setRobotAddresses (int *robotAddr, int numRobots)
 Set the addresses of the robots that need to be controlled; max number of simultaneous robots is 100.
unsigned int getProximity (int robotAddr, int proxId)
 Request one of the proximity sensors value of the robot.
unsigned int getProximityAmbient (int robotAddr, int proxId)
 Request one of the ambient value (from proximity sensors) of the robot.
unsigned int getGround (int robotAddr, int groundId)
 Request one of the ground sensors value of the robot.
unsigned int getGroundAmbient (int robotAddr, int groundId)
 Request one of the ambient value (from ground sensors) of the robot.
void getAllProximity (int robotAddr, unsigned int *proxArr)
 Request all the proximity sensors values at once.
void getAllProximityAmbient (int robotAddr, unsigned int *proxArr)
 Request all the ambient values (from proximity sensors) at once.
void getAllGround (int robotAddr, unsigned int *groundArr)
 Request all the ground sensors values at once.
void getAllGroundAmbient (int robotAddr, unsigned int *groundArr)
 Request all the ambient values (from ground sensors) at once.
void getAllProximityFromAll (unsigned int proxArr[][8])
 Request all the proximity sensors values of all the robots specified in the list.
void getAllProximityAmbientFromAll (unsigned int proxArr[][8])
 Request all the ambient values (from proximity sensors) of all the robots specified in the list.
void getAllGroundFromAll (unsigned int groundArr[][4])
 Request all the ground sensors values of all the robots specified in the list.
void getAllGroundAmbientFromAll (unsigned int groundArr[][4])
 Request all the ambient values (from ground sensors) of all the robots specified in the list.
unsigned int getBatteryAdc (int robotAddr)
 Request the raw battery value, it contains the sampled value of the battery.
unsigned int getBatteryPercent (int robotAddr)
 Request the charge percentage of the battery.
signed int getAccX (int robotAddr)
 Request the raw value of the accelerometer x axis.
signed int getAccY (int robotAddr)
 Request the raw value of the accelerometer y axis.
signed int getAccZ (int robotAddr)
 Request the raw value of the accelerometer z axis.
unsigned char getSelector (int robotAddr)
 Request the selector position.
unsigned char getTVRemoteCommand (int robotAddr)
 Request last command received from the TV remote.
void setSmallLed (int robotAddr, int ledId, int state)
 Set a new stato (on or off) for the small green leds around the robot.
void turnOffSmallLeds (int robotAddr)
 Turn off all the small green leds around the robot.
void turnOnSmallLeds (int robotAddr)
 Turn on all the small green leds around the robot.
signed int getOdomTheta (int robotAddr)
 Request the current orientation of the robot computed from the measured speed of the motors.
signed int getOdomXpos (int robotAddr)
 Request the current position (x component) of the robot computed from the measured speed of the motors.
signed int getOdomYpos (int robotAddr)
 Request the current position (y component) of the robot computed from the measured speed of the motors.
int getVerticalAngle (int robotAddr)
 Request the current orientation of the robot given by the accelerometer. This function is usable only if the robot is moving vertically.
void startOdometryCalibration (int robotAddr)
 Start the odometry calibration.
void transferData ()
 This function need to be called periodically (as fast as possible) in order to exchange data with the robots.
void stopTransferData ()
 This function stop the transmission of the packets to the robots.
void resumeTransferData ()
 This function resume the transmission of the packets to the robots.
unsigned char robotIsCharging (int robotAddr)
 Tell whether the robot is charging or not.
unsigned char robotIsCharged (int robotAddr)
 Tell whether the robot is completely charged or not.
unsigned char buttonIsPressed (int robotAddr)
 Tell whether the button on the back side of the robot is pressed or not.
void resetFlagTX (int robotAddr)
 Reset all the flags sent to the robot.
unsigned char getFlagTX (int robotAddr, int flagInd)
 Request the current flags value (raw) sent to the robot.
unsigned char getFlagRX (int robotAddr)
 Request the current flags value (raw) received from the robot.
signed long int getLeftMotSteps (int robotAddr)
 Request the current raw value of the left motor steps (sum of the measured speed).
signed long int getRightMotSteps (int robotAddr)
 Request the current raw value of the right motor steps (sum of the measured speed).
double getRFQuality (int robotAddr)
 Request the current percentage of failed trasnfers in the last 5 seconds.
void resetMessageIsSentFlag (int robotAddr)
 Reset the flag indicating that the last modified packet is sent to the robot; it should be called before using "messageIsSent".
unsigned char messageIsSent (int robotAddr)
 Request if the last modified packet is sent to the robot; this function is thought to be used in polling mode (continue to check whether the message is sent untill it is actually sent). Before the polling the function "resetMessageIsSentFlag" need to be called. It can be used for both check whether the robots received the new messages and to know when new data from the robots are available.
unsigned char waitForMessageTransmission (int robotAddr, unsigned long us)
 Wait for the message to be actually sent to the robot; if the robot isn't reachable (out of range, discharged, ...) then the function will exit after the amount of time specified as parameter even if the robot doesn't receive the data.
void setCompletePacket (int robotAddr, char red, char green, char blue, char flags[2], char left, char right, char leds)
 Set all the values of a robot at one time.
void setCompletePacketForAll (int *robotAddr, char *red, char *green, char *blue, char flags[][2], char *left, char *right, char *leds)
 Set all the values of all the robots specified in the list.
unsigned char waitForUpdate (int robotAddr, unsigned long us)
 Wait for updated data coming from the robot; if the robot isn't reachable (out of range, discharged, ...) then the function will exit after the amount of time specified as parameter even if no data are received. this function can be used also to check whether a message is successfully sent to a robot or not.
unsigned char sendMessageToRobot (int robotAddr, char red, char green, char blue, char flags[2], char left, char right, char leds, unsigned long us)
 Send a message to a particular robot resetting the list of robots to a single one (all previous address set with "startCommunication" will be lost).

Function Documentation

unsigned char buttonIsPressed ( int  robotAddr)

Tell whether the button on the back side of the robot is pressed or not.

Parameters:
robotAddrthe address of the robot from which receive data.
Returns:
0 not pressed, 1 button is pressed.
void calibrateSensors ( int  robotAddr)

Calibrate the sensors of the robot (proximity, accelerometer).

Parameters:
robotAddrthe address of the robot for which to change the packet.
Returns:
none

Calibrate the sensors (proximity, accelerometer) of all the robots specified in the list.

Returns:
none
void disableCliffAvoidance ( int  robotAddr)

Disable the onboard cliff avoidance.

Parameters:
robotAddrthe address of the robot for which to change the packet.
Returns:
none
void disableObstacleAvoidance ( int  robotAddr)

Disable the onboard obstacle avoidance.

Parameters:
robotAddrthe address of the robot for which to change the packet.
Returns:
none
void disableSleep ( int  robotAddr)

Put the robot in normal mode (out of sleep).

Parameters:
robotAddrthe address of the robot for which to change the packet.
Returns:
none
void disableTVRemote ( int  robotAddr)

Disable the reception of commands from a TV remote.

Parameters:
robotAddrthe address of the robot for which to change the packet.
Returns:
none
void enableCliffAvoidance ( int  robotAddr)

Enable the onboard cliff avoidance.

Parameters:
robotAddrthe address of the robot for which to change the packet.
Returns:
none
void enableObstacleAvoidance ( int  robotAddr)

Enable the onboard obstacle avoidance.

Parameters:
robotAddrthe address of the robot for which to change the packet.
Returns:
none
void enableSleep ( int  robotAddr)

Put the robot in sleep mode (energy saving mode).

Parameters:
robotAddrthe address of the robot for which to change the packet.
Returns:
none
void enableTVRemote ( int  robotAddr)

Enable the reception of commands from a TV remote.

Parameters:
robotAddrthe address of the robot for which to change the packet.
Returns:
none
signed int getAccX ( int  robotAddr)

Request the raw value of the accelerometer x axis.

Parameters:
robotAddrthe address of the robot from which receive data.
Returns:
current x value, the range is between -64 to 64.
signed int getAccY ( int  robotAddr)

Request the raw value of the accelerometer y axis.

Parameters:
robotAddrthe address of the robot from which receive data.
Returns:
current y value, the range is between -64 to 64.
signed int getAccZ ( int  robotAddr)

Request the raw value of the accelerometer z axis.

Parameters:
robotAddrthe address of the robot from which receive data.
Returns:
current z value, the range is between -64 to 64.
void getAllGround ( int  robotAddr,
unsigned int *  groundArr 
)

Request all the ground sensors values at once.

Parameters:
robotAddrthe address of the robot from which receive data.
groundArrdestination array for the ground values (size must be 4).
Returns:
none
void getAllGroundAmbient ( int  robotAddr,
unsigned int *  groundArr 
)

Request all the ambient values (from ground sensors) at once.

Parameters:
robotAddrthe address of the robot from which receive data.
groundArrdestination array for the ambient values (size must be 4).
Returns:
none
void getAllGroundAmbientFromAll ( unsigned int  groundArr[][4])

Request all the ambient values (from ground sensors) of all the robots specified in the list.

Parameters:
groundArrdestination matrix for the ambient values (size must be list_size x 4).
Returns:
none
void getAllGroundFromAll ( unsigned int  groundArr[][4])

Request all the ground sensors values of all the robots specified in the list.

Parameters:
groundArrdestination matrix for the ground values (size must be list_size x 4).
Returns:
none
void getAllProximity ( int  robotAddr,
unsigned int *  proxArr 
)

Request all the proximity sensors values at once.

Parameters:
robotAddrthe address of the robot from which receive data.
proxArrdestination array for the proximity values (size must be 8).
Returns:
none
void getAllProximityAmbient ( int  robotAddr,
unsigned int *  proxArr 
)

Request all the ambient values (from proximity sensors) at once.

Parameters:
robotAddrthe address of the robot from which receive data.
proxArrdestination array for the ambient values (size must be 8).
Returns:
none
void getAllProximityAmbientFromAll ( unsigned int  proxArr[][8])

Request all the ambient values (from proximity sensors) of all the robots specified in the list.

Parameters:
proxArrdestination matrix for the ambient values (size must be list_size x 8).
Returns:
none
void getAllProximityFromAll ( unsigned int  proxArr[][8])

Request all the proximity sensors values of all the robots specified in the list.

Parameters:
proxArrdestination matrix for the proximity values (size must be list_size x 8).
Returns:
none
unsigned int getBatteryAdc ( int  robotAddr)

Request the raw battery value, it contains the sampled value of the battery.

Parameters:
robotAddrthe address of the robot from which receive data.
Returns:
current battery value, the values range is between 780 (battery discharged) and 930 (battery charged).
unsigned int getBatteryPercent ( int  robotAddr)

Request the charge percentage of the battery.

Parameters:
robotAddrthe address of the robot from which receive data.
Returns:
current charge percentage, the values range is between 0 and 100.
unsigned char getFlagRX ( int  robotAddr)

Request the current flags value (raw) received from the robot.

Parameters:
robotAddrthe address of the robot from which receive data.
Returns:
current flag value.
unsigned char getFlagTX ( int  robotAddr,
int  flagInd 
)

Request the current flags value (raw) sent to the robot.

Parameters:
robotAddrthe address of the robot from which receive data.
flagInd0 or 1
Returns:
current flag value.
unsigned int getGround ( int  robotAddr,
int  groundId 
)

Request one of the ground sensors value of the robot.

Parameters:
robotAddrthe address of the robot from which receive data.
groundIdfrom 0 to 3 (0 is on the left side, then increases clockwise).
Returns:
current ground value from 512 to 1023, the smaller the value the darker the surface
unsigned int getGroundAmbient ( int  robotAddr,
int  groundId 
)

Request one of the ambient value (from ground sensors) of the robot.

Parameters:
robotAddrthe address of the robot from which receive data.
groundIdfrom 0 to 3 (0 is on the left side, then increases clockwise).
Returns:
current ambient value from 0 to 1023, the smaller the value the brighter the ambient light
signed long int getLeftMotSteps ( int  robotAddr)

Request the current raw value of the left motor steps (sum of the measured speed).

Parameters:
robotAddrthe address of the robot from which receive data.
Returns:
current motor steps.
signed int getOdomTheta ( int  robotAddr)

Request the current orientation of the robot computed from the measured speed of the motors.

Parameters:
robotAddrthe address of the robot from which receive data.
Returns:
current orientation of the robot expressed in 1/10 of degree (3600 degrees for a full turn).
signed int getOdomXpos ( int  robotAddr)

Request the current position (x component) of the robot computed from the measured speed of the motors.

Parameters:
robotAddrthe address of the robot from which receive data.
Returns:
current x position of the robot expressed in millimiters.
signed int getOdomYpos ( int  robotAddr)

Request the current position (y component) of the robot computed from the measured speed of the motors.

Parameters:
robotAddrthe address of the robot from which receive data.
Returns:
current y position of the robot expressed in millimiters.
unsigned int getProximity ( int  robotAddr,
int  proxId 
)

Request one of the proximity sensors value of the robot.

Parameters:
robotAddrthe address of the robot from which receive data.
proxIdfrom 0 to 7 (0 is in front, then increases clockwise).
Returns:
current proximity value from 0 to 1023, the greater the value the nearer the objects to the sensor
unsigned int getProximityAmbient ( int  robotAddr,
int  proxId 
)

Request one of the ambient value (from proximity sensors) of the robot.

Parameters:
robotAddrthe address of the robot from which receive data.
proxIdfrom 0 to 7 (0 is in front, then increases clockwise).
Returns:
current ambient value from 0 to 1023, the smaller the value the brighter the ambient light
double getRFQuality ( int  robotAddr)

Request the current percentage of failed trasnfers in the last 5 seconds.

Parameters:
robotAddrthe address of the robot from which receive data.
Returns:
current quality, 0 to 100.
signed long int getRightMotSteps ( int  robotAddr)

Request the current raw value of the right motor steps (sum of the measured speed).

Parameters:
robotAddrthe address of the robot from which receive data.
Returns:
current motor steps.
unsigned char getSelector ( int  robotAddr)

Request the selector position.

Parameters:
robotAddrthe address of the robot from which receive data.
Returns:
current selector position, range is between 0 and 15.
unsigned char getTVRemoteCommand ( int  robotAddr)

Request last command received from the TV remote.

Parameters:
robotAddrthe address of the robot from which receive data.
Returns:
current TV remote value.
int getVerticalAngle ( int  robotAddr)

Request the current orientation of the robot given by the accelerometer. This function is usable only if the robot is moving vertically.

Parameters:
robotAddrthe address of the robot from which receive data.
Returns:
current robot orientation, range is between 0 and 360 degrees (0 pointing to the right).
unsigned char messageIsSent ( int  robotAddr)

Request if the last modified packet is sent to the robot; this function is thought to be used in polling mode (continue to check whether the message is sent untill it is actually sent). Before the polling the function "resetMessageIsSentFlag" need to be called. It can be used for both check whether the robots received the new messages and to know when new data from the robots are available.

Parameters:
robotAddrthe address of the robot from which receive data.
Returns:
0 if message not received by the robot, 1 if message sent correctly.
void resetFlagTX ( int  robotAddr)

Reset all the flags sent to the robot.

Parameters:
robotAddrthe address of the robot for which to change data.
Returns:
none.
void resetMessageIsSentFlag ( int  robotAddr)

Reset the flag indicating that the last modified packet is sent to the robot; it should be called before using "messageIsSent".

Parameters:
robotAddrthe address of the robot for which to change data.
Returns:
none.

This function resume the transmission of the packets to the robots.

Returns:
none.
unsigned char robotIsCharged ( int  robotAddr)

Tell whether the robot is completely charged or not.

Parameters:
robotAddrthe address of the robot from which receive data.
Returns:
0 not charged, 1 robot is charged.
unsigned char robotIsCharging ( int  robotAddr)

Tell whether the robot is charging or not.

Parameters:
robotAddrthe address of the robot from which receive data.
Returns:
0 not charging, 1 robot is charging.
unsigned char sendMessageToRobot ( int  robotAddr,
char  red,
char  green,
char  blue,
char  flags[2],
char  left,
char  right,
char  leds,
unsigned long  us 
)

Send a message to a particular robot resetting the list of robots to a single one (all previous address set with "startCommunication" will be lost).

Parameters:
robotAddrthe address of the robot for which to change data.
red,green,redRGB channels intensity, range is between 0 (led off) to 100 (max power).
flagsraw flag bytes: byte0:
  • first two bits are dedicated to the IRs: 0x00 => all IRs off 0x01 => back IR on 0x02 => front IRs on 0x03 => all IRs on
  • third bit is used for enabling/disablng IR remote control (0=>diabled, 1=>enabled)
  • fourth bit is used for sleep (1 => go to sleep for 1 minute)
  • fifth bit is used to calibrate all sensors (proximity, ground, accelerometer)
  • sixth bits is reserved (used by radio station)
  • seventh bit is used for enabling/disabling onboard obstacle avoidance
  • eight bit is used for enabling/disabling onboard cliff avoidance byte1:
  • first is used for starting odometry calibration
left,rightleft and right speed, range is -128..127.
ledsraw byte value for small green leds (bit0=0/1 turn off/on led0, bit1=0/1 turn off/on led1, ...).
usfunction timeout given in microseconds
Returns:
0 if message sent succesfully, 1 otherwise.
void setBlue ( int  robotAddr,
unsigned char  value 
)

Set the blue intensity of the RGB led on the robot.

Parameters:
robotAddrthe address of the robot for which to change the packet.
valueThe intensity, range is between 0 (led off) to 100 (max power).
Returns:
none
void setBlueForAll ( unsigned char *  value)

Set the blue intensity of the RGB led of all all the robots specified in the list.

Parameters:
valueThe intensity array, range is between 0 (led off) to 100 (max power).
Returns:
none
void setCompletePacket ( int  robotAddr,
char  red,
char  green,
char  blue,
char  flags[2],
char  left,
char  right,
char  leds 
)

Set all the values of a robot at one time.

Parameters:
robotAddrthe address of the robot for which to change data.
red,green,redRGB channels intensity, range is between 0 (led off) to 100 (max power).
flagsraw flag bytes: byte0:
  • first two bits are dedicated to the IRs: 0x00 => all IRs off 0x01 => back IR on 0x02 => front IRs on 0x03 => all IRs on
  • third bit is used for enabling/disablng IR remote control (0=>diabled, 1=>enabled)
  • fourth bit is used for sleep (1 => go to sleep for 1 minute)
  • fifth bit is used to calibrate all sensors (proximity, ground, accelerometer)
  • sixth bits is reserved (used by radio station)
  • seventh bit is used for enabling/disabling onboard obstacle avoidance
  • eight bit is used for enabling/disabling onboard cliff avoidance byte1:
  • first is used for starting odometry calibration
left,rightleft and right speed, range is -128..127.
ledsraw byte value for small green leds (bit0=0/1 turn off/on led0, bit1=0/1 turn off/on led1, ...).
Returns:
none.
void setCompletePacketForAll ( int *  robotAddr,
char *  red,
char *  green,
char *  blue,
char  flags[][2],
char *  left,
char *  right,
char *  leds 
)

Set all the values of all the robots specified in the list.

Parameters:
robotAddrarray the addresses of the robots for which to change data.
red,green,redarrays RGB channels intensity, range is between 0 (led off) to 100 (max power).
flagsarray raw flag bytes: byte0:
  • first two bits are dedicated to the IRs: 0x00 => all IRs off 0x01 => back IR on 0x02 => front IRs on 0x03 => all IRs on
  • third bit is used for enabling/disablng IR remote control (0=>diabled, 1=>enabled)
  • fourth bit is used for sleep (1 => go to sleep for 1 minute)
  • fifth bit is used to calibrate all sensors (proximity, ground, accelerometer)
  • sixth bits is reserved (used by radio station)
  • seventh bit is used for enabling/disabling onboard obstacle avoidance
  • eight bit is used for enabling/disabling onboard cliff avoidance byte1:
  • first is used for starting odometry calibration
left,rightarrays left and right speed, range is -128..127.
ledsarray raw byte value for small green leds (bit0=0/1 turn off/on led0, bit1=0/1 turn off/on led1, ...).
Returns:
none.
void setGreen ( int  robotAddr,
unsigned char  value 
)

Set the green intensity of the RGB led on the robot.

Parameters:
robotAddrthe address of the robot for which to change the packet.
valueThe intensity, range is between 0 (led off) to 100 (max power).
Returns:
none
void setGreenForAll ( unsigned char *  value)

Set the green intensity of the RGB led of all the robots specified in the list.

Parameters:
valueThe intensity array, range is between 0 (led off) to 100 (max power).
Returns:
none
void setLeftSpeed ( int  robotAddr,
char  value 
)

Set the left speed of the robot.

Parameters:
robotAddrthe address of the robot for which to change the packet.
valueThe speed, range is between -128 to 127.
Returns:
none
void setLeftSpeedForAll ( char *  value)

Set the left speed of all the robots specified in the list.

Parameters:
valueThe speed array, range is between -128 to 127.
Returns:
none
void setRed ( int  robotAddr,
unsigned char  value 
)

Set the red intensity of the RGB led on the robot.

Parameters:
robotAddrthe address of the robot for which to change the packet.
valueThe intensity, range is between 0 (led off) to 100 (max power).
Returns:
none
void setRedForAll ( unsigned char *  value)

Set the red intensity of the RGB led of all the robots specified in the list.

Parameters:
valueThe intensity array, range is between 0 (led off) to 100 (max power).
Returns:
none
void setRightSpeed ( int  robotAddr,
char  value 
)

Set the right speed of the robot.

Parameters:
robotAddrthe address of the robot for which to change the packet.
valueThe speed, range is between -128 to 127.
Returns:
none
void setRightSpeedForAll ( char *  value)

Set the right speed of all the robots specified in the list.

Parameters:
valueThe speed array, range is between -128 to 127.
Returns:
none
void setRobotAddress ( int  robotIndex,
int  robotAddr 
)

Set the address of a robot related to a particular index, the index must be in the range of the robot list size.

Parameters:
robotIndexfrom 0 to number of robots - 1 (set with "setRobotAddresses" function)
robotAddrthe address of the robot
Returns:
none
void setRobotAddresses ( int *  robotAddr,
int  numRobots 
)

Set the addresses of the robots that need to be controlled; max number of simultaneous robots is 100.

Parameters:
robotAddrarray list of robot addresses to be handled.
numRobotsthe array size (number of robots to handle).
Returns:
none
void setSmallLed ( int  robotAddr,
int  ledId,
int  state 
)

Set a new stato (on or off) for the small green leds around the robot.

Parameters:
robotAddrthe address of the robot from which receive data.
ledIdthe led to change, from 0 to 7 (0 is in front, then increases clockwise).
state0 to turn off, 1 to turn on.
Returns:
none.
void startCommunication ( int *  robotAddr,
int  numRobots 
)

To be called once at the beginning, it init the USB communication with the RF module that is responsible to send data to the robots and initialize the list of robots to be controlled; max number of simultaneous robots is 100.

Parameters:
robotAddrarray list of robot addresses to be handled.
numRobotsthe array size (number of robots to handle).
Returns:
none
void startOdometryCalibration ( int  robotAddr)

Start the odometry calibration.

Parameters:
robotAddrthe address of the robot for which to change the packet.
Returns:
none.

To be called once at the end, it closes the USB communication.

Returns:
none
void stopTransferData ( )

This function stop the transmission of the packets to the robots.

Returns:
none.
void transferData ( )

This function need to be called periodically (as fast as possible) in order to exchange data with the robots.

Returns:
none.
void turnOffAllIRs ( int  robotAddr)

Turn off all the 3 IRs transmitter on the robot.

Parameters:
robotAddrthe address of the robot for which to change the packet.
Returns:
none
void turnOffBackIR ( int  robotAddr)

Turn off the back IR transmitter on the robot.

Parameters:
robotAddrthe address of the robot for which to change the packet.
Returns:
none
void turnOffFrontIRs ( int  robotAddr)

Turn off both the front IRs transmitter on the robot.

Parameters:
robotAddrthe address of the robot for which to change the packet.
Returns:
none
void turnOffSmallLeds ( int  robotAddr)

Turn off all the small green leds around the robot.

Parameters:
robotAddrthe address of the robot from which receive data.
Returns:
none.
void turnOnAllIRs ( int  robotAddr)

Turn on all the 3 IRs transmitter on the robot.

Parameters:
robotAddrthe address of the robot for which to change the packet.
Returns:
none
void turnOnBackIR ( int  robotAddr)

Turn on the back IR transmitter on the robot.

Parameters:
robotAddrthe address of the robot for which to change the packet.
Returns:
none
void turnOnFrontIRs ( int  robotAddr)

Turn on both the front IRs transmitter on the robot.

Parameters:
robotAddrthe address of the robot for which to change the packet.
Returns:
none
void turnOnSmallLeds ( int  robotAddr)

Turn on all the small green leds around the robot.

Parameters:
robotAddrthe address of the robot from which receive data.
Returns:
none.
unsigned char waitForMessageTransmission ( int  robotAddr,
unsigned long  us 
)

Wait for the message to be actually sent to the robot; if the robot isn't reachable (out of range, discharged, ...) then the function will exit after the amount of time specified as parameter even if the robot doesn't receive the data.

Parameters:
robotAddrthe address of the robot for which to change data.
usfunction timeout given in microseconds
Returns:
0 if message sent, 1 otherwise.
unsigned char waitForUpdate ( int  robotAddr,
unsigned long  us 
)

Wait for updated data coming from the robot; if the robot isn't reachable (out of range, discharged, ...) then the function will exit after the amount of time specified as parameter even if no data are received. this function can be used also to check whether a message is successfully sent to a robot or not.

Parameters:
robotAddrthe address of the robot from which receive data.
usfunction timeout given in microseconds
Returns:
0 if updated data received, 1 otherwise.
 All Files Functions Variables Defines