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

Represents an IR distance sensor. More...

#include <DistanceSensor.h>

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

Public Member Functions

void setComId (const ComId &id)
 
void processEvents ()
 
void setSensorNumber (unsigned int n)
 
float voltage () const
 
float distance () const
 
float heading () const
 
virtual void voltageChangedEvent (float voltage)
 
virtual void distanceChangedEvent (float distance)
 
- 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 DistanceSensorImpl
 

Additional Inherited Members

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

Detailed Description

Represents an IR distance sensor.

Member Function Documentation

float rec::robotino::api2::DistanceSensor::distance ( ) const
Returns
The measured distance in meters
virtual void rec::robotino::api2::DistanceSensor::distanceChangedEvent ( float  distance)
virtual

Called when distance changed

Parameters
distanceThe current distance in meters
Exceptions
nothing.
Remarks
This function is called from the thread in which Com::processEvents() is called.
See also
Com::processEvents
float rec::robotino::api2::DistanceSensor::heading ( ) const

Returns the heading of this distance sensor.

Returns
The heading in rad. [0; 2*PI]
Exceptions
RobotinoExceptionif the underlying communication object is invalid
See also
setSensorNumber, ComObject::setComId
static unsigned int rec::robotino::api2::DistanceSensor::numDistanceSensors ( )
static
Returns
Returns the number of distance sensors.
void rec::robotino::api2::DistanceSensor::processEvents ( )

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

Exceptions
nothing
See also
Com::processEvents
void rec::robotino::api2::DistanceSensor::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::DistanceSensor::setSensorNumber ( unsigned int  n)

Sets the number of this distance sensor.

Parameters
nThe input number. Range [0; Robotstate::numDistanceSensors-1]
Exceptions
RobotinoExceptionif the given sensor number is invalid.
float rec::robotino::api2::DistanceSensor::voltage ( ) const

Returns the current voltage of this distance sensor.

Returns
The current voltage of this sensor.
Exceptions
RobotinoExceptionif the underlying communication object is invalid
See also
setSensorNumber, ComObject::setComId
virtual void rec::robotino::api2::DistanceSensor::voltageChangedEvent ( float  voltage)
virtual

Called when voltage changed

Parameters
voltageThe current voltage in Volts.
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: