lejos.robotics.RangeReading Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of lejos-ev3-api Show documentation
Show all versions of lejos-ev3-api Show documentation
leJOS (pronounced like the Spanish word "lejos" for "far") is a tiny Java Virtual Machine. In 2013 it was ported to the LEGO EV3 brick.
The newest version!
package lejos.robotics;
/**
* Represent a single range reading
*/
public class RangeReading {
private float range, angle;
/**
* Create the reading
*
* @param angle the angle relative to the heading
* @param range the range reading
*/
public RangeReading(float angle, float range) {
this.range = range;
this.angle = angle;
}
/**
* Get the range reading
*
* @return the range reading
*/
public float getRange() {
return range;
}
/**
* Get the angle of the range reading
*
* @return the angle relative to the robot heading
*/
public float getAngle() {
return angle;
}
/**
* Test if reading is invalid
*
* @return true iff the reading is invalid
*/
public boolean invalidReading() {
return range < 0;
}
}