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.Mode
HardwareDevice.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, resetDeviceConfigurationForOpMode
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
close, getConnectionInfo, resetDeviceConfigurationForOpMode
public 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()
I2cDeviceSynchDevice
doInitialize
in class I2cDeviceSynchDevice<I2cDeviceSynch>
public HardwareDevice.Manufacturer getManufacturer()
HardwareDevice
getManufacturer
in interface HardwareDevice
public java.lang.String getDeviceName()
HardwareDevice
getDeviceName
in interface HardwareDevice
public int getVersion()
HardwareDevice
getVersion
in interface HardwareDevice
getVersion
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.Object
public void setSignalDetectedThreshold(double threshold)
IrSeekerSensor
setSignalDetectedThreshold
in interface IrSeekerSensor
threshold
- minimum thresholdpublic double getSignalDetectedThreshold()
IrSeekerSensor
getSignalDetectedThreshold
in interface IrSeekerSensor
public void setMode(IrSeekerSensor.Mode mode)
IrSeekerSensor
setMode
in interface IrSeekerSensor
mode
- sample ratepublic IrSeekerSensor.Mode getMode()
IrSeekerSensor
getMode
in interface IrSeekerSensor
public boolean signalDetected()
IrSeekerSensor
signalDetected
in interface IrSeekerSensor
public double getAngle()
IrSeekerSensor
If 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 IrSeekerSensor
public double getStrength()
IrSeekerSensor
Detected 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 IrSeekerSensor
public IrSeekerSensor.IrSeekerIndividualSensor[] getIndividualSensors()
IrSeekerSensor
getIndividualSensors
in interface IrSeekerSensor
public void setI2cAddress(I2cAddr newAddress)
IrSeekerSensor
setI2cAddress
in interface I2cAddrConfig
setI2cAddress
in interface IrSeekerSensor
newAddress
- the new I2C address to usepublic I2cAddr getI2cAddress()
IrSeekerSensor
getI2cAddress
in interface I2cAddressableDevice
getI2cAddress
in interface IrSeekerSensor