public class EV3IRSensor extends BaseSensor
leJOS conventions for
SampleProviders
Modifier and Type | Field and Description |
---|---|
static int |
IR_CHANNELS |
private static java.lang.String |
LEGO_EV3_IR |
static float |
MAX_RANGE |
static float |
MIN_RANGE |
private static java.lang.String |
MODE_DISTANCE |
private static java.lang.String |
MODE_REMOTE |
private static java.lang.String |
MODE_SEEK |
currentMode, modes, SWITCH_DELAY
LEGO_ANALOG_SENSOR, LEGO_I2C, LEGO_UART_SENSOR, SENSOR_MODE, SENSOR_MODES
ADDRESS, CURRENT_PLATFORM, DEVICE, ev3DevProperties, LEGO_PORT, LEGO_SENSOR, MODE, PATH_DEVICE
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. |
int |
getRemoteCommand(int chan)
Return the current remote command from the specified channel.
|
void |
getRemoteCommands(byte[] cmds,
int offset,
int len)
Obtain the commands associated with one or more channels.
|
SensorMode |
getRemoteMode()
EV3 Infra Red sensor, Remote mode
In seek mode the sensor locates up to four beacons and provides bearing and distance of each beacon. |
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. |
fetchSample, getAvailableModes, getCurrentMode, getMode, getMode, getModeCount, getName, getSystemMode, sampleSize, setCurrentMode, setCurrentMode, setModes, switchMode
detect, getIntegerAttribute, getStringAttribute, setIntegerAttribute, setStringAttribute
private static final java.lang.String LEGO_EV3_IR
public static float MIN_RANGE
public static float MAX_RANGE
private static final java.lang.String MODE_DISTANCE
private static final java.lang.String MODE_SEEK
private static final java.lang.String MODE_REMOTE
public static final int IR_CHANNELS
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()
leJOS conventions for SampleProviders
public int getRemoteCommand(int chan)
chan
- channel to obtain the command forpublic void getRemoteCommands(byte[] cmds, int offset, int len)
cmds
- the array to store the commandsoffset
- the offset to start storinglen
- the number of commands to store.