java.lang.Objectjrobots.utils.Scan
public class Scan
This class represents a single Scan result. It holds:
isTargetLocated()
,
isTargetLocated()
,
getArcLength()
,
Scan(Angle, Angle, double, Vector, double)
,
timeOfScan
,
scanAperture
,
scanDirection
,
scannerPosition
,
Serialized FormField Summary | |
---|---|
double |
distanceToTarget
Scanned distance at the time of scan. |
Angle |
scanAperture
Aperture of the scan at the time of scan. |
Angle |
scanDirection
Direction of the scanner at the time of scan. |
Vector |
scannerPosition
Position of the scanner at scan time. |
double |
timeOfScan
time of scan [s]. |
Constructor Summary | |
---|---|
Scan(Angle scanDirection,
Angle scanAperture,
double distanceToTarget,
Vector scannerPosition,
double timeOfScan)
Initializes all final fields. |
Method Summary | |
---|---|
Vector |
estimatedTargetPosition()
Estimates the target's position accoring to the scanned values. |
double |
getArcLength()
This method retrieves the length of the arc at which the scanned target is located. |
boolean |
isTargetLocated()
Gives the information whether this scan has detected an enemy or not. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public final double distanceToTarget
If no target was found inside the scanned cone the distance is 0.
Note: The distance to target may be outdated at a later time.
If you need the distance to the given direction use
getPosition().distanceTo(estimatedTargetPosition())
public final Angle scanAperture
public final Angle scanDirection
public final Vector scannerPosition
public final double timeOfScan
Constructor Detail |
---|
public Scan(Angle scanDirection, Angle scanAperture, double distanceToTarget, Vector scannerPosition, double timeOfScan)
scanDirection
- scanAperture
- distanceToTarget
- scannerPosition
- timeOfScan
- Method Detail |
---|
public Vector estimatedTargetPosition()
Note: The vector is given in global coordinates and is not relative to the own position.
scannerPosition.add(new Vector(scanDirection, distanceToTarget))
public double getArcLength()
One can say that the longer the arc the more miserable is the scan.
scanAperture.getValueAsRadians() * distanceToTarget
public boolean isTargetLocated()