All Downloads are FREE. Search and download functionalities are using the official Maven repository.

lejos.robotics.RangeReading Maven / Gradle / Ivy

Go to download

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;
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy