lejos.robotics.SampleProvider 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;
/** Abstraction for classes that fetch samples from a sensor and classes that are able to process samples.
* A sample is a measurement taken by a sensor at a single moment in time.
* A sample can have one or more elements. The number of elements in a sample depends on the sensor (and sensor mode).
*
*
* Sample providers comply with standards.
*
* -
* Sample providers use standard units.
*
* - Length in meters
* - Angle in degrees
* - Temperature in degrees celcius
* - Pressure in Pascal
* - Speed in m/s
* - Acceleration in m/s^2
* - etc...
*
*
* -
* When there is no clear unit a sample provider use normalized values in the range between 0 and 1.
*
* -
* Sample providers that measure spatial data use a right handed cartesian coordinate system with the X-axis pointing forwards,
* the Y-axis pointing to the left and the Z-axis pointing up.
* (The plug of a sensor is always on its back.)
*
* -
* A positive rotation of a mobile robot is a counterclockwise rotation.
*
* -
* If a sample provider measures spatial data over more than one axis, the order of the elements in a sample corresponds with the X,Y and Z axis.
*
*
* @author Aswin Bouwmeester
*
*/
public interface SampleProvider {
/** Returns the number of elements in a sample.
* The number of elements does not change during runtime.
* @return
* the number of elements in a sample
*/
public int sampleSize();
/** Fetches a sample from a sensor or filter.
* @param sample
* The array to store the sample in.
* @param offset
* The elements of the sample are stored in the array starting at the offset position.
*/
public void fetchSample(float[] sample, int offset);
}