|
Smartcar Shield
|
A parent class for all sensors that conduct distance measurements. More...
#include <DistanceSensor.hpp>


Public Member Functions | |
| virtual | ~DistanceSensor ()=default |
| virtual unsigned int | getDistance ()=0 |
| Gets the distance measured by the sensor in centimeters. | |
| virtual unsigned int | getMedianDistance (uint8_t iterations)=0 |
| Gets the median distance from the specified number of measurements. | |
A parent class for all sensors that conduct distance measurements.
Definition at line 20 of file DistanceSensor.hpp.
|
virtualdefault |
|
pure virtual |
Gets the distance measured by the sensor in centimeters.
Calling this might trigger a new measurement by the sensor.
0 if an error has occured, otherwise the measured distance in centimetersExample:
Implemented in GP2D120, GP2Y0A02, GP2Y0A21, SRF08, and SR04.

|
pure virtual |
Gets the median distance from the specified number of measurements.
| iterations | Number of measurements to conduct (at most kMaxMedianMeasurements) |
0 or larger than kMaxMedianMeasurementsExample:
Implemented in InfraredAnalogSensor, SR04, and SRF08.