public class EV3IRSensor extends BaseSensor
leJOS conventions for
SampleProviders
Modifier and Type | Class and Description |
---|---|
private class |
EV3IRSensor.DistanceMode |
private class |
EV3IRSensor.RemoteMode |
private class |
EV3IRSensor.SeekMode |
Modifier and Type | Field and Description |
---|---|
private static java.lang.String |
LEGO_EV3_IR |
currentMode, currentModeS, modes, SWITCH_DELAY
LEGO_ANALOG_SENSOR, LEGO_I2C, LEGO_UART_SENSOR, SENSOR_MODE, SENSOR_MODES
ADDRESS, DEVICE, LEGO_PORT, LEGO_SENSOR, MODE, PATH_DEVICE
EV3DEV_ROOT_PATH, EV3DEV_TESTING_KEY, ROOT_PATH
Constructor and Description |
---|
EV3IRSensor(Port portName) |
Modifier and Type | Method and Description |
---|---|
SensorMode |
getDistanceMode()
EV3 Infra Red sensors, Distance mode
Measures the distance to an object in front of the sensors. |
SensorMode |
getRemoteMode() |
SensorMode |
getSeekMode()
EV3 Infra Red sensor, Seek mode
In seek mode the sensor locates up to four beacons and provides bearing and distance of each beacon. |
private void |
init() |
fetchSample, getAvailableModes, getCurrentMode, getMode, getMode, getModeCount, getName, sampleSize, setCurrentMode, setCurrentMode, setModes, switchMode, switchMode
detect, getIntegerAttribute, getStringAttribute, setIntegerAttribute, setStringAttribute
getMotorPort, getPlatform, getSensorPort
getROOT_PATH
private static final java.lang.String LEGO_EV3_IR
private void init()
public SensorMode getDistanceMode()
Size and content of the sample
The sample contains one element giving the distance to an object in front of the sensors. The distance provided is very roughly equivalent to meters
but needs conversion to give better distance. See product page for details.
The effective range of the sensors in Distance mode is about 5 to 50 centimeters. Outside this range a zero is returned
for low values and positive infinity for high values.
leJOS conventions for
SampleProviders
See Sensor Product page public SensorMode getSeekMode()
Size and content of the sample
The sample contains four pairs of elements in a single sample. Each pair gives bearing of and distance to the beacon.
The first pair of elements is associated with a beacon transmitting on channel 0, the second pair with a beacon transmitting on channel 1 etc.
The bearing values range from -25 to +25 (with values increasing clockwise
when looking from behind the sensor). A bearing of 0 indicates the beacon is
directly in front of the sensor.
Distance values are not to scale. Al increasing values indicate increasing distance.
If no beacon is detected both bearing is set to zero, and distance to positive infinity.
leJOS conventions for
SampleProviders
See Sensor Product page public SensorMode getRemoteMode()