Class Pixy2Line
- java.lang.Object
-
- io.github.pseudoresonance.pixy2api.Pixy2Line
-
public class Pixy2Line extends java.lang.Object
Java Port of Pixy2 Arduino Library Defines line tracker for Pixy2 https://github.com/PseudoResonance/Pixy2JavaAPI
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
Pixy2Line.Barcode
static class
Pixy2Line.Intersection
static class
Pixy2Line.IntersectionLine
static class
Pixy2Line.Vector
-
Field Summary
Fields Modifier and Type Field Description static byte
LINE_ALL_FEATURES
static byte
LINE_BARCODE
static byte
LINE_FLAG_INTERSECTION_PRESENT
static byte
LINE_FLAG_INVALID
static byte
LINE_GET_ALL_FEATURES
static byte
LINE_GET_MAIN_FEATURES
static byte
LINE_INTERSECTION
static byte
LINE_MAX_INTERSECTION_LINES
static byte
LINE_MODE_MANUAL_SELECT_VECTOR
static byte
LINE_MODE_TURN_DELAYED
static byte
LINE_MODE_WHITE_LINE
static byte
LINE_REQUEST_GET_FEATURES
static byte
LINE_REQUEST_REVERSE_VECTOR
static byte
LINE_REQUEST_SET_DEFAULT_TURN_ANGLE
static byte
LINE_REQUEST_SET_MODE
static byte
LINE_REQUEST_SET_NEXT_TURN_ANGLE
static byte
LINE_REQUEST_SET_VECTOR
static byte
LINE_RESPONSE_GET_FEATURES
static byte
LINE_VECTOR
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description byte
getAllFeatures()
Gets all features from Pixy2byte
getAllFeatures(byte features)
Gets all features from Pixy2byte
getAllFeatures(byte features, boolean wait)
Gets all features from Pixy2Pixy2Line.Barcode[]
getBarcodeCache()
Gets detected barcodes from cachePixy2Line.Intersection[]
getIntersectionCache()
Gets detected intersections from cachebyte
getMainFeatures()
Gets the main features from the Pixy2.byte
getMainFeatures(byte features)
Gets the main features from the Pixy2.byte
getMainFeatures(byte features, boolean wait)
Gets the main features from the Pixy2.Pixy2Line.Vector[]
getVectorCache()
Gets detected lines from cachebyte
reverseVector()
Requests to invert vectorbyte
setDefaultTurn(short angle)
Sets default angle to turn to at an intersectionbyte
setMode(int mode)
Sets Pixy2 line tracking modebyte
setNextTurn(short angle)
Sets turn angle to use for next intersectionbyte
setVector(int index)
Choose vector to track manually
-
-
-
Field Detail
-
LINE_REQUEST_GET_FEATURES
public static final byte LINE_REQUEST_GET_FEATURES
- See Also:
- Constant Field Values
-
LINE_RESPONSE_GET_FEATURES
public static final byte LINE_RESPONSE_GET_FEATURES
- See Also:
- Constant Field Values
-
LINE_REQUEST_SET_MODE
public static final byte LINE_REQUEST_SET_MODE
- See Also:
- Constant Field Values
-
LINE_REQUEST_SET_VECTOR
public static final byte LINE_REQUEST_SET_VECTOR
- See Also:
- Constant Field Values
-
LINE_REQUEST_SET_NEXT_TURN_ANGLE
public static final byte LINE_REQUEST_SET_NEXT_TURN_ANGLE
- See Also:
- Constant Field Values
-
LINE_REQUEST_SET_DEFAULT_TURN_ANGLE
public static final byte LINE_REQUEST_SET_DEFAULT_TURN_ANGLE
- See Also:
- Constant Field Values
-
LINE_REQUEST_REVERSE_VECTOR
public static final byte LINE_REQUEST_REVERSE_VECTOR
- See Also:
- Constant Field Values
-
LINE_GET_MAIN_FEATURES
public static final byte LINE_GET_MAIN_FEATURES
- See Also:
- Constant Field Values
-
LINE_GET_ALL_FEATURES
public static final byte LINE_GET_ALL_FEATURES
- See Also:
- Constant Field Values
-
LINE_MODE_TURN_DELAYED
public static final byte LINE_MODE_TURN_DELAYED
- See Also:
- Constant Field Values
-
LINE_MODE_MANUAL_SELECT_VECTOR
public static final byte LINE_MODE_MANUAL_SELECT_VECTOR
- See Also:
- Constant Field Values
-
LINE_MODE_WHITE_LINE
public static final byte LINE_MODE_WHITE_LINE
- See Also:
- Constant Field Values
-
LINE_VECTOR
public static final byte LINE_VECTOR
- See Also:
- Constant Field Values
-
LINE_INTERSECTION
public static final byte LINE_INTERSECTION
- See Also:
- Constant Field Values
-
LINE_BARCODE
public static final byte LINE_BARCODE
- See Also:
- Constant Field Values
-
LINE_ALL_FEATURES
public static final byte LINE_ALL_FEATURES
- See Also:
- Constant Field Values
-
LINE_FLAG_INVALID
public static final byte LINE_FLAG_INVALID
- See Also:
- Constant Field Values
-
LINE_FLAG_INTERSECTION_PRESENT
public static final byte LINE_FLAG_INTERSECTION_PRESENT
- See Also:
- Constant Field Values
-
LINE_MAX_INTERSECTION_LINES
public static final byte LINE_MAX_INTERSECTION_LINES
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
Pixy2Line
protected Pixy2Line(Pixy2 pixy)
Constructs Pixy2 Line Tracker- Parameters:
pixy
- Pixy2 instance
-
-
Method Detail
-
getAllFeatures
public byte getAllFeatures()
Gets all features from Pixy2
Defaults to getting all available features and waiting for a response
Returned data should be retrieved from the cache with
getVectorCache()
,getIntersectionCache()
orgetBarcodeCache()
- Returns:
- Pixy2 error code
-
getMainFeatures
public byte getMainFeatures()
Gets the main features from the Pixy2. This is a more constrained line tracking algorithm.
Defaults to getting all available features and waiting for a response
Returned data should be retrieved from the cache with
getVectorCache()
,getIntersectionCache()
orgetBarcodeCache()
- Returns:
- Pixy2 error code
-
getAllFeatures
public byte getAllFeatures(byte features)
Gets all features from Pixy2
Defaults to waiting for a response
Returned data should be retrieved from the cache with
getVectorCache()
,getIntersectionCache()
orgetBarcodeCache()
- Parameters:
features
- Features to get- Returns:
- Pixy2 error code
-
getMainFeatures
public byte getMainFeatures(byte features)
Gets the main features from the Pixy2. This is a more constrained line tracking algorithm.
Defaults to waiting for a response
Returned data should be retrieved from the cache with
getVectorCache()
,getIntersectionCache()
orgetBarcodeCache()
- Parameters:
features
- Features to get- Returns:
- Pixy2 error code
-
getAllFeatures
public byte getAllFeatures(byte features, boolean wait)
Gets all features from Pixy2
Returned data should be retrieved from the cache with
getVectorCache()
,getIntersectionCache()
orgetBarcodeCache()
- Parameters:
features
- Features to getwait
- Wait for response- Returns:
- Pixy2 error code
-
getMainFeatures
public byte getMainFeatures(byte features, boolean wait)
Gets the main features from the Pixy2. This is a more constrained line tracking algorithm.
Returned data should be retrieved from the cache with
getVectorCache()
,getIntersectionCache()
orgetBarcodeCache()
- Parameters:
features
- Features to getwait
- Wait for response- Returns:
- Pixy2 error code
-
getVectorCache
public Pixy2Line.Vector[] getVectorCache()
Gets detected lines from cache
getFeatures(byte, byte, boolean)
must be executed first to get the data actual from Pixy2- Returns:
- Pixy2 Lines
-
getIntersectionCache
public Pixy2Line.Intersection[] getIntersectionCache()
Gets detected intersections from cache
getFeatures(byte, byte, boolean)
must be executed first to get the data actual from Pixy2- Returns:
- Pixy2 Intersectionss
-
getBarcodeCache
public Pixy2Line.Barcode[] getBarcodeCache()
Gets detected barcodes from cache
getFeatures(byte, byte, boolean)
must be executed first to get the data actual from Pixy2- Returns:
- Pixy2 Barcodes
-
setMode
public byte setMode(int mode)
Sets Pixy2 line tracking mode- Parameters:
mode
- Pixy2 line tracking mode- Returns:
- Pixy2 error code
-
setNextTurn
public byte setNextTurn(short angle)
Sets turn angle to use for next intersection- Parameters:
angle
- Turn angle- Returns:
- Pixy2 error code
-
setDefaultTurn
public byte setDefaultTurn(short angle)
Sets default angle to turn to at an intersection- Parameters:
angle
- Turn angle- Returns:
- Pixy2 error code
-
setVector
public byte setVector(int index)
Choose vector to track manually- Parameters:
index
- Index of vector- Returns:
- Pixy2 error code
-
reverseVector
public byte reverseVector()
Requests to invert vector- Returns:
- Pixy2 error code
-
-