|
Smartcar Shield
|
#include <DistanceSensor.hpp>


Public Member Functions | |
| virtual | ~DistanceSensor ()=default |
| virtual unsigned int | getDistance ()=0 |
| Gets the distance measured by the sensor in centimeters. More... | |
| virtual unsigned int | getMedianDistance (uint8_t iterations)=0 |
| Gets the median distance from the specified number of measurements. More... | |
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 SR04, SRF08, GP2D120, GP2Y0A02, and GP2Y0A21.

|
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 SRF08, SR04, and InfraredAnalogSensor.
1.8.17