Package lejos.robotics
Class RangeFinderAdapter
- java.lang.Object
-
- lejos.robotics.filter.AbstractFilter
-
- lejos.robotics.RangeFinderAdapter
-
- All Implemented Interfaces:
RangeFinder,SampleProvider
public class RangeFinderAdapter extends AbstractFilter implements RangeFinder
-
-
Field Summary
-
Fields inherited from class lejos.robotics.filter.AbstractFilter
sampleSize, source
-
-
Constructor Summary
Constructors Constructor Description RangeFinderAdapter(SampleProvider source)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description floatgetRange()Get the range to the nearest objectfloat[]getRanges()If the sensor is capable, this method returns multiple range values from a single scan.-
Methods inherited from class lejos.robotics.filter.AbstractFilter
fetchSample, sampleSize
-
-
-
-
Constructor Detail
-
RangeFinderAdapter
public RangeFinderAdapter(SampleProvider source)
-
-
Method Detail
-
getRange
public float getRange()
Description copied from interface:RangeFinderGet the range to the nearest object- Specified by:
getRangein interfaceRangeFinder- Returns:
- the distance to the nearest object
-
getRanges
public float[] getRanges()
Description copied from interface:RangeFinderIf the sensor is capable, this method returns multiple range values from a single scan. Sensors that can only return a single value should return an array containing a single value.- Specified by:
getRangesin interfaceRangeFinder- Returns:
- an array of ranges, ordered from closest to farthest.
-
-