Package lejos.robotics
Class RotatingRangeScanner
- java.lang.Object
-
- lejos.robotics.RotatingRangeScanner
-
- All Implemented Interfaces:
RangeScanner
public class RotatingRangeScanner extends java.lang.Object implements RangeScanner
Implementation of RangeScanner with a rotating ultrasonic sensor or other range finder- Author:
- Roger Glassey
-
-
Field Summary
Fields Modifier and Type Field Description protected float[]anglesprotected intgearRatioprotected RegulatedMotorheadprotected intMAX_RELIABLE_RANGE_READINGprotected RangeFinderrangeFinderprotected RangeReadingsreadingsprotected intZERO
-
Constructor Summary
Constructors Constructor Description RotatingRangeScanner(RegulatedMotor head, RangeFinder rangeFinder)The constructor specifies the motor and range finder usedRotatingRangeScanner(RegulatedMotor head, RangeFinder rangeFinder, int gearRatio)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description RangeFindergetRangeFinder()returns the rangeFinder - allows other objects to get a range value.RangeReadingsgetRangeValues()Returns a set of Range Readings taken the angles specified.voidsetAngles(float[] angles)set the angles to be used by the getRangeValues() methodvoidsetGearRatio(int gearRatio)Set the gear ratiovoidsetHeadMotor(RegulatedMotor motor)Set the head motor
-
-
-
Field Detail
-
MAX_RELIABLE_RANGE_READING
protected final int MAX_RELIABLE_RANGE_READING
- See Also:
- Constant Field Values
-
ZERO
protected final int ZERO
- See Also:
- Constant Field Values
-
readings
protected RangeReadings readings
-
rangeFinder
protected RangeFinder rangeFinder
-
head
protected RegulatedMotor head
-
angles
protected float[] angles
-
gearRatio
protected int gearRatio
-
-
Constructor Detail
-
RotatingRangeScanner
public RotatingRangeScanner(RegulatedMotor head, RangeFinder rangeFinder)
The constructor specifies the motor and range finder used- Parameters:
head- the motor that rotates the sensorrangeFinder- the range finder
-
RotatingRangeScanner
public RotatingRangeScanner(RegulatedMotor head, RangeFinder rangeFinder, int gearRatio)
-
-
Method Detail
-
setGearRatio
public void setGearRatio(int gearRatio)
Set the gear ratio- Parameters:
gearRatio- the gear ratio
-
setHeadMotor
public void setHeadMotor(RegulatedMotor motor)
Set the head motor- Parameters:
motor- the head motor
-
getRangeValues
public RangeReadings getRangeValues()
Returns a set of Range Readings taken the angles specified.- Specified by:
getRangeValuesin interfaceRangeScanner- Returns:
- the set of range values
-
setAngles
public void setAngles(float[] angles)
set the angles to be used by the getRangeValues() method- Specified by:
setAnglesin interfaceRangeScanner- Parameters:
angles-
-
getRangeFinder
public RangeFinder getRangeFinder()
returns the rangeFinder - allows other objects to get a range value.- Specified by:
getRangeFinderin interfaceRangeScanner- Returns:
- the range finder
-
-