public class TouchFeatureDetector extends FeatureDetectorAdapter
| Constructor and Description |
|---|
TouchFeatureDetector(Touch touchSensor)
Creates a touch detector in which the touch sensor is assumed to be situated in the center of
the robot.
|
TouchFeatureDetector(Touch touchSensor,
double xOffset,
double yOffset)
If you want the bumpers to report contact relative to the geometry of where they are placed on the robot,
you can provide the x, y offsets of each bumper relative to the center of the robot (the center is
the halfway point between the drive wheels).
|
| Modifier and Type | Method and Description |
|---|---|
protected void |
notifyListeners(Feature feature) |
Feature |
scan()
Performs a single scan for an object and returns the results.
|
addListener, enableDetection, getDelay, isEnabled, setDelaypublic TouchFeatureDetector(Touch touchSensor)
touchSensor - The touch sensor bumper.public TouchFeatureDetector(Touch touchSensor, double xOffset, double yOffset)
touchSensor - The touch sensor bumper.xOffset - The offset (in units e.g. cm) left or right of center. Right is positive, left is negative.yOffset - The offset (in units e.g. cm) forward or back of center. Forward is positive, back is negative.public Feature scan()
FeatureDetectorPerforms a single scan for an object and returns the results. If an object is not detected, this method returns null.
Warning: Make sure to check for a null object before trying to read data from the returned Feature object, otherwise your code will throw a null pointer exception.
scan in interface FeatureDetectorscan in class FeatureDetectorAdapterprotected void notifyListeners(Feature feature)
notifyListeners in class FeatureDetectorAdapter