public class LightScanner
Software abstraction of a light sensor rotating in a horizontal plane, driven by a motor.
Records the raw light value and bearing of beacons seen during a scan,
This class assumes that the motor tacho count corresponds to the angle of the sensor in the navigational plane.
After a forward scan is complete, the scan is repeated in the reverse direction
and the data are averaged. This averages out the gear backlash error.
The results of a scan are returned as a set of RangeReadings, not a good name
but this class does have enough fields to do the job. If used in MCL however,
a different class name should be used because the algorithm for calculation of particle
weights is very different if the basic is angles rather than ranges.
Specify the hardware for this object. Light values less than background
are ignored. When a light value larger than minBeaconLight is sensed, it
is within the field of view of the light sensor. As scanning continues,
when the light value drops below background, it is assumed that the beacon
has been passed, and the angle at which the maximum occurred is the angle
of the beacon.
public void setSpeed(int speed)
public void halt()
public RangeReadings scanLight(float startAngle,
Perform a scan for a number of light beacons within the arc defined by the start
and end angles in the specified direction.
Scan in both directions and use the average of the angles.
Assumes the scanner hardware is built so that increasing tacho count of the
motor corresponds to increasing angle in the navigation plane.
startAngle - of the arc
endAngle - of the arc
direction - of the scan. +1 = increasing tacho count of motor.
the set of range readings, containing the light intensity and angle of each beacon