Virtual interface class for any type of sonar sensor. More...
#include <isonarsensor.h>
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 |
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.
|
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.
Reimplemented in SonarSensor.
|
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.
Reimplemented in SonarSensor.
|
inlinevirtual |
Return the enable status of the sensor.
|
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.
int | e: 0 for disable or 1 for enable |
|
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.
Reimplemented in SonarSensor.