===== Line Tracking - Packet Reference ===== Check out the [[wiki:v2:line_api|Line tracking API]] for more details. ==== getMainFeatures(features, wait) ==== === Request: === ^Bit ^Description ^Value(s) ^ |0 - 1 |16-bit sync | 174, 193 (0xc1ae) | |2 |Type of packet |48 | |3 |Length of payload |2 | |4 |Request type | 0=main features, 1=all features | |5 |Features (bitmap) | 7=vectors, intersections, barcodes | === Response: === ^Byte ^Description ^Value(s) ^ |0 - 1 | 16-bit sync | 175, 193 (0xc1af) | |2 |Type of packet |49 | |3 |Length of payload |(varies) | |4 - 5 |16-bit checksum | sum of payload bytes | |6 | Feature-type | 1=Vector, 2=Intersection, 4=Barcode | |7 | Feature-length | (varies) | |8 - 8+feature-length | Feature-data | (varies) | | | Next feature-type (optional) | (varies) | | | Next feature-length (optional) | (varies) | | | Next feature-data (optinal) | (varies) | | | Next feature-type (optional) | (varies) | | | Next feature-length (optional) | (varies) | | | Next feature-data (optinal) | (varies) | Note, this response can have up to three different feature sections, one for vectors (if vector(s) exist), one for intersections (if intersection(s) exist) and one for barcodes (if barcode(s) exist) in the image. Each feature section begins with a feature-type. The feature-length is next, which indicates how many bytes are in the feature-data. The feature-data is last, which has the data associated with the feature. Sometimes the feature-data section will have more than one of the given feature type, for example, there may be three barcodes, in which case the three barcodes will be concatenated in the feature-data without any bytes between them. For the specific feature data types and composition, please consult the [[https://github.com/charmedlabs/pixy2/blob/master/src/host/arduino/libraries/Pixy2/Pixy2Line.h|Pixy2Line.h]] file. ==== setMode(mode) ==== === Request: === ^Bit ^Description ^Value(s) ^ |0 - 1 |16-bit sync | 174, 193 (0xc1ae) | |2 |Type of packet |54 | |3 |Length of payload |1 | |4 |Mode | (varies) | === Response: === ^Byte ^Description ^Value(s) ^ |0 - 1 | 16-bit sync | 175, 193 (0xc1af) | |2 |Type of packet |1 | |3 |Length of payload |4 | |4 - 5 |16-bit checksum | sum of payload bytes | |6 - 9 | Response/acknowledge | (varies) | ==== setNextTurn(angle) ==== === Request: === ^Bit ^Description ^Value(s) ^ |0 - 1 |16-bit sync | 174, 193 (0xc1ae) | |2 |Type of packet |58 | |3 |Length of payload |2 | |4 - 5 |16-bit angle | (varies) | === Response: === ^Byte ^Description ^Value(s) ^ |0 - 1 | 16-bit sync | 175, 193 (0xc1af) | |2 |Type of packet |1 | |3 |Length of payload |4 | |4 - 5 |16-bit checksum | sum of payload bytes | |6 - 9 | Response/acknowledge | (varies) | ==== setDefaultTurn(angle) ==== === Request: === ^Bit ^Description ^Value(s) ^ |0 - 1 |16-bit sync | 174, 193 (0xc1ae) | |2 |Type of packet |60 | |3 |Length of payload |2 | |4 - 5 |16-bit angle | (varies) | === Response: === ^Byte ^Description ^Value(s) ^ |0 - 1 | 16-bit sync | 175, 193 (0xc1af) | |2 |Type of packet |1 | |3 |Length of payload |4 | |4 - 5 |16-bit checksum | sum of payload bytes | |6 - 9 | Response/acknowledge | (varies) | ==== setVector(angle) ==== === Request: === ^Bit ^Description ^Value(s) ^ |0 - 1 |16-bit sync | 174, 193 (0xc1ae) | |2 |Type of packet |56 | |3 |Length of payload |1 | |4 |vector index | (varies) | === Response: === ^Byte ^Description ^Value(s) ^ |0 - 1 | 16-bit sync | 175, 193 (0xc1af) | |2 |Type of packet |1 | |3 |Length of payload |4 | |4 - 5 |16-bit checksum | sum of payload bytes | |6 - 9 | Response/acknowledge | (varies) | ==== reverseVector(angle) ==== === Request: === ^Bit ^Description ^Value(s) ^ |0 - 1 |16-bit sync | 174, 193 (0xc1ae) | |2 |Type of packet |62 | |3 |Length of payload |0 | === Response: === ^Byte ^Description ^Value(s) ^ |0 - 1 | 16-bit sync | 175, 193 (0xc1af) | |2 |Type of packet |1 | |3 |Length of payload |4 | |4 - 5 |16-bit checksum | sum of payload bytes | |6 - 9 | Response/acknowledge | (varies) |