EvoHuskyLens#
-
class EvoHuskyLens#
A class for interfacing with the HuskyLens AI vision sensor using I2C.
Initialisation & Setup
-
inline EvoHuskyLens::EvoHuskyLens(I2CChannel channel)#
Constructor for EvoHuskyLens.
- Parameters:
channel – The I2C channel used to communicate with the HuskyLens.
-
bool EvoHuskyLens::begin()#
Initializes the HuskyLens sensor. This method sets up the HuskyLens for communication over I2C. It must be called before any other methods to ensure the HuskyLens is ready for use. Default mode is set to ALGORITHM_COLOR_RECOGNITION.
- Returns:
True if the HuskyLens was successfully initialized, false otherwise.
-
void EvoHuskyLens::setMode(protocolAlgorithm algorithmType)#
Sets the operating mode (algorithm) of the HuskyLens.
The HuskyLens supports multiple AI algorithms for different types of object recognition and tracking:
ALGORITHM_FACE_RECOGNITION: Recognizes and tracks human faces.ALGORITHM_OBJECT_TRACKING: Tracks user-defined objects.ALGORITHM_OBJECT_RECOGNITION: Recognizes multiple learned objects.ALGORITHM_LINE_TRACKING: Detects and follows lines.ALGORITHM_COLOR_RECOGNITION: Recognizes specific colors.ALGORITHM_TAG_RECOGNITION: Recognizes and tracks AprilTags.
- Parameters:
algorithmType – The algorithm mode to set.
Control Functions
-
protocolAlgorithm EvoHuskyLens::getMode()#
Gets the current operating mode of the HuskyLens.
- Returns:
The current algorithm type.
-
String EvoHuskyLens::getModeString()#
Gets the current operating mode of the HuskyLens.
- Returns:
A string representation of the current mode.
ALGORITHM_FACE_RECOGNITION: “FACE REC”ALGORITHM_OBJECT_TRACKING: “OBJ TRK”ALGORITHM_OBJECT_RECOGNITION: “OBJ REC”ALGORITHM_LINE_TRACKING: “LINE TRK”ALGORITHM_COLOR_RECOGNITION: “COLOR REC”ALGORITHM_TAG_RECOGNITION: “TAG REC”Returns
UNKNOWNif the mode is not recognized.
-
bool EvoHuskyLens::requestBlocks(HUSKYLENSResult &result, int16_t ID = 0)#
Requests detected blocks from the HuskyLens.
- Parameters:
result – Reference to a
HUSKYLENSResultstructure to store the results.ID – (Optional) The specific ID of the object to track (default: 0 for all).
- Returns:
True if blocks were successfully retrieved, false otherwise.
-
bool EvoHuskyLens::requestArrows(HUSKYLENSResult &result, int16_t ID = 0)#
Requests detected arrows from the HuskyLens.
- Parameters:
result – Reference to a
HUSKYLENSResultstructure to store the results.ID – (Optional) The specific ID of the arrow to track (default: 0 for all).
- Returns:
True if arrows were successfully retrieved, false otherwise.
-
void EvoHuskyLens::writeString(String text, uint16_t x, uint8_t y)#
Writes a string to the HuskyLens display.
- Parameters:
text – The text to display.
x – The x-coordinate position.
y – The y-coordinate position.
-
void EvoHuskyLens::clearScreen()#
Clears the HuskyLens display screen.
-
void EvoHuskyLens::printResult(HUSKYLENSResult result)#
Prints the result of an object or arrow detected by HuskyLens.
- Parameters:
result – The detection result to print.