rec::robotino::api2 C interface
|
In "rec/robotino/api2/c/Com.h" you can find functions for manipulating the communication interface to Robotino. More...
#include "rec/robotino/api2/c/globals.h"
#include "rec/robotino/api2/c/AnalogInput.h"
#include "rec/robotino/api2/c/Bumper.h"
#include "rec/robotino/api2/c/Camera.h"
#include "rec/robotino/api2/c/CompactBHA.h"
#include "rec/robotino/api2/c/DigitalInput.h"
#include "rec/robotino/api2/c/DigitalOutput.h"
#include "rec/robotino/api2/c/DistanceSensor.h"
#include "rec/robotino/api2/c/EncoderInput.h"
#include "rec/robotino/api2/c/Gripper.h"
#include "rec/robotino/api2/c/Info.h"
#include "rec/robotino/api2/c/Motor.h"
#include "rec/robotino/api2/c/NorthStar.h"
#include "rec/robotino/api2/c/Odometry.h"
#include "rec/robotino/api2/c/OmniDrive.h"
#include "rec/robotino/api2/c/PowerManagement.h"
#include "rec/robotino/api2/c/PowerOutput.h"
#include "rec/robotino/api2/c/Relay.h"
#include "rec/robotino/api2/c/LaserRangeFinder.h"
#include "rec/robotino/api2/c/Manipulator.h"
Go to the source code of this file.
Macros | |
#define | INVALID_COMID -1 |
Typedefs | |
typedef int | ComId |
Functions | |
DLLEXPORT ComId | Com_construct () |
DLLEXPORT BOOL | Com_constructWithId (ComId id) |
DLLEXPORT BOOL | Com_destroy (ComId id) |
DLLEXPORT void | Com_destroyAll (void) |
DLLEXPORT BOOL | Com_setAddress (ComId id, const char *address) |
DLLEXPORT BOOL | Com_address (ComId id, char *addressBuffer, unsigned int addressBuffersSize) |
DLLEXPORT BOOL | Com_setAutoReconnectEnabled (ComId id, BOOL enable) |
DLLEXPORT BOOL | Com_setImageServerPort (ComId id, int port) |
DLLEXPORT BOOL | Com_connect (ComId id) |
DLLEXPORT BOOL | Com_disconnect (ComId id) |
DLLEXPORT BOOL | Com_isConnected (ComId id) |
DLLEXPORT int | Com_num_objects (void) |
In "rec/robotino/api2/c/Com.h" you can find functions for manipulating the communication interface to Robotino.
Use Com_construct() to create a new com object. Set the IP-address of Robotino with Com_setAddress(). Com_connect() establishes the connection.
#include "rec/robotino/api2/c/Com.h"
ComId com;
int main( int argc, char **argv ) { com = Com_construct();
if( argc > 1 ) { Com_setAddress( com, argv[1] ); } else { Com_setAddress( com, "172.26.1.1" ); }
if( FALSE == Com_connect( com ) ) { exit( 1 ); } else { char addressBuffer[256]; Com_address( com, addressBuffer, 256 ); printf( "Connected to %s\n", addressBuffer ); }
Com_destroy( com );
return 0; }
#define INVALID_COMID -1 |
Invalid ComId is -1
typedef int ComId |
ComId
DLLEXPORT BOOL Com_address | ( | ComId | id, |
char * | addressBuffer, | ||
unsigned int | addressBuffersSize | ||
) |
id | The ComId returned by Com_construct(). |
addressBuffer | Will contain the currently active server address set with Com_setAddress() as '\0' terminated string. |
addressBuffersSize | The size of addressBuffer. |
DLLEXPORT BOOL Com_connect | ( | ComId | id | ) |
Establish the communication. Call Com_setAddress() first.
id | The ComId returned by Com_construct(). |
DLLEXPORT ComId Com_construct | ( | ) |
Construct an interface for communicating to one Robotino
DLLEXPORT BOOL Com_constructWithId | ( | ComId | id | ) |
Construct an interface for communicating to one Robotino
id | A user defined id. The value must be greater equal 0. |
DLLEXPORT BOOL Com_destroy | ( | ComId | id | ) |
Destroy the communication interface assigned to id
id | The id of the communication interface to be destroyed |
DLLEXPORT void Com_destroyAll | ( | void | ) |
Destroy all Com objects and attached actuators and sensors.
DLLEXPORT BOOL Com_disconnect | ( | ComId | id | ) |
Stop communication.
id | The ComId returned by Com_construct(). |
DLLEXPORT BOOL Com_isConnected | ( | ComId | id | ) |
Check if the communication is established.
id | The ComId returned by Com_construct(). |
DLLEXPORT int Com_num_objects | ( | void | ) |
For debugging only.
DLLEXPORT BOOL Com_setAddress | ( | ComId | id, |
const char * | address | ||
) |
id | The ComId returned by Com_construct(). |
address | A null terminated string containing the (IP)-address (plus port) of Robotino. The default to connect to Robotino is 172.26.1.1 (port can be omitted. To connect to RobotinoSim running at localhost use 127.0.0.1:8080 (or higher ports). |
DLLEXPORT BOOL Com_setImageServerPort | ( | ComId | id, |
int | port | ||
) |
id | The ComId returned by Com_construct(). |
port | The image server port. To be able to receive images from Robotino there is a UDP server running on your machine. The default port is 8080, but you might change this. |