public static class SensorDistanceEx.DistanceTarget
extends java.lang.Object
Constructor and Description |
---|
DistanceTarget(DistanceUnit unit,
double target)
Target must be within the range of the Rev 2m Sensor, which is 2 meters
|
DistanceTarget(DistanceUnit unit,
double target,
double threshold) |
DistanceTarget(DistanceUnit unit,
double target,
double threshold,
java.lang.String name) |
Modifier and Type | Method and Description |
---|---|
boolean |
atTarget(double currentDistance)
Determines if the sensor reached the target value (within the threshold error range)
|
java.lang.String |
getName() |
double |
getTarget() |
double |
getThreshold()
Gets the acceptable error range
|
DistanceUnit |
getUnit()
Gets the unit of distance
|
void |
setName(java.lang.String name)
Changes the name of the sensor
|
void |
setTarget(double target)
Change the target value
|
void |
setUnit(DistanceUnit unit)
Changes the unit of measurement
|
public DistanceTarget(DistanceUnit unit, double target)
unit
- user-defined unit of distancetarget
- the target distancepublic DistanceTarget(DistanceUnit unit, double target, double threshold)
unit
- user-defined unit of distancetarget
- the target distancethreshold
- the acceptable error rangepublic DistanceTarget(DistanceUnit unit, double target, double threshold, java.lang.String name)
unit
- the user-defined unit of distancetarget
- the target distancethreshold
- the acceptable error rangename
- the name of the sensorpublic boolean atTarget(double currentDistance)
currentDistance
- the current distance to the targetpublic void setTarget(double target)
target
- the new targetpublic void setUnit(DistanceUnit unit)
unit
- the new unit valuepublic void setName(java.lang.String name)
name
- the new name of the sensorpublic DistanceUnit getUnit()
public double getThreshold()
public double getTarget()
public java.lang.String getName()