rec::robotino::api2 C++ interface
Public Member Functions | Static Public Member Functions | Friends | List of all members
rec::robotino::api2::DistanceSensorArray Class Reference

Represents an IR distance sensor. More...

#include <DistanceSensorArray.h>

Inheritance diagram for rec::robotino::api2::DistanceSensorArray:
rec::robotino::api2::ComObject

Public Member Functions

void setComId (const ComId &id)
 
void processEvents ()
 
void voltages (float *readings) const
 
void distances (float *readings) const
 
void headings (float *readings) const
 
virtual void voltagesChangedEvent (const float *voltages, unsigned int size)
 
virtual void distancesChangedEvent (const float *distances, unsigned int size)
 
- Public Member Functions inherited from rec::robotino::api2::ComObject
 ComObject ()
 
virtual ~ComObject ()
 
ComId comId () const
 

Static Public Member Functions

static unsigned int numDistanceSensors ()
 

Friends

class DistanceSensorArrayImpl
 

Additional Inherited Members

- Protected Attributes inherited from rec::robotino::api2::ComObject
ComId _comID
 

Detailed Description

Represents an IR distance sensor.

Member Function Documentation

void rec::robotino::api2::DistanceSensorArray::distances ( float *  readings) const

Returns the current distances of the distance sensors.

Example:

std::vector<float> vec( numDistanceSensors() );
distances( &vec[0] );
for( int i=0; i<vec.size(); ++i )
{
std::cout << "Distance[" << i << "]: " << vec[i] << " m" << std::endl;
}
Parameters
[out]readingsPass an array of size numDistanceSensors() to store distance readings of all distance sensors in m
virtual void rec::robotino::api2::DistanceSensorArray::distancesChangedEvent ( const float *  distances,
unsigned int  size 
)
virtual

Called when distance changed

Parameters
distancesArray of current distance in meters of all distance sensors.
sizeSize of distances array.
Exceptions
nothing.
Remarks
This function is called from the thread in which Com::processEvents() is called.
See also
Com::processEvents
void rec::robotino::api2::DistanceSensorArray::headings ( float *  readings) const

Returns the headings of the distance sensors.

Example:

std::vector<float> vec( numDistanceSensors() );
headings( &vec[0] );
for( int i=0; i<vec.size(); ++i )
{
std::cout << "Heading[" << i << "]: " << vec[i] << " rad" << std::endl;
}
Parameters
[out]readingsPass an array of size numDistanceSensors() to store headings of all distance sensors in rad. [0; 2*PI]
Exceptions
RobotinoExceptionif the underlying communication object is invalid
See also
setSensorNumber, ComObject::setComId
static unsigned int rec::robotino::api2::DistanceSensorArray::numDistanceSensors ( )
static
Returns
Returns the number of distance sensors.
void rec::robotino::api2::DistanceSensorArray::processEvents ( )

Call this function from your main thread to get the virtual DistanceSensorArray functions called. The virtual functions are called directly by a call of this function

Exceptions
nothing
See also
Com::processEvents
void rec::robotino::api2::DistanceSensorArray::setComId ( const ComId id)

Sets the associated communication object.

Parameters
idThe id of the associated communication object.
Exceptions
RobotinoExceptionif given id is invalid.
void rec::robotino::api2::DistanceSensorArray::voltages ( float *  readings) const

Returns the current voltages of the distance sensors.

Example:

std::vector<float> vec( numDistanceSensors() );
voltages( &vec[0] );
for( int i=0; i<vec.size(); ++i )
{
std::cout << "Voltage[" << i << "]: " << vec[i] << " V" << std::endl;
}
Parameters
[out]readingsPass an array of size numDistanceSensors() to store current voltage readings of all distance sensors
Exceptions
RobotinoExceptionif the underlying communication object is invalid
See also
setSensorNumber, ComObject::setComId
virtual void rec::robotino::api2::DistanceSensorArray::voltagesChangedEvent ( const float *  voltages,
unsigned int  size 
)
virtual

Called when voltage changed

Parameters
voltagesArray of current voltage in Volts of all distance sensors.
sizeSize of voltages array.
Exceptions
nothing.
Remarks
This function is called from the thread in which Com::processEvents() is called.
See also
Com::processEvents

The documentation for this class was generated from the following file: