Esempio n. 1
0
/**
 * Get the last distance measured by the sonar in centimeters. When the ground is too far away, SONAR_OUT_OF_RANGE is returned.
 */
int32_t sonarRead(void)
{
    int32_t distance = hcsr04_get_distance();
    if (distance > HCSR04_MAX_RANGE_CM)
        distance = SONAR_OUT_OF_RANGE;
    return distance;
}
Esempio n. 2
0
/**
 * Get the last distance measured by the sonar in centimeters. When the ground is too far away, SONAR_OUT_OF_RANGE is returned.
 */
int32_t sonarRead(void)
{
    int32_t distance = hcsr04_get_distance();
    if (distance > HCSR04_MAX_RANGE_CM)
        distance = SONAR_OUT_OF_RANGE;

    return applySonarMedianFilter(distance);
}
Esempio n. 3
0
void Sonar_update(void)
{
    hcsr04_get_distance(&sonarAlt);
}
Esempio n. 4
0
/**
 * Get the last distance measured by the sonar in centimeters. When the ground is too far away, -1 is returned instead.
 */
int32_t sonarRead(void)
{
    return hcsr04_get_distance();
}