Functions which handle the IR-distance sensors. More...
Modules | |
Advanced informations | |
Enumerations | |
enum | eSharpGet |
clusters select values for reading the distance measurements More... | |
Functions | |
int16_t | sharps_toMm (uint16_t adc) |
Converts an adc value of a sharp sensor into millimeters. More... | |
Request Funktions | |
void | sharps_request (eRequestType request) |
Requests new data from the sharp sensors. More... | |
uint8_t | sharps_received (void) |
Indicates if new data for the data block sSharp was received. More... | |
uint8_t | sharps_changed (void) |
Indicates if new data changed the data block sSharp. More... | |
Access Funktions | |
uint16_t | sharps_get (eSharpGet select) |
Returns the last stored value of the selected sharp sensor. More... | |
Functions which handle the IR-distance sensors.
Each sharp sensors returns an analog voltage which relates indirect to the measured distance. This voltage is converted with the internal analog-digital-converter.
example
enum eSharpGet |
clusters select values for reading the distance measurements
Enumerator | |
---|---|
kSharpGetLeft | constants (1): left ir-distance sensor |
kSharpGetMiddle | constants (2): middle ir-distance sensor |
kSharpGetRight | constants (3): right ir-distance sensor |
uint8_t sharps_changed | ( | void | ) |
Indicates if new data changed the data block sSharp.
Because of noise the variables will probably be changed every time new data is received.
The return value is boolean.
uint16_t sharps_get | ( | eSharpGet | select | ) |
Returns the last stored value of the selected sharp sensor.
This function relies on the internal data block sSharp - for new data use sharps_request().
The result is given in adc-units. It is helpful to convert the measurement into millimeters - see sharps_toMm().
select | value of the selected sharp sensor - see also eSharpGet |
uint8_t sharps_received | ( | void | ) |
Indicates if new data for the data block sSharp was received.
The return value is boolean.
void sharps_request | ( | eRequestType | request | ) |
Requests new data from the sharp sensors.
For details on the request schema see The general request.
Involved data blocks are:
sSharp
int16_t sharps_toMm | ( | uint16_t | adc | ) |
Converts an adc value of a sharp sensor into millimeters.
The function is just a rough conversion function. It was tuned to be a good fit to all sensors of all robots.
adc | 16-bit unsigned integer This is the measured value in adc-units. |
value | description |
-2 | to far away (> 800mm) |
-1 | to close (< 80mm) |
80..800 | distance in mm |