Class FrcPixyCam2

java.lang.Object
trclib.archive.TrcPixyCam2
frclib.archive.FrcPixyCam2

public class FrcPixyCam2 extends TrcPixyCam2
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.
  • 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

      public FrcPixyCam2(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.
    • FrcPixyCam2

      public FrcPixyCam2(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.
    • FrcPixyCam2

      public FrcPixyCam2(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.
    • 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

      public FrcPixyCam2(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.
    • FrcPixyCam2

      public FrcPixyCam2(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.
    • syncReadResponse

      public byte[] syncReadResponse()
      This method issues an asynchronous read of the specified number of bytes from the device.
      Specified by:
      syncReadResponse in class TrcPixyCam2
    • syncWriteRequest

      public void syncWriteRequest(byte[] data)
      This method writes the data buffer to the device asynchronously.
      Specified by:
      syncWriteRequest in class TrcPixyCam2
      Parameters:
      data - specifies the data buffer.