Esempio n. 1
0
  private synchronized float getCurrentScanDistance() {
    float currentDistance = getCurrentDistanceFromObject();
    float[] sample = adaptor.getRanges();

    System.out.println("Scan current distance from sensor adaptor: " + currentDistance);
    float[] irSample = new float[irSensor.sampleSize()];

    // get the raw sample data
    irSensor.getDistanceMode().fetchSample(irSample, 0);

    // calculate average of scanned distances
    float scanDistance = findAverageScanDistance(sample);
    return scanDistance;
  }
Esempio n. 2
0
 private float getCurrentDistanceFromObject() {
   return adaptor.getRange();
 }