Package frclib.archive
Class FrcPixyCam2
java.lang.Object
trclib.archive.TrcPixyCam2
frclib.archive.FrcPixyCam2
This class implements a platform dependent pixy camera 2 that is either connected to an I2C bus, SPI or a
Serial Port. It provides access to the last detected objects reported by the pixy camera synchronously.
-
Nested Class Summary
Nested classes/interfaces inherited from class trclib.archive.TrcPixyCam2
TrcPixyCam2.Barcode, TrcPixyCam2.Block, TrcPixyCam2.Feature, TrcPixyCam2.FeatureBarcodes, TrcPixyCam2.FeatureIntersections, TrcPixyCam2.FeatureVectors, TrcPixyCam2.Intersection, TrcPixyCam2.IntersectionLine, TrcPixyCam2.Vector
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final int
static final int
static final int
static final edu.wpi.first.wpilibj.I2C.Port
static final edu.wpi.first.wpilibj.SerialPort.Parity
static final edu.wpi.first.wpilibj.SerialPort.Port
static final edu.wpi.first.wpilibj.SerialPort.StopBits
Fields inherited from class trclib.archive.TrcPixyCam2
instanceName, PIXY2_BLOCKS_ALL_SIG, PIXY2_BLOCKS_SIG_1, PIXY2_BLOCKS_SIG_2, PIXY2_BLOCKS_SIG_3, PIXY2_BLOCKS_SIG_4, PIXY2_BLOCKS_SIG_5, PIXY2_BLOCKS_SIG_6, PIXY2_BLOCKS_SIG_7, PIXY2_BLOCKS_SIG_8, PIXY2_FEATURE_TYPE_ALL, PIXY2_FEATURE_TYPE_MAIN, PIXY2_FEATURES_ALL, PIXY2_FEATURES_BARCODE, PIXY2_FEATURES_INTERSECTION, PIXY2_FEATURES_VECTOR, PIXY2_LINE_FLAG_INTERSECTION_PRESENT, PIXY2_LINE_FLAG_INVALID, PIXY2_MAX_BLOCKS_ALL, PIXY2_SAT_FLAG_SATURATE, tracer
-
Constructor Summary
ConstructorsConstructorDescriptionFrcPixyCam2
(String instanceName, edu.wpi.first.wpilibj.I2C.Port port) Constructor: Create an instance of the object.FrcPixyCam2
(String instanceName, edu.wpi.first.wpilibj.I2C.Port port, int devAddress) Constructor: Create an instance of the object.FrcPixyCam2
(String instanceName, edu.wpi.first.wpilibj.SerialPort.Port port) Constructor: Create an instance of the object.FrcPixyCam2
(String instanceName, edu.wpi.first.wpilibj.SerialPort.Port port, int baudRate) Constructor: Create an instance of the object.FrcPixyCam2
(String instanceName, edu.wpi.first.wpilibj.SerialPort.Port port, int baudRate, int dataBits, edu.wpi.first.wpilibj.SerialPort.Parity parity, edu.wpi.first.wpilibj.SerialPort.StopBits stopBits) Constructor: Create an instance of the object.FrcPixyCam2
(String instanceName, edu.wpi.first.wpilibj.SPI.Port port) Constructor: Create an instance of the object. -
Method Summary
Modifier and TypeMethodDescriptionboolean
This method checks if the pixy camera is enabled.void
setEnabled
(boolean enabled) This method enables/disables the pixy camera.byte[]
This method issues an asynchronous read of the specified number of bytes from the device.void
syncWriteRequest
(byte[] data) This method writes the data buffer to the device asynchronously.Methods inherited from class trclib.archive.TrcPixyCam2
getAllFeatures, getBlocks, getFeatures, getFirmwareType, getFirmwareVersion, getFPS, getHardwareVersion, getMainFeatures, getResolutionHeight, getResolutionWidth, getRGB, reverseVector, setCameraBrightness, setDefaultTurn, setLamp, setLED, setMode, setNextTurn, setServos, setVector, toString
-
Field Details
-
DEF_I2C_PORT
public static final edu.wpi.first.wpilibj.I2C.Port DEF_I2C_PORT -
DEF_I2C_ADDRESS
public static final int DEF_I2C_ADDRESS- See Also:
-
DEF_SERIAL_PORT
public static final edu.wpi.first.wpilibj.SerialPort.Port DEF_SERIAL_PORT -
DEF_BAUD_RATE
public static final int DEF_BAUD_RATE- See Also:
-
DEF_DATA_BITS
public static final int DEF_DATA_BITS- See Also:
-
DEF_PARITY
public static final edu.wpi.first.wpilibj.SerialPort.Parity DEF_PARITY -
DEF_STOP_BITS
public static final edu.wpi.first.wpilibj.SerialPort.StopBits DEF_STOP_BITS
-
-
Constructor Details
-
FrcPixyCam2
Constructor: Create an instance of the object.- Parameters:
instanceName
- specifies the instance name.port
- specifies the SPI port on the RoboRIO.
-
FrcPixyCam2
Constructor: Create an instance of the object.- Parameters:
instanceName
- specifies the instance name.port
- specifies the I2C port on the RoboRIO.devAddress
- specifies the I2C address of the device.
-
FrcPixyCam2
Constructor: Create an instance of the object.- Parameters:
instanceName
- specifies the instance name.port
- specifies the I2C port on the RoboRIO.
-
FrcPixyCam2
public FrcPixyCam2(String instanceName, edu.wpi.first.wpilibj.SerialPort.Port port, int baudRate, int dataBits, edu.wpi.first.wpilibj.SerialPort.Parity parity, edu.wpi.first.wpilibj.SerialPort.StopBits stopBits) Constructor: Create an instance of the object.- Parameters:
instanceName
- specifies the instance name.port
- specifies the serial port on the RoboRIO.baudRate
- specifies the baud rate.dataBits
- specifies the number of data bits.parity
- specifies the parity type.stopBits
- specifies the number of stop bits.
-
FrcPixyCam2
Constructor: Create an instance of the object.- Parameters:
instanceName
- specifies the instance name.port
- specifies the serial port on the RoboRIO.baudRate
- specifies the baud rate.
-
FrcPixyCam2
Constructor: Create an instance of the object.- Parameters:
instanceName
- specifies the instance name.port
- specifies the serial port on the RoboRIO.
-
-
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.
-
syncReadResponse
public byte[] syncReadResponse()This method issues an asynchronous read of the specified number of bytes from the device.- Specified by:
syncReadResponse
in classTrcPixyCam2
-
syncWriteRequest
public void syncWriteRequest(byte[] data) This method writes the data buffer to the device asynchronously.- Specified by:
syncWriteRequest
in classTrcPixyCam2
- Parameters:
data
- specifies the data buffer.
-