Class FrcPixyCam1

java.lang.Object
trclib.archive.TrcPixyCam1
frclib.archive.FrcPixyCam1

public class FrcPixyCam1 extends TrcPixyCam1
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.
  • 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

      public FrcPixyCam1(String instanceName, edu.wpi.first.wpilibj.SPI.Port port)
      Constructor: Create an instance of the object.
      Parameters:
      instanceName - specifies the instance name.
      port - specifies the SPI port on the RoboRIO.
    • FrcPixyCam1

      public FrcPixyCam1(String instanceName, edu.wpi.first.wpilibj.I2C.Port port, int devAddress)
      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

      public FrcPixyCam1(String instanceName, edu.wpi.first.wpilibj.I2C.Port port)
      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

      public FrcPixyCam1(String instanceName, edu.wpi.first.wpilibj.SerialPort.Port port, int baudRate)
      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

      public FrcPixyCam1(String instanceName, edu.wpi.first.wpilibj.SerialPort.Port port)
      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

      public void asyncReadData(TrcPixyCam1.RequestId requestId, int length)
      This method issues an asynchronous read of the specified number of bytes from the device.
      Specified by:
      asyncReadData in class TrcPixyCam1
      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

      public void asyncWriteData(TrcPixyCam1.RequestId requestId, byte[] data)
      This method writes the data buffer to the device asynchronously.
      Specified by:
      asyncWriteData in class TrcPixyCam1
      Parameters:
      requestId - specifies the ID to identify the request. Can be null if none was provided.
      data - specifies the data buffer.