Class TrcPixyCam2

java.lang.Object
trclib.archive.TrcPixyCam2
Direct Known Subclasses:
FrcPixyCam2

public abstract class TrcPixyCam2 extends Object
This class implements a platform independent pixy camera 2. This class is intended to be extended by a platform dependent pixy class which provides the abstract methods required by this class. This class provides the parser to read and parse the response packets from the pixy camera 2. It also implements pixy camera APIs for all the pixy requests.
  • Field Details

  • Constructor Details

    • TrcPixyCam2

      public TrcPixyCam2(String instanceName)
      Constructor: Create an instance of the object.
      Parameters:
      instanceName - specifies the instance name.
  • Method Details

    • syncWriteRequest

      public abstract void syncWriteRequest(byte[] data)
      This method writes the request data to the device synchronously.
      Parameters:
      data - specifies the request data.
    • syncReadResponse

      public abstract byte[] syncReadResponse()
      This method issues a synchronous read of the request response.
    • toString

      public String toString()
      This method returns the instance name.
      Overrides:
      toString in class Object
      Returns:
      instance name.
    • getHardwareVersion

      public int getHardwareVersion()
      This method returns the hardware version info.
      Returns:
      hardware version info.
    • getFirmwareVersion

      public int getFirmwareVersion()
      This method returns the firmware version info.
      Returns:
      firmware version info.
    • getFirmwareType

      public byte getFirmwareType()
      This method returns the firmware type info.
      Returns:
      firmware type info.
    • getResolutionWidth

      public int getResolutionWidth()
      This method returns the resolution width of the device.
      Returns:
      resolution width.
    • getResolutionHeight

      public int getResolutionHeight()
      This method returns the resolution height of the device.
      Returns:
      resolution height.
    • setCameraBrightness

      public int setCameraBrightness(byte brightness)
      This method sends a request to set the camera brightness.
      Parameters:
      brightness - specifies the brightness value (0-255).
      Returns:
      the result code.
    • setServos

      public int setServos(int panValue, int tiltValue)
      This method sends a request to set the pan and tilt value of the gimbal servos.
      Parameters:
      panValue - specifies the pan servo value (0-511)
      tiltValue - specifies the tilt servo value (0-511).
      Returns:
      the result code.
    • setLED

      public int setLED(byte red, byte green, byte blue)
      This method sends a request to set the LED color.
      Parameters:
      red - specifies the red value.
      green - specifies the green value.
      blue - specifies the blue value.
      Returns:
      the result code.
    • setLamp

      public int setLamp(boolean upper, boolean lower)
      This method sends a request to turn on/off the lamp LEDs.
      Parameters:
      upper - specifies true to turn on the two white LEDs on the top edge, false to turn off.
      lower - specifies true to turn on the lower RGB LED, false to turn off.
      Returns:
      the result code.
    • getFPS

      public int getFPS()
      This method sends a request to get the camera frame rate.
      Returns:
      the camera frame rate in frames per second.
    • getBlocks

      public TrcPixyCam2.Block[] getBlocks(byte sigMap, byte maxBlocks)
      This method sends a request to get the detected object blocks.
      Parameters:
      sigMap - specifies the bitmap of the signatures (i.e. bit 1 set for signature 1, bit 2 set for signature 2 etc).
      maxBlocks - specifies the maximum number of blocks to retrieve.
      Returns:
      an array of detected blocks.
    • getFeatures

      public TrcPixyCam2.Feature[] getFeatures(byte requestType, byte featuresMap)
      This method sends a request to get the detected features.
      Parameters:
      requestType - specifies 0 for the main features and 1 for all features.
      featuresMap - specifies the features bitmap (i.e. 1 for vectors, 2 for intersections and 4 for barcodes).
      Returns:
      an array of detected features.
    • getMainFeatures

      public TrcPixyCam2.Feature[] getMainFeatures(byte featuresMap)
    • getAllFeatures

      public TrcPixyCam2.Feature[] getAllFeatures(byte featuresMap)
    • setMode

      public int setMode(byte mode)
      This method sends a request to set the camera mode.
      Parameters:
      mode - specifies the camera mode.
      Returns:
      the result code.
    • setNextTurn

      public int setNextTurn(short angle)
      This method sends a request to set the next turn angle.
      Parameters:
      angle - specifies the turn angle.
      Returns:
      the result code.
    • setDefaultTurn

      public int setDefaultTurn(short angle)
      This method sends a request to set the default turn angle.
      Parameters:
      angle - specifies the default turn angle.
      Returns:
      the result code.
    • setVector

      public int setVector(byte index)
    • reverseVector

      public int reverseVector()
    • getRGB

      public int getRGB(int x, int y, byte satFlag)