Package frclib.archive
Class FrcPixyCam1
java.lang.Object
trclib.archive.TrcPixyCam1
frclib.archive.FrcPixyCam1
This class implements a platform dependent pixy camera 1 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 asynchronously.
-
Nested Class Summary
Nested classes/interfaces inherited from class trclib.archive.TrcPixyCam1
TrcPixyCam1.ObjectBlock, TrcPixyCam1.RequestId -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intstatic final intstatic final intstatic final edu.wpi.first.wpilibj.I2C.Portstatic final edu.wpi.first.wpilibj.SerialPort.Paritystatic final edu.wpi.first.wpilibj.SerialPort.Portstatic final edu.wpi.first.wpilibj.SerialPort.StopBitsFields inherited from class trclib.archive.TrcPixyCam1
instanceName -
Constructor Summary
ConstructorsConstructorDescriptionFrcPixyCam1(String instanceName, edu.wpi.first.wpilibj.I2C.Port port) Constructor: Create an instance of the object.FrcPixyCam1(String instanceName, edu.wpi.first.wpilibj.I2C.Port port, int devAddress) Constructor: Create an instance of the object.FrcPixyCam1(String instanceName, edu.wpi.first.wpilibj.SerialPort.Port port) Constructor: Create an instance of the object.FrcPixyCam1(String instanceName, edu.wpi.first.wpilibj.SerialPort.Port port, int baudRate) Constructor: Create an instance of the object.FrcPixyCam1(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.FrcPixyCam1(String instanceName, edu.wpi.first.wpilibj.SPI.Port port) Constructor: Create an instance of the object. -
Method Summary
Modifier and TypeMethodDescriptionvoidasyncReadData(TrcPixyCam1.RequestId requestId, int length) This method issues an asynchronous read of the specified number of bytes from the device.voidasyncWriteData(TrcPixyCam1.RequestId requestId, byte[] data) This method writes the data buffer to the device asynchronously.booleanThis method checks if the pixy camera is enabled.voidsetEnabled(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_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
-
FrcPixyCam1
Constructor: Create an instance of the object.- Parameters:
instanceName- specifies the instance name.port- specifies the SPI port on the RoboRIO.
-
FrcPixyCam1
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.
-
FrcPixyCam1
Constructor: Create an instance of the object.- Parameters:
instanceName- specifies the instance name.port- specifies the I2C port on the RoboRIO.
-
FrcPixyCam1
public FrcPixyCam1(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.
-
FrcPixyCam1
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.
-
FrcPixyCam1
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.
-
asyncReadData
This method issues an asynchronous read of the specified number of bytes from the device.- Specified by:
asyncReadDatain 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:
asyncWriteDatain classTrcPixyCam1- Parameters:
requestId- specifies the ID to identify the request. Can be null if none was provided.data- specifies the data buffer.
-