Package ftclib.archive
Class FtcPixyCam1
java.lang.Object
trclib.archive.TrcPixyCam1
ftclib.archive.FtcPixyCam1
This class implements a platform dependent pixy camera 1 that is connected to an I2C bus.
It provides access to the last detected objects reported by the pixy camera asynchronously.
-
Nested Class Summary
Nested classes/interfaces inherited from class trclib.archive.TrcPixyCam1
TrcPixyCam1.ObjectBlock, TrcPixyCam1.RequestId
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final int
private final FtcI2cDevice
private static final boolean
Fields inherited from class trclib.archive.TrcPixyCam1
instanceName
-
Constructor Summary
ConstructorsConstructorDescriptionFtcPixyCam1
(com.qualcomm.robotcore.hardware.HardwareMap hardwareMap, String instanceName, int devAddress, boolean addressIs7Bit) Constructor: Create an instance of the object.FtcPixyCam1
(String instanceName) Constructor: Create an instance of the object.FtcPixyCam1
(String instanceName, int devAddress, boolean addressIs7Bit) Constructor: Create an instance of the object. -
Method Summary
Modifier and TypeMethodDescriptionvoid
asyncReadData
(TrcPixyCam1.RequestId requestId, int length) This method issues an asynchronous read of the specified number of bytes from the device.void
asyncWriteData
(TrcPixyCam1.RequestId requestId, byte[] data) This method writes the data buffer to the device asynchronously.boolean
This method checks if the pixy camera is enabled.void
setEnabled
(boolean enabled) This method enables/disables the pixy camera.Methods inherited from class trclib.archive.TrcPixyCam1
asyncWriteBytes, end, getDetectedObjects, requestHandler, setBrightness, setLED, setPanTilt, start, toString
-
Field Details
-
DEF_I2C_ADDRESS
private static final int DEF_I2C_ADDRESS- See Also:
-
USE_BUFFERED_READ
private static final boolean USE_BUFFERED_READ- See Also:
-
pixyCam
-
-
Constructor Details
-
FtcPixyCam1
public FtcPixyCam1(com.qualcomm.robotcore.hardware.HardwareMap hardwareMap, String instanceName, int devAddress, boolean addressIs7Bit) Constructor: Create an instance of the object.- Parameters:
hardwareMap
- specifies the global hardware map.instanceName
- specifies the instance name.devAddress
- 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.
-
FtcPixyCam1
Constructor: Create an instance of the object.- Parameters:
instanceName
- specifies the instance name.devAddress
- 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.
-
FtcPixyCam1
Constructor: Create an instance of the object.- Parameters:
instanceName
- specifies the instance name.
-
-
Method Details
-
isEnabled
public boolean isEnabled()This method checks if the pixy camera is enabled.- Returns:
- true if pixy camera is enabled, false otherwise.
-
setEnabled
public void setEnabled(boolean enabled) This method enables/disables the pixy camera.- Parameters:
enabled
- specifies true to enable pixy camera, false to disable.
-
asyncReadData
This method issues an asynchronous read of the specified number of bytes from the device.- Specified by:
asyncReadData
in classTrcPixyCam1
- Parameters:
requestId
- specifies the ID to identify the request. Can be null if none was provided.length
- specifies the number of bytes to read.
-
asyncWriteData
This method writes the data buffer to the device asynchronously.- Specified by:
asyncWriteData
in classTrcPixyCam1
- Parameters:
requestId
- specifies the ID to identify the request. Can be null if none was provided.data
- specifies the data buffer.
-