Пример #1
0
/**
 * Get the range in inches from the ultrasonic sensor.
 * @return double Range in inches of the target returned from the ultrasonic sensor. If there is
 * no valid value yet, i.e. at least one measurement hasn't completed, then return 0.
 */
double Ultrasonic::GetRangeInches()
{
	if (IsRangeValid())
		return m_counter->GetPeriod() * kSpeedOfSoundInchesPerSec / 2.0;
	else
		return 0;
}
Пример #2
0
bool LaserScanProcessor::GetMinValidAngle(float& angle, int& ind) {
  for (int i = 0; i < ranges_.size(); i++) {
    float range = ranges_.at(i);

    if (IsRangeValid(range)) {
      angle = angle_min_ + i * angle_increment_;
      ind = i;
      return true;
    }
  }

  return false;
}