Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Diff: pixy2.h
- Revision:
- 17:4f901906d86c
- Parent:
- 16:f84b0f970c3e
- Child:
- 18:190e3987e274
--- a/pixy2.h Tue Mar 12 18:02:48 2019 +0000 +++ b/pixy2.h Tue Mar 12 18:31:22 2019 +0000 @@ -439,8 +439,8 @@ * It will override Pixy2's own setting of the RGB LED. * @note Frame Documentation : https://docs.pixycam.com/wiki/doku.php?id=wiki:v2:porting_guide * @note Function Documentation : https://docs.pixycam.com/wiki/doku.php?id=wiki:v2:general_api - * @param upper (Byte - passed by value) : binary, zero or non-zero - * @param lower (Byte - passed by value) : binary, zero or non-zero + * @param upper (Byte - passed by value) : switch on or off the upper lamps (boolean : zero or non-zero) + * @param lower (Byte - passed by value) : switch on or off the lower lamp (boolean : zero or non-zero) * @return T_pixy2ErrorCode : error code. */ T_pixy2ErrorCode pixy2_setLamp (Byte upper, Byte lower); @@ -523,14 +523,57 @@ * @note Function Documentation : https://docs.pixycam.com/wiki/doku.php?id=wiki:v2:pixy2_full_api#plugin_include__wiki__v2__line_api * @param angle (sWord - passed by value) : angle closest to the next turn (in degree, between -180 and 180) * @return T_pixy2ErrorCode : error code. - * @note Turn angles are specified in degrees, with 0 being straight ahead, left being 90 and right being -90 (for example), although any valid angle value can be used. Valid angles are between -180 and 180. + * @note Turn angles are specified in degrees, with 0 being straight ahead, left being 90 and right being -90, although any valid angle value can be used. * @note setNextTurn() will remember the turn angle you give it, and execute it at the next intersection. The line tracking algorithm will then go back to the default turn angle for subsequent intersections. * @note Upon encountering an intersection, the line tracking algorithm will find the path in the intersection that matches the turn angle most closely. */ T_pixy2ErrorCode pixy2_setNexTurn (sWord angle); + +/** + * This function tells the line tracking algorithm which path to choose by default upon encountering an intersection. + * @note General description : https://docs.pixycam.com/wiki/doku.php?id=wiki:v2:line_tracking + * @note Frame Documentation : https://docs.pixycam.com/wiki/doku.php?id=wiki:v2:porting_guide + * @note Function Documentation : https://docs.pixycam.com/wiki/doku.php?id=wiki:v2:pixy2_full_api#plugin_include__wiki__v2__line_api + * @param angle (sWord - passed by value) : angle closest to the default turn (in degree, between -180 and 180) + * @return T_pixy2ErrorCode : error code. + * @note Turn angles are specified in degrees, with 0 being straight ahead, left being 90 and right being -90, although any valid angle value can be used. + * @note The line tracking algorithm will find the path in the intersection that matches the default turn angle most closely. + * @note A call to setNextTurn() will supercede the default turn angle for the next intersection. + */ T_pixy2ErrorCode pixy2_setDefaultTurn (sWord angle); + +/** + * This function tells witch vector the tracking algorithm must choose as default route upon encountering an intersection. + * @note General description : https://docs.pixycam.com/wiki/doku.php?id=wiki:v2:line_tracking + * @note Frame Documentation : https://docs.pixycam.com/wiki/doku.php?id=wiki:v2:porting_guide + * @note Function Documentation : https://docs.pixycam.com/wiki/doku.php?id=wiki:v2:pixy2_full_api#plugin_include__wiki__v2__line_api + * @param index (Byte - passed by value) : index of the line to follow + * @return T_pixy2ErrorCode : error code. + * @note If the LINE_MODE_MANUAL_SELECT_VECTOR mode bit is set, the line tracking algorithm will no longer choose the Vector automatically. Instead, setVector() will set the Vector by providing the index of the line. + */ T_pixy2ErrorCode pixy2_setVector (Byte vectorIndex); + +/** + * This function reverse the head and the tail of vectors + * @note General description : https://docs.pixycam.com/wiki/doku.php?id=wiki:v2:line_tracking + * @note Frame Documentation : https://docs.pixycam.com/wiki/doku.php?id=wiki:v2:porting_guide + * @note Function Documentation : https://docs.pixycam.com/wiki/doku.php?id=wiki:v2:pixy2_full_api#plugin_include__wiki__v2__line_api + * @return T_pixy2ErrorCode : error code. + * @note The Vector has a direction. It normally points up, from the bottom of the camera frame to the top of the camera frame for a forward-moving robot. Calling reverseVector() will invert the vector. This will typically cause your robot to back-up and change directions. + */ T_pixy2ErrorCode pixy2_ReverseVector (void); + +/** + * This function returns the average RGB components of a square of 5x5 pixel centered on the given pixel coordinate + * @note General description : https://docs.pixycam.com/wiki/doku.php?id=wiki:v2:video + * @note Frame Documentation : https://docs.pixycam.com/wiki/doku.php?id=wiki:v2:porting_guide + * @note Function Documentation : https://docs.pixycam.com/wiki/doku.php?id=wiki:v2:video_api + * @param x (Word - passed by value) : X coordinate of the center of de 5x5 pixel square (in pixel, between 0 and 315) + * @param y (Word - passed by value) : Y coordinate of the center of de 5x5 pixel square (in pixel, between 0 and 207) + * @param saturate (Byte - passed by value) : scale the 3 component so that the highest of RGB component is set to 255 (boolean : zero or non-zero) + * @param pixel (T_pixy2Pixel - passed by reference) : RGB pixel. + * @return T_pixy2ErrorCode : error code. + */ T_pixy2ErrorCode pixy2_getRGB (Word x, Word y, Byte saturate, T_pixy2Pixel *pixel); // Variables globales Publiques