rec::robotino::api2 C interface
Macros | Typedefs | Functions
DistanceSensor.h File Reference

In "rec/robotino/api2/c/DistanceSensor.h" you can find functions for reading Robotino's bumper. More...

#include "rec/robotino/api2/c/globals.h"
#include "rec/robotino/api2/c/Com.h"

Go to the source code of this file.

Macros

#define INVALID_DISTANCESENSORID   -1
 

Typedefs

typedef int DistanceSensorId
 

Functions

DLLEXPORT DistanceSensorId DistanceSensor_constructDefault (void)
 
DLLEXPORT DistanceSensorId DistanceSensor_construct (unsigned int n)
 
DLLEXPORT BOOL DistanceSensor_destroy (DistanceSensorId id)
 
DLLEXPORT BOOL DistanceSensor_setComId (DistanceSensorId id, ComId comId)
 
DLLEXPORT BOOL DistanceSensor_setSensorNumber (DistanceSensorId id, unsigned int n)
 
DLLEXPORT unsigned int numDistanceSensors ()
 
DLLEXPORT float DistanceSensor_voltage (DistanceSensorId id)
 
DLLEXPORT unsigned int DistanceSensor_heading (DistanceSensorId id)
 
DLLEXPORT int DistanceSensor_num_objects (void)
 

Detailed Description

In "rec/robotino/api2/c/DistanceSensor.h" you can find functions for reading Robotino's bumper.

Use DistanceSensor_construct() to create a new distance sensor object. Associate the bumper object with a com object using DistanceSensor_setComId(). Use DistanceSensor_value() to read the distance sensor's state.

Macro Definition Documentation

#define INVALID_DISTANCESENSORID   -1

Invalid DistanceSensorId is -1

Typedef Documentation

typedef int DistanceSensorId

DistanceSensorId

Function Documentation

DLLEXPORT DistanceSensorId DistanceSensor_construct ( unsigned int  n)

Construct an distance sensor object

Returns
Returns the ID of the newly constructed distance sensor object.
Parameters
nThe input number. Range [0; numDistanceSensors()-1]
DLLEXPORT DistanceSensorId DistanceSensor_constructDefault ( void  )

Construct an distance sensor object for input number 0.

Returns
Returns the ID of the newly constructed distance sensor object.
DLLEXPORT BOOL DistanceSensor_destroy ( DistanceSensorId  id)

Destroy the Digital input object assigned to id

Parameters
idThe id of the distance sensor object to be destroyed
Returns
Returns TRUE (1) on success. Returns FALSE (0) if the given DistanceSensorId is invalid.
DLLEXPORT unsigned int DistanceSensor_heading ( DistanceSensorId  id)

Returns the heading of this distance sensor.

Parameters
idThe id of the distance sensor object to be read
Returns
The heading in degrees. [0; 360]
DLLEXPORT BOOL DistanceSensor_setComId ( DistanceSensorId  id,
ComId  comId 
)

Associated a distance sensor object with a communication interface, i.e. binding the distance sensor to a specific Robotino

Returns
Returns TRUE (1) on success. Returns FALSE (0) if the given DistanceSensorId or ComId is invalid.
DLLEXPORT BOOL DistanceSensor_setSensorNumber ( DistanceSensorId  id,
unsigned int  n 
)

Sets the number of this distance sensor.

Parameters
idThe id of the distance sensor object to be set
nThe input number. Range [0 - numDistanceSensors()]
Exceptions
RobotinoExceptionif the given sensor number is invalid.
DLLEXPORT float DistanceSensor_voltage ( DistanceSensorId  id)

Returns the current value of the specified input device.

Parameters
idThe id of the distance sensor object to be read
Returns
The current value of the specified distance sensor. Returns -1 if the given DistanceSensorId is invalid or if this distance sensor is not connected to a valid com object.
DLLEXPORT unsigned int numDistanceSensors ( )
Returns
Returns the number of distance sensors.