Package trclib.archive
Class TrcPixyCam2
java.lang.Object
trclib.archive.TrcPixyCam2
- Direct Known Subclasses:
FrcPixyCam2
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.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionclass
class
This class implements the detected object block.class
class
class
class
class
class
class
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final String
static final byte
static final byte
static final byte
static final byte
static final byte
static final byte
static final byte
static final byte
static final byte
static final byte
static final byte
static final byte
static final byte
static final byte
static final byte
static final byte
static final byte
static final byte
static final byte
protected final TrcDbgTrace
-
Constructor Summary
ConstructorsConstructorDescriptionTrcPixyCam2
(String instanceName) Constructor: Create an instance of the object. -
Method Summary
Modifier and TypeMethodDescriptiongetAllFeatures
(byte featuresMap) getBlocks
(byte sigMap, byte maxBlocks) This method sends a request to get the detected object blocks.getFeatures
(byte requestType, byte featuresMap) This method sends a request to get the detected features.byte
This method returns the firmware type info.int
This method returns the firmware version info.int
getFPS()
This method sends a request to get the camera frame rate.int
This method returns the hardware version info.getMainFeatures
(byte featuresMap) int
This method returns the resolution height of the device.int
This method returns the resolution width of the device.int
getRGB
(int x, int y, byte satFlag) int
int
setCameraBrightness
(byte brightness) This method sends a request to set the camera brightness.int
setDefaultTurn
(short angle) This method sends a request to set the default turn angle.int
setLamp
(boolean upper, boolean lower) This method sends a request to turn on/off the lamp LEDs.int
setLED
(byte red, byte green, byte blue) This method sends a request to set the LED color.int
setMode
(byte mode) This method sends a request to set the camera mode.int
setNextTurn
(short angle) This method sends a request to set the next turn angle.int
setServos
(int panValue, int tiltValue) This method sends a request to set the pan and tilt value of the gimbal servos.int
setVector
(byte index) abstract byte[]
This method issues a synchronous read of the request response.abstract void
syncWriteRequest
(byte[] data) This method writes the request data to the device synchronously.toString()
This method returns the instance name.
-
Field Details
-
PIXY2_FEATURE_TYPE_MAIN
public static final byte PIXY2_FEATURE_TYPE_MAIN- See Also:
-
PIXY2_FEATURE_TYPE_ALL
public static final byte PIXY2_FEATURE_TYPE_ALL- See Also:
-
PIXY2_FEATURES_VECTOR
public static final byte PIXY2_FEATURES_VECTOR- See Also:
-
PIXY2_FEATURES_INTERSECTION
public static final byte PIXY2_FEATURES_INTERSECTION- See Also:
-
PIXY2_FEATURES_BARCODE
public static final byte PIXY2_FEATURES_BARCODE- See Also:
-
PIXY2_FEATURES_ALL
public static final byte PIXY2_FEATURES_ALL- See Also:
-
PIXY2_BLOCKS_SIG_1
public static final byte PIXY2_BLOCKS_SIG_1- See Also:
-
PIXY2_BLOCKS_SIG_2
public static final byte PIXY2_BLOCKS_SIG_2- See Also:
-
PIXY2_BLOCKS_SIG_3
public static final byte PIXY2_BLOCKS_SIG_3- See Also:
-
PIXY2_BLOCKS_SIG_4
public static final byte PIXY2_BLOCKS_SIG_4- See Also:
-
PIXY2_BLOCKS_SIG_5
public static final byte PIXY2_BLOCKS_SIG_5- See Also:
-
PIXY2_BLOCKS_SIG_6
public static final byte PIXY2_BLOCKS_SIG_6- See Also:
-
PIXY2_BLOCKS_SIG_7
public static final byte PIXY2_BLOCKS_SIG_7- See Also:
-
PIXY2_BLOCKS_SIG_8
public static final byte PIXY2_BLOCKS_SIG_8- See Also:
-
PIXY2_BLOCKS_ALL_SIG
public static final byte PIXY2_BLOCKS_ALL_SIG- See Also:
-
PIXY2_MAX_BLOCKS_ALL
public static final byte PIXY2_MAX_BLOCKS_ALL- See Also:
-
PIXY2_LINE_FLAG_INVALID
public static final byte PIXY2_LINE_FLAG_INVALID- See Also:
-
PIXY2_LINE_FLAG_INTERSECTION_PRESENT
public static final byte PIXY2_LINE_FLAG_INTERSECTION_PRESENT- See Also:
-
PIXY2_SAT_FLAG_SATURATE
public static final byte PIXY2_SAT_FLAG_SATURATE- See Also:
-
tracer
-
instanceName
-
-
Constructor Details
-
TrcPixyCam2
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
This method returns the 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
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
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
-
getAllFeatures
-
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)
-