public class HiTechnicNxtIrSeekerSensor extends I2cControllerPortDeviceImpl implements IrSeekerSensor, I2cAddressableDevice, I2cController.I2cPortReadyCallback
IrSeekerSensor.IrSeekerIndividualSensor, IrSeekerSensor.ModeHardwareDevice.Manufacturer| Modifier and Type | Field and Description |
|---|---|
static double |
DEFAULT_SIGNAL_DETECTED_THRESHOLD |
static byte |
DIRECTION |
static double[] |
DIRECTION_TO_ANGLE |
static I2cAddr |
I2C_ADDRESS |
static byte |
INVALID_ANGLE |
static byte |
MAX_ANGLE |
static double |
MAX_SENSOR_STRENGTH |
static int |
MEM_AC_START_ADDRESS |
static int |
MEM_DC_START_ADDRESS |
static int |
MEM_MODE_ADDRESS |
static int |
MEM_READ_LENGTH |
static byte |
MIN_ANGLE |
static byte |
MODE_AC |
static byte |
MODE_DC |
static byte |
SENSOR_COUNT |
static byte |
SENSOR_FIRST |
controller, physicalPort| Constructor and Description |
|---|
HiTechnicNxtIrSeekerSensor(I2cController module,
int physicalPort) |
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Closes this device
|
protected void |
controllerNowArmedOrPretending()
intended as a subclass hook
|
double |
getAngle()
Estimated angle in which the signal is coming from
|
java.lang.String |
getConnectionInfo()
Get connection information about this device in a human readable format
|
java.lang.String |
getDeviceName()
Returns a string suitable for display to the user as to the type of device.
|
I2cAddr |
getI2cAddress()
Get the current I2C Address of this object.
|
IrSeekerSensor.IrSeekerIndividualSensor[] |
getIndividualSensors()
Get a list of all IR sensors attached to this seeker.
|
HardwareDevice.Manufacturer |
getManufacturer()
Returns an indication of the manufacturer of this device.
|
IrSeekerSensor.Mode |
getMode()
Get the device mode
|
double |
getSignalDetectedThreshold()
Get the minimum threshold for a signal to be considered detected
|
double |
getStrength()
IR Signal strength
|
int |
getVersion()
Version
|
void |
portIsReady(int port) |
void |
resetDeviceConfigurationForOpMode()
Resets the device's configuration to that which is expected at the beginning of an OpMode.
|
void |
setI2cAddress(I2cAddr newAddress)
Set the I2C address to a new value.
|
void |
setMode(IrSeekerSensor.Mode mode)
Set the device mode
|
void |
setSignalDetectedThreshold(double threshold)
Set the minimum threshold for a signal to be considered detected
|
boolean |
signalDetected()
Returns true if an IR signal is detected
|
java.lang.String |
toString() |
controllerNowDisarmed, finishConstruction, getI2cController, getPort, onModuleStateChangepublic static final I2cAddr I2C_ADDRESS
public static final int MEM_MODE_ADDRESS
public static final int MEM_DC_START_ADDRESS
public static final int MEM_AC_START_ADDRESS
public static final int MEM_READ_LENGTH
public static final byte MODE_AC
public static final byte MODE_DC
public static final byte DIRECTION
public static final byte SENSOR_FIRST
public static final byte SENSOR_COUNT
public static final double MAX_SENSOR_STRENGTH
public static final byte INVALID_ANGLE
public static final byte MIN_ANGLE
public static final byte MAX_ANGLE
public static final double[] DIRECTION_TO_ANGLE
public static final double DEFAULT_SIGNAL_DETECTED_THRESHOLD
public HiTechnicNxtIrSeekerSensor(I2cController module, int physicalPort)
protected void controllerNowArmedOrPretending()
I2cControllerPortDeviceImplcontrollerNowArmedOrPretending in class I2cControllerPortDeviceImplpublic java.lang.String toString()
toString in class java.lang.Objectpublic void setSignalDetectedThreshold(double threshold)
IrSeekerSensorsetSignalDetectedThreshold in interface IrSeekerSensorthreshold - minimum thresholdpublic double getSignalDetectedThreshold()
IrSeekerSensorgetSignalDetectedThreshold in interface IrSeekerSensorpublic void setMode(IrSeekerSensor.Mode mode)
IrSeekerSensorsetMode in interface IrSeekerSensormode - sample ratepublic IrSeekerSensor.Mode getMode()
IrSeekerSensorgetMode in interface IrSeekerSensorpublic boolean signalDetected()
IrSeekerSensorsignalDetected in interface IrSeekerSensorpublic double getAngle()
IrSeekerSensorIf the signal is estimated to be directly ahead, 0 will be returned. If the signal is to the left a negative angle will be returned. If the signal is to the right a positive angle will be returned. If no signal is detected, a 0 will be returned.
NOTE: not all sensors give an accurate angle.
getAngle in interface IrSeekerSensorpublic double getStrength()
IrSeekerSensorDetected IR signal strength, on a scale of 0.0 to 1.0, where 0 is no signal detected and 1 is max IR signal detected.
getStrength in interface IrSeekerSensorpublic IrSeekerSensor.IrSeekerIndividualSensor[] getIndividualSensors()
IrSeekerSensorgetIndividualSensors in interface IrSeekerSensorpublic void setI2cAddress(I2cAddr newAddress)
IrSeekerSensorsetI2cAddress in interface IrSeekerSensorpublic I2cAddr getI2cAddress()
IrSeekerSensorgetI2cAddress in interface I2cAddressableDevicegetI2cAddress in interface IrSeekerSensorpublic void portIsReady(int port)
portIsReady in interface I2cController.I2cPortReadyCallbackpublic HardwareDevice.Manufacturer getManufacturer()
HardwareDevicegetManufacturer in interface HardwareDevicepublic java.lang.String getDeviceName()
HardwareDevicegetDeviceName in interface HardwareDevicepublic java.lang.String getConnectionInfo()
HardwareDevicegetConnectionInfo in interface HardwareDevicepublic int getVersion()
HardwareDevicegetVersion in interface HardwareDevicepublic void resetDeviceConfigurationForOpMode()
HardwareDeviceresetDeviceConfigurationForOpMode in interface HardwareDevicepublic void close()
HardwareDeviceclose in interface HardwareDevice