|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object lejos.robotics.objectdetection.FeatureDetectorAdapter lejos.robotics.objectdetection.TouchFeatureDetector
public class TouchFeatureDetector
This class allows a touch sensor to be used as a defacto range sensor by reporting the position of the touch sensor to the object detection API. The touch sensor will only notify one time when it is pressed and will not be ready to notify again until the touch sensor is released.
Constructor Summary | |
---|---|
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). |
Method Summary | |
---|---|
protected void |
notifyListeners(Feature feature)
|
Feature |
scan()
Performs a single scan for an object and returns the results. |
Methods inherited from class lejos.robotics.objectdetection.FeatureDetectorAdapter |
---|
addListener, enableDetection, getDelay, isEnabled, setDelay |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public 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.Method Detail |
---|
public Feature scan()
FeatureDetector
Performs 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 FeatureDetector
scan
in class FeatureDetectorAdapter
protected void notifyListeners(Feature feature)
notifyListeners
in class FeatureDetectorAdapter
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |