lejos.robotics
Class RotatingRangeScanner

java.lang.Object
  extended by 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
protected  float[] angles
           
protected  int gearRatio
           
protected  RegulatedMotor head
           
protected  int MAX_RELIABLE_RANGE_READING
           
protected  RangeFinder rangeFinder
           
protected  RangeReadings readings
           
protected  int ZERO
           
 
Constructor Summary
RotatingRangeScanner(RegulatedMotor head, RangeFinder rangeFinder)
          The constructor specifies the motor and range finder used
RotatingRangeScanner(RegulatedMotor head, RangeFinder rangeFinder, int gearRatio)
           
 
Method Summary
 RangeFinder getRangeFinder()
          returns the rangeFinder - allows other objects to get a range value.
 RangeReadings getRangeValues()
          Returns a set of Range Readings taken the angles specified.
 void setAngles(float[] angles)
          set the angles to be used by the getRangeValues() method
 void setGearRatio(int gearRatio)
          Set the gear ratio
 void setHeadMotor(RegulatedMotor motor)
          Set the head motor
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

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 sensor
rangeFinder - 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:
getRangeValues in interface RangeScanner
Returns:
the set of range values

setAngles

public void setAngles(float[] angles)
set the angles to be used by the getRangeValues() method

Specified by:
setAngles in interface RangeScanner
Parameters:
angles -

getRangeFinder

public RangeFinder getRangeFinder()
returns the rangeFinder - allows other objects to get a range value.

Specified by:
getRangeFinder in interface RangeScanner
Returns:
the range finder