Package ftclib.archive
Class FtcZXDistanceSensor
java.lang.Object
trclib.robotcore.TrcSerialBusDevice
ftclib.robotcore.FtcI2cDevice
ftclib.archive.FtcZXDistanceSensor
- All Implemented Interfaces:
TrcSensor.DataSource<FtcZXDistanceSensor.DataType>
public class FtcZXDistanceSensor
extends FtcI2cDevice
implements TrcSensor.DataSource<FtcZXDistanceSensor.DataType>
This class implements the ZX Distance sensor extending FtcI2cDevice.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enum
static enum
Specifies the various detected gestures.Nested classes/interfaces inherited from class trclib.robotcore.TrcSerialBusDevice
TrcSerialBusDevice.Request
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final int
static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private final TrcSensor.SensorData<FtcZXDistanceSensor.Gesture>
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private final TrcSensor.SensorData<Double>
private final TrcSensor.SensorData<Double>
private static final int
private static final int
static final int
private final int
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
static final int
private final int
private final TrcSensor.SensorData<Double>
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
private final TrcSensor.SensorData<Double>
private final TrcSensor.SensorData<Double>
Fields inherited from class ftclib.robotcore.FtcI2cDevice
deviceSynch
Fields inherited from class trclib.robotcore.TrcSerialBusDevice
instanceName, tracer
-
Constructor Summary
ConstructorsConstructorDescriptionFtcZXDistanceSensor
(com.qualcomm.robotcore.hardware.HardwareMap hardwareMap, String instanceName, int i2cAddress, boolean addressIs7Bit) Constructor: Creates an instance of the object.FtcZXDistanceSensor
(String instanceName) Constructor: Creates an instance of the object.FtcZXDistanceSensor
(String instanceName, int i2cAddress, boolean addressIs7Bit) Constructor: Creates an instance of the object. -
Method Summary
Modifier and TypeMethodDescriptionThis method returns the detected gesture type.This method returns the data from the Gesture Speed register.This method returns the data from the Left Ranging Data register.int
This method returns the data from the Model Version register.getRawData
(int index, FtcZXDistanceSensor.DataType dataType) This method returns the sensor data of the specified index.int
This method returns the data from the Register Map Version register.This method returns the data from the Right Ranging Data register.int
This method returns the data from the Status register.getX()
This method returns the data from teh X Position register.getZ()
This method returns the data from teh Z Position register.Methods inherited from class ftclib.robotcore.FtcI2cDevice
readData, writeData
Methods inherited from class trclib.robotcore.TrcSerialBusDevice
asyncRead, asyncRead, asyncRead, asyncRead, asyncRead, asyncWrite, asyncWrite, asyncWrite, isEnabled, preemptiveWrite, sendByteCommand, sendWordCommand, setEnabled, syncRead, syncRead, syncWrite, syncWrite, toString
-
Field Details
-
DEF_I2CADDRESS
public static final int DEF_I2CADDRESS- See Also:
-
ALTERNATE_I2CADDRESS
public static final int ALTERNATE_I2CADDRESS- See Also:
-
REG_STATUS
private static final int REG_STATUS- See Also:
-
REG_DRE
private static final int REG_DRE- See Also:
-
REG_DRCFG
private static final int REG_DRCFG- See Also:
-
REG_GESTURE
private static final int REG_GESTURE- See Also:
-
REG_GSPEED
private static final int REG_GSPEED- See Also:
-
REG_DCM
private static final int REG_DCM- See Also:
-
REG_XPOS
private static final int REG_XPOS- See Also:
-
REG_ZPOS
private static final int REG_ZPOS- See Also:
-
REG_LRNG
private static final int REG_LRNG- See Also:
-
REG_RRNG
private static final int REG_RRNG- See Also:
-
REG_REGVER
private static final int REG_REGVER- See Also:
-
REG_MODEL
private static final int REG_MODEL- See Also:
-
READ_LENGTH
private static final int READ_LENGTH- See Also:
-
STATUS_DAV
public static final int STATUS_DAV- See Also:
-
STATUS_OVF
public static final int STATUS_OVF- See Also:
-
STATUS_SWP
public static final int STATUS_SWP- See Also:
-
STATUS_HOVER
public static final int STATUS_HOVER- See Also:
-
STATUS_HVG
public static final int STATUS_HVG- See Also:
-
STATUS_EDGE
public static final int STATUS_EDGE- See Also:
-
STATUS_HB
public static final int STATUS_HB- See Also:
-
STATUS_GESTURES
public static final int STATUS_GESTURES- See Also:
-
DRE_RNG
private static final int DRE_RNG- See Also:
-
DRE_CRD
private static final int DRE_CRD- See Also:
-
DRE_SWP
private static final int DRE_SWP- See Also:
-
DRE_HOVER
private static final int DRE_HOVER- See Also:
-
DRE_HVG
private static final int DRE_HVG- See Also:
-
DRE_EDGE
private static final int DRE_EDGE- See Also:
-
DRE_ALL
private static final int DRE_ALL- See Also:
-
DRCFG_POLARITY
private static final int DRCFG_POLARITY- See Also:
-
DRCFG_EDGE
private static final int DRCFG_EDGE- See Also:
-
DRCFG_FORCE
private static final int DRCFG_FORCE- See Also:
-
DRCFG_EN
private static final int DRCFG_EN- See Also:
-
GESTURE_NONE
private static final int GESTURE_NONE- See Also:
-
GESTURE_RIGHT_SWIPE
private static final int GESTURE_RIGHT_SWIPE- See Also:
-
GESTURE_LEFT_SWIPE
private static final int GESTURE_LEFT_SWIPE- See Also:
-
GESTURE_UP_SWIPE
private static final int GESTURE_UP_SWIPE- See Also:
-
GESTURE_HOVER
private static final int GESTURE_HOVER- See Also:
-
GESTURE_HOVER_LEFT
private static final int GESTURE_HOVER_LEFT- See Also:
-
GESTURE_HOVER_RIGHT
private static final int GESTURE_HOVER_RIGHT- See Also:
-
GESTURE_HOVER_UP
private static final int GESTURE_HOVER_UP- See Also:
-
MAX_XPOSITION
private static final int MAX_XPOSITION- See Also:
-
MAX_ZPOSITION
private static final int MAX_ZPOSITION- See Also:
-
REGISTERMAP_VERSION
public static final int REGISTERMAP_VERSION- See Also:
-
MODEL_VERSION
public static final int MODEL_VERSION- See Also:
-
regMapVersion
private final int regMapVersion -
modelVersion
private final int modelVersion -
gesture
-
gestureSpeed
-
xPos
-
zPos
-
leftRangingData
-
rightRangingData
-
-
Constructor Details
-
FtcZXDistanceSensor
public FtcZXDistanceSensor(com.qualcomm.robotcore.hardware.HardwareMap hardwareMap, String instanceName, int i2cAddress, boolean addressIs7Bit) Constructor: Creates an instance of the object.- Parameters:
hardwareMap
- specifies the global hardware map.instanceName
- specifies the instance name.i2cAddress
- specifies the I2C address of the device.addressIs7Bit
- specifies true if the I2C address is a 7-bit address, false if it is 8-bit.
-
FtcZXDistanceSensor
Constructor: Creates an instance of the object.- Parameters:
instanceName
- specifies the instance name.i2cAddress
- specifies the I2C address of the device.addressIs7Bit
- specifies true if the I2C address is a 7-bit address, false if it is 8-bit.
-
FtcZXDistanceSensor
Constructor: Creates an instance of the object.- Parameters:
instanceName
- specifies the instance name.
-
-
Method Details
-
getStatus
public int getStatus()This method returns the data from the Status register.- Returns:
- status register data.
-
getGesture
This method returns the detected gesture type.- Returns:
- detected gesture type.
-
getGestureSpeed
This method returns the data from the Gesture Speed register.- Returns:
- gesture speed.
-
getX
This method returns the data from teh X Position register.- Returns:
- X position.
-
getZ
This method returns the data from teh Z Position register.- Returns:
- Z position.
-
getLeftRangingData
This method returns the data from the Left Ranging Data register.- Returns:
- left ranging data.
-
getRightRangingData
This method returns the data from the Right Ranging Data register.- Returns:
- right ranging data.
-
getRegMapVersion
public int getRegMapVersion()This method returns the data from the Register Map Version register.- Returns:
- register map version.
-
getModelVersion
public int getModelVersion()This method returns the data from the Model Version register.- Returns:
- model version.
-
getRawData
This method returns the sensor data of the specified index.- Specified by:
getRawData
in interfaceTrcSensor.DataSource<FtcZXDistanceSensor.DataType>
- Parameters:
index
- specifies the data index.dataType
- specifies the data type.- Returns:
- sensor data of the specified index and type.
-