Robot Sensors
Propeller Robot Sensor Objects
 All Classes Functions
Public Member Functions | Protected Attributes | List of all members
ISonarSensor Class Reference

Virtual interface class for any type of sonar sensor. More...

#include <isonarsensor.h>

Inheritance diagram for ISonarSensor:
SonarSensor

Public Member Functions

virtual long trigger ()
 Trigger the sensor to start a ranging session. More...
 
virtual long getRange_in ()
 Get the range in inches from the last ranging cycle. More...
 
virtual long getRange_cm ()
 Get the range in centimeters from the last ranging cycle. More...
 
virtual int setEnable (int e)
 Enable or disable the sensor object. More...
 
virtual int isEnabled ()
 Return the enable status of the sensor. More...
 

Protected Attributes

int enabled
 

Detailed Description

Virtual interface class for any type of sonar sensor.

Class to describe an interface to a wide varity of sonar range sensors. Specfic types of sensors can implement this interface to allow other code to interface to several types of sensor without needing to know the specfics of the type of sensor. The trigger function is expected to return the results of the ranging event as time-of-flight in microseconds.

Member Function Documentation

long ISonarSensor::getRange_cm ( )
inlinevirtual

Get the range in centimeters from the last ranging cycle.

This function must be overidden to provide the distance to the target in centimeters. Returns negative number on failure.

Returns
int: Range to target in centimeters

Reimplemented in SonarSensor.

long ISonarSensor::getRange_in ( )
inlinevirtual

Get the range in inches from the last ranging cycle.

This function must be overidden to provide the distance to the target in tenths of an inch. Returns negative number on failure.

Returns
int: Range to target in tenths of an inch (ie 10.5" = 105)

Reimplemented in SonarSensor.

int ISonarSensor::isEnabled ( )
inlinevirtual

Return the enable status of the sensor.

Returns
int: Enable status
int ISonarSensor::setEnable ( int  e)
inlinevirtual

Enable or disable the sensor object.

This will enable or disable the sensor object. Disabled sensors will not perform any hardware activity when triggered and will always return -1 for values when requesting range data.

Parameters
inte: 0 for disable or 1 for enable
Returns
int: The new enable status
long ISonarSensor::trigger ( )
inlinevirtual

Trigger the sensor to start a ranging session.

This function must be overidden to implement the actual code needed to cause a sensor to perform a ranging cycle. The ranging cycle should be completed when this function returns and either a positive value returned or a negative value returned for failure.

Returns
int: The time of flight in microseconds

Reimplemented in SonarSensor.


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