public class ModernRoboticsI2cIrSeekerSensorV3 extends I2cDeviceSynchDevice<I2cDeviceSynch> implements IrSeekerSensor, I2cAddrConfig
ModernRoboticsI2cIrSeekerSensorV3 supports the Modern Robotics IR Seeker V3.| Modifier and Type | Class and Description |
|---|---|
static class |
ModernRoboticsI2cIrSeekerSensorV3.Register |
IrSeekerSensor.IrSeekerIndividualSensor, IrSeekerSensor.ModeHardwareDevice.Manufacturer| Modifier and Type | Field and Description |
|---|---|
static I2cAddr |
ADDRESS_I2C_DEFAULT |
static double |
MAX_SENSOR_STRENGTH |
protected IrSeekerSensor.Mode |
mode |
protected double |
signalDetectedThreshold |
deviceClient, deviceClientIsOwned, isInitialized| Constructor and Description |
|---|
ModernRoboticsI2cIrSeekerSensorV3(I2cDeviceSynch deviceClient) |
| Modifier and Type | Method and Description |
|---|---|
protected boolean |
doInitialize()
Actually carries out the initialization of the instance.
|
double |
getAngle()
Estimated angle in which the signal is coming from
|
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
|
byte |
read8(ModernRoboticsI2cIrSeekerSensorV3.Register reg) |
protected short |
readShort(ModernRoboticsI2cIrSeekerSensorV3.Register reg) |
void |
setI2cAddress(I2cAddr newAddress)
Set the I2C address to a new value.
|
void |
setMode(IrSeekerSensor.Mode mode)
Set the device mode
|
protected void |
setOptimalReadWindow() |
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() |
void |
write8(ModernRoboticsI2cIrSeekerSensorV3.Register reg,
byte value) |
close, disengage, engage, getConnectionInfo, getDeviceClient, initialize, initializeIfNecessary, onModuleStateChange, registerArmingStateCallback, resetDeviceConfigurationForOpModeclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitclose, getConnectionInfo, resetDeviceConfigurationForOpModepublic static final I2cAddr ADDRESS_I2C_DEFAULT
public static final double MAX_SENSOR_STRENGTH
protected IrSeekerSensor.Mode mode
protected double signalDetectedThreshold
public ModernRoboticsI2cIrSeekerSensorV3(I2cDeviceSynch deviceClient)
protected void setOptimalReadWindow()
protected boolean doInitialize()
I2cDeviceSynchDevicedoInitialize in class I2cDeviceSynchDevice<I2cDeviceSynch>public HardwareDevice.Manufacturer getManufacturer()
HardwareDevicegetManufacturer in interface HardwareDevicepublic java.lang.String getDeviceName()
HardwareDevicegetDeviceName in interface HardwareDevicepublic int getVersion()
HardwareDevicegetVersion in interface HardwareDevicegetVersion in class I2cDeviceSynchDevice<I2cDeviceSynch>public byte read8(ModernRoboticsI2cIrSeekerSensorV3.Register reg)
public void write8(ModernRoboticsI2cIrSeekerSensorV3.Register reg, byte value)
protected short readShort(ModernRoboticsI2cIrSeekerSensorV3.Register reg)
public 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 I2cAddrConfigsetI2cAddress in interface IrSeekerSensornewAddress - the new I2C address to usepublic I2cAddr getI2cAddress()
IrSeekerSensorgetI2cAddress in interface I2cAddressableDevicegetI2cAddress in interface IrSeekerSensor