aima.core.robotics.impl.datatypes.AbstractRangeReading Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of aima-core Show documentation
Show all versions of aima-core Show documentation
AIMA-Java Core Algorithms from the book Artificial Intelligence a Modern Approach 3rd Ed.
The newest version!
package aima.core.robotics.impl.datatypes;
import aima.core.robotics.datatypes.IMclRangeReading;
/**
* This class implements a single linear reading of a range.
* In addition to the range it stores an {@link Angle} by which the heading was rotated for the measurement of the range.
*
* @author Arno von Borries
* @author Jan Phillip Kretzschmar
* @author Andreas Walscheid
*
*/
public abstract class AbstractRangeReading implements IMclRangeReading {
private final double value;
private final Angle angle;
/**
* Constructor for a range reading with an angle assumed to be zero.
* @param value the actual range that was measured.
*/
public AbstractRangeReading(double value) {
this.value = value;
this.angle = Angle.ZERO_ANGLE;
}
/**
* @param value the actual range that was measured.
* @param angle the angle by which the heading was rotated for the measurement.
*/
public AbstractRangeReading(double value,Angle angle) {
this.value = value;
this.angle = angle;
}
/**
* Returns the range that was measured.
* @return the range that was measured.
*/
public double getValue() {
return value;
}
@Override
public Angle getAngle() {
return angle;
}
@Override
public String toString() {
return String.format("%.2f", value) + "@" + String.format("%.2f", angle.getDegreeValue()) + "\u00BA";
}
}