qwiic_huskylens_py  2.0.0-2-ge82220f
Python for SFE qwiic huskylens py
Loading...
Searching...
No Matches
qwiic_huskylens.QwiicHuskylens Class Reference
Inheritance diagram for qwiic_huskylens.QwiicHuskylens:

Classes

class  _Response
 
class  _ReturnInfo
 
class  Arrow
 
class  Block
 

Public Member Functions

def __init__ (self, address=None, i2c_driver=None)
 Constructor. More...
 
def request_knock (self)
 Request a knock from the Huskylens. More...
 
def is_connected (self)
 Determines if this device is connected. More...
 
def begin (self)
 Initializes this device with default parameters. More...
 
def request (self)
 Request all blocks and arrows from the Huskylens. More...
 
def wait_for_objects_of_interest (self)
 Wait for the Huskylens to detect objects of interest (blocks) based on the current algorithm. More...
 
def wait_for_lines_of_interest (self)
 Wait for the Huskylens to detect lines of interest (arrows) based on the current algorithm. More...
 
def get_objects_of_interest (self)
 Get the objects of interest (blocks) detected by the Huskylens based on the current algorithm. More...
 
def get_lines_of_interest (self)
 Get the lines of interest (arrows) detected by the Huskylens based on the current algorithm. More...
 
def request_blocks (self)
 Request all blocks from the Huskylens. More...
 
def request_arrows (self)
 Request all arrows from the Huskylens. More...
 
def request_learned (self)
 Request all learned blocks and arrows from the Huskylens. More...
 
def request_blocks_learned (self)
 Request all learned blocks from the Huskylens. More...
 
def request_arrows_learned (self)
 Request all learned arrows from the Huskylens. More...
 
def request_by_id (self, id)
 Request all blocks or arrows by a given ID from the Huskylens. More...
 
def request_blocks_by_id (self, id)
 Request all blocks by a given ID from the Huskylens. More...
 
def request_arrows_by_id (self, id)
 Request all arrows by a given ID from the Huskylens. More...
 
def request_algorithm (self, algorithm)
 Change the algorithm of the Huskylens and return the result. More...
 
def set_algorithm (self, algorithm)
 Change the algorithm of the Huskylens. More...
 
def request_custom_names (self, id, name)
 Set a custom name for a learned object from the Huskylens. More...
 
def get_name_for_id (self, id)
 Get the name of a learned object by its ID. More...
 
def name_last (self, name)
 Set a custom name for the last learned object from the Huskylens. More...
 
def request_photo (self)
 Save a photo on the Huskylens SD Card. More...
 
def request_send_knowledges (self, fileNum)
 Save the current algorithms model to the SD Card. More...
 
def request_receive_knowledges (self, fileNum)
 Load a model file from the SD Card to the current algorithm. More...
 
def request_custom_text (self, text, x=0, y=0)
 Place a string of text on the Huskylens UI. More...
 
def write_to_screen (self, text, x=0, y=0)
 Place a string of text on the Huskylens UI. More...
 
def request_clear_text (self)
 Clear and delete all custom UI texts from the screen. More...
 
def clear_screen (self)
 Clear and delete all custom UI texts from the screen. More...
 
def request_learn (self, id)
 Learn a current recognized object on screen based on its ID. More...
 
def learn_new (self)
 Learn the current recognized object on screen. More...
 
def learn_same (self)
 Learn the current recognized object on screen with the same ID as the last learn call. More...
 
def request_forget (self)
 Forget learned objects for the current running algorithm. More...
 
def forget (self)
 Forget all learned objects for the current running algorithm. More...
 
def request_save_screenshot (self)
 Save a screenshot of the current UI to the Huskylens SD Card. More...
 
def request_is_pro (self)
 Check what model your Huskylens is. More...
 

Public Attributes

 address
 
 blocks
 
 arrows
 
 nLearned
 
 idToName
 

Static Public Attributes

 device_name = _DEFAULT_NAME
 
 available_addresses = _AVAILABLE_I2C_ADDRESS
 
int kCommandRequest = 0x20
 
int kCommandRequestBlocks = 0x21
 
int kCommandRequestArrows = 0x22
 
int kCommandRequestLearned = 0x23
 
int kCommandRequestBlocksLearned = 0x24
 
int kCommandRequestArrowsLearned = 0x25
 
int kCommandRequestById = 0x26
 
int kCommandRequestBlocksById = 0x27
 
int kCommandRequestArrowsById = 0x28
 
int kCommandReturnInfo = 0x29
 
int kCommandReturnBlock = 0x2A
 
int kCommandReturnArrow = 0x2B
 
int kCommandRequestKnock = 0x2C
 
int kCommandRequestAlgorigthm = 0x2D
 
int kCommandReturnOk = 0x2E
 
int kCommandRequestCustomNames = 0x2F
 
int kCommandRequestPhoto = 0x30
 
int kCommandRequestSendKnowledges = 0x32
 
int kCommandRequestReceiveKnowledges = 0x33
 
int kCommandRequestCustomText = 0x34
 
int kCommandRequestClearText = 0x35
 
int kCommandRequestLearn = 0x36
 
int kCommandRequestForget = 0x37
 
int kCommandRequestSaveScreenshot = 0x39
 
int kCommandRequestIsPro = 0x3B
 
int kCommandReturnIsPro = 0x3B
 
int kCommandRequestFirmwareVersion = 0x3C
 
int kCommandReturnBusy = 0x3D
 
int kCommandReturnNeedPro = 0x3E
 
int kAlgorithmFaceRecognition = 0x00
 
int kAlgorithmObjectTracking = 0x01
 
int kAlgorithmObjectRecognition = 0x02
 
int kAlgorithmLineTracking = 0x03
 
int kAlgorithmColorRecognition = 0x04
 
int kAlgorithmTagRecognition = 0x05
 
int kAlgorithmObjectClassification = 0x06
 

Properties

 connected = property(is_connected)
 

Constructor & Destructor Documentation

◆ __init__()

def qwiic_huskylens.QwiicHuskylens.__init__ (   self,
  address = None,
  i2c_driver = None 
)

Constructor.

Parameters
intaddress: The I2C address to use for the device If not provided, the default address is used
I2CDriveri2c_driver: An existing i2c driver object If not provided, a driver object is created
intnLearned: The number of objects already learned. The Huskylens will assign IDs to learned objects starting from nLearned + 1. It is assumed by the protocol that the IDs are consecutive.

Member Function Documentation

◆ begin()

def qwiic_huskylens.QwiicHuskylens.begin (   self)

Initializes this device with default parameters.

Returns
bool Returns True if successful, otherwise False

◆ clear_screen()

def qwiic_huskylens.QwiicHuskylens.clear_screen (   self)

Clear and delete all custom UI texts from the screen.

◆ forget()

def qwiic_huskylens.QwiicHuskylens.forget (   self)

Forget all learned objects for the current running algorithm.

◆ get_lines_of_interest()

def qwiic_huskylens.QwiicHuskylens.get_lines_of_interest (   self)

Get the lines of interest (arrows) detected by the Huskylens based on the current algorithm.

Returned objects have the following properties:

  • id: The ID of the object
  • xOrigin: The x-coordinate of the origin of the line
  • yOrigin: The y-coordinate of the origin of the line
  • xTarget: The x-coordinate of the target of the line
  • yTarget: The y-coordinate of the target of the line
Returns
list A list of Arrow objects

◆ get_name_for_id()

def qwiic_huskylens.QwiicHuskylens.get_name_for_id (   self,
  id 
)

Get the name of a learned object by its ID.

Note: This will does not query the device and is based on internal program state, so it will not persist across program runs.

Parameters
intid: The ID of the object
Returns
str The name of the object, or None if not found

◆ get_objects_of_interest()

def qwiic_huskylens.QwiicHuskylens.get_objects_of_interest (   self)

Get the objects of interest (blocks) detected by the Huskylens based on the current algorithm.

Returned objects have the following properties:

  • id: The ID of the object
  • xCenter: The x-coordinate of the center of the object
  • yCenter: The y-coordinate of the center of the object
  • width: The width of the object
  • height: The height of the object
Returns
list A list of Block objects

◆ is_connected()

def qwiic_huskylens.QwiicHuskylens.is_connected (   self)

Determines if this device is connected.

Returns
bool True if connected, otherwise False

◆ learn_new()

def qwiic_huskylens.QwiicHuskylens.learn_new (   self)

Learn the current recognized object on screen.

It will be assigned an ID starting from nLearned + 1.

◆ learn_same()

def qwiic_huskylens.QwiicHuskylens.learn_same (   self)

Learn the current recognized object on screen with the same ID as the last learn call.

◆ name_last()

def qwiic_huskylens.QwiicHuskylens.name_last (   self,
  name 
)

Set a custom name for the last learned object from the Huskylens.

Parameters
strname: The name to set

◆ request()

def qwiic_huskylens.QwiicHuskylens.request (   self)

Request all blocks and arrows from the Huskylens.

Will fill self.blocks and self.arrows with the returned information

Returns
bool True if successful, otherwise False

◆ request_algorithm()

def qwiic_huskylens.QwiicHuskylens.request_algorithm (   self,
  algorithm 
)

Change the algorithm of the Huskylens and return the result.

Parameters
intalgorithm: The algorithm to set. See the kAlgorithm constants.
Returns
bool True if successful, otherwise False.

◆ request_arrows()

def qwiic_huskylens.QwiicHuskylens.request_arrows (   self)

Request all arrows from the Huskylens.

Will fill self.arrows with the returned information

Returns
bool True if successful, otherwise False

◆ request_arrows_by_id()

def qwiic_huskylens.QwiicHuskylens.request_arrows_by_id (   self,
  id 
)

Request all arrows by a given ID from the Huskylens.

This will fill self.arrows with the returned information

Parameters
intid: The ID to request

◆ request_arrows_learned()

def qwiic_huskylens.QwiicHuskylens.request_arrows_learned (   self)

Request all learned arrows from the Huskylens.

◆ request_blocks()

def qwiic_huskylens.QwiicHuskylens.request_blocks (   self)

Request all blocks from the Huskylens.

Will fill self.blocks with the returned information

Returns
bool True if successful, otherwise False

◆ request_blocks_by_id()

def qwiic_huskylens.QwiicHuskylens.request_blocks_by_id (   self,
  id 
)

Request all blocks by a given ID from the Huskylens.

This will fill self.blocks with the returned information

Parameters
intid: The ID to request

◆ request_blocks_learned()

def qwiic_huskylens.QwiicHuskylens.request_blocks_learned (   self)

Request all learned blocks from the Huskylens.

◆ request_by_id()

def qwiic_huskylens.QwiicHuskylens.request_by_id (   self,
  id 
)

Request all blocks or arrows by a given ID from the Huskylens.

This will fill self.blocks or self.arrows with the returned information

Parameters
intid: The ID to request

◆ request_clear_text()

def qwiic_huskylens.QwiicHuskylens.request_clear_text (   self)

Clear and delete all custom UI texts from the screen.

◆ request_custom_names()

def qwiic_huskylens.QwiicHuskylens.request_custom_names (   self,
  id,
  name 
)

Set a custom name for a learned object from the Huskylens.

Parameters
intid: The ID of the object
strname: The name to set

◆ request_custom_text()

def qwiic_huskylens.QwiicHuskylens.request_custom_text (   self,
  text,
  x = 0,
  y = 0 
)

Place a string of text on the Huskylens UI.

Parameters
strtext: The text to display
intx: The x-coordinate of the text
inty: The y-coordinate of the text

◆ request_forget()

def qwiic_huskylens.QwiicHuskylens.request_forget (   self)

Forget learned objects for the current running algorithm.

◆ request_is_pro()

def qwiic_huskylens.QwiicHuskylens.request_is_pro (   self)

Check what model your Huskylens is.

Returns
bool True if the Huskylens is a pro model, otherwise False

◆ request_knock()

def qwiic_huskylens.QwiicHuskylens.request_knock (   self)

Request a knock from the Huskylens.

Returns
bool True if successful, otherwise False

◆ request_learn()

def qwiic_huskylens.QwiicHuskylens.request_learn (   self,
  id 
)

Learn a current recognized object on screen based on its ID.

Parameters
intid: The ID to assign to the object

◆ request_learned()

def qwiic_huskylens.QwiicHuskylens.request_learned (   self)

Request all learned blocks and arrows from the Huskylens.

◆ request_photo()

def qwiic_huskylens.QwiicHuskylens.request_photo (   self)

Save a photo on the Huskylens SD Card.

◆ request_receive_knowledges()

def qwiic_huskylens.QwiicHuskylens.request_receive_knowledges (   self,
  fileNum 
)

Load a model file from the SD Card to the current algorithm.

Parameters
intfileNum: The file number to load

◆ request_save_screenshot()

def qwiic_huskylens.QwiicHuskylens.request_save_screenshot (   self)

Save a screenshot of the current UI to the Huskylens SD Card.

◆ request_send_knowledges()

def qwiic_huskylens.QwiicHuskylens.request_send_knowledges (   self,
  fileNum 
)

Save the current algorithms model to the SD Card.

Parameters
intfileNum: The file number to save

◆ set_algorithm()

def qwiic_huskylens.QwiicHuskylens.set_algorithm (   self,
  algorithm 
)

Change the algorithm of the Huskylens.

Parameters
intalgorithm: The algorithm to set. See the kAlgorithm constants.
Returns
bool True if successful, otherwise False.

◆ wait_for_lines_of_interest()

def qwiic_huskylens.QwiicHuskylens.wait_for_lines_of_interest (   self)

Wait for the Huskylens to detect lines of interest (arrows) based on the current algorithm.

◆ wait_for_objects_of_interest()

def qwiic_huskylens.QwiicHuskylens.wait_for_objects_of_interest (   self)

Wait for the Huskylens to detect objects of interest (blocks) based on the current algorithm.

◆ write_to_screen()

def qwiic_huskylens.QwiicHuskylens.write_to_screen (   self,
  text,
  x = 0,
  y = 0 
)

Place a string of text on the Huskylens UI.

Parameters
strtext: The text to display
intx: The x-coordinate of the text
inty: The y-coordinate of the text

Member Data Documentation

◆ address

qwiic_huskylens.QwiicHuskylens.address

◆ arrows

qwiic_huskylens.QwiicHuskylens.arrows

◆ available_addresses

qwiic_huskylens.QwiicHuskylens.available_addresses = _AVAILABLE_I2C_ADDRESS
static

◆ blocks

qwiic_huskylens.QwiicHuskylens.blocks

◆ device_name

qwiic_huskylens.QwiicHuskylens.device_name = _DEFAULT_NAME
static

◆ idToName

qwiic_huskylens.QwiicHuskylens.idToName

◆ kAlgorithmColorRecognition

int qwiic_huskylens.QwiicHuskylens.kAlgorithmColorRecognition = 0x04
static

◆ kAlgorithmFaceRecognition

int qwiic_huskylens.QwiicHuskylens.kAlgorithmFaceRecognition = 0x00
static

◆ kAlgorithmLineTracking

int qwiic_huskylens.QwiicHuskylens.kAlgorithmLineTracking = 0x03
static

◆ kAlgorithmObjectClassification

int qwiic_huskylens.QwiicHuskylens.kAlgorithmObjectClassification = 0x06
static

◆ kAlgorithmObjectRecognition

int qwiic_huskylens.QwiicHuskylens.kAlgorithmObjectRecognition = 0x02
static

◆ kAlgorithmObjectTracking

int qwiic_huskylens.QwiicHuskylens.kAlgorithmObjectTracking = 0x01
static

◆ kAlgorithmTagRecognition

int qwiic_huskylens.QwiicHuskylens.kAlgorithmTagRecognition = 0x05
static

◆ kCommandRequest

int qwiic_huskylens.QwiicHuskylens.kCommandRequest = 0x20
static

◆ kCommandRequestAlgorigthm

int qwiic_huskylens.QwiicHuskylens.kCommandRequestAlgorigthm = 0x2D
static

◆ kCommandRequestArrows

int qwiic_huskylens.QwiicHuskylens.kCommandRequestArrows = 0x22
static

◆ kCommandRequestArrowsById

int qwiic_huskylens.QwiicHuskylens.kCommandRequestArrowsById = 0x28
static

◆ kCommandRequestArrowsLearned

int qwiic_huskylens.QwiicHuskylens.kCommandRequestArrowsLearned = 0x25
static

◆ kCommandRequestBlocks

int qwiic_huskylens.QwiicHuskylens.kCommandRequestBlocks = 0x21
static

◆ kCommandRequestBlocksById

int qwiic_huskylens.QwiicHuskylens.kCommandRequestBlocksById = 0x27
static

◆ kCommandRequestBlocksLearned

int qwiic_huskylens.QwiicHuskylens.kCommandRequestBlocksLearned = 0x24
static

◆ kCommandRequestById

int qwiic_huskylens.QwiicHuskylens.kCommandRequestById = 0x26
static

◆ kCommandRequestClearText

int qwiic_huskylens.QwiicHuskylens.kCommandRequestClearText = 0x35
static

◆ kCommandRequestCustomNames

int qwiic_huskylens.QwiicHuskylens.kCommandRequestCustomNames = 0x2F
static

◆ kCommandRequestCustomText

int qwiic_huskylens.QwiicHuskylens.kCommandRequestCustomText = 0x34
static

◆ kCommandRequestFirmwareVersion

int qwiic_huskylens.QwiicHuskylens.kCommandRequestFirmwareVersion = 0x3C
static

◆ kCommandRequestForget

int qwiic_huskylens.QwiicHuskylens.kCommandRequestForget = 0x37
static

◆ kCommandRequestIsPro

int qwiic_huskylens.QwiicHuskylens.kCommandRequestIsPro = 0x3B
static

◆ kCommandRequestKnock

int qwiic_huskylens.QwiicHuskylens.kCommandRequestKnock = 0x2C
static

◆ kCommandRequestLearn

int qwiic_huskylens.QwiicHuskylens.kCommandRequestLearn = 0x36
static

◆ kCommandRequestLearned

int qwiic_huskylens.QwiicHuskylens.kCommandRequestLearned = 0x23
static

◆ kCommandRequestPhoto

int qwiic_huskylens.QwiicHuskylens.kCommandRequestPhoto = 0x30
static

◆ kCommandRequestReceiveKnowledges

int qwiic_huskylens.QwiicHuskylens.kCommandRequestReceiveKnowledges = 0x33
static

◆ kCommandRequestSaveScreenshot

int qwiic_huskylens.QwiicHuskylens.kCommandRequestSaveScreenshot = 0x39
static

◆ kCommandRequestSendKnowledges

int qwiic_huskylens.QwiicHuskylens.kCommandRequestSendKnowledges = 0x32
static

◆ kCommandReturnArrow

int qwiic_huskylens.QwiicHuskylens.kCommandReturnArrow = 0x2B
static

◆ kCommandReturnBlock

int qwiic_huskylens.QwiicHuskylens.kCommandReturnBlock = 0x2A
static

◆ kCommandReturnBusy

int qwiic_huskylens.QwiicHuskylens.kCommandReturnBusy = 0x3D
static

◆ kCommandReturnInfo

int qwiic_huskylens.QwiicHuskylens.kCommandReturnInfo = 0x29
static

◆ kCommandReturnIsPro

int qwiic_huskylens.QwiicHuskylens.kCommandReturnIsPro = 0x3B
static

◆ kCommandReturnNeedPro

int qwiic_huskylens.QwiicHuskylens.kCommandReturnNeedPro = 0x3E
static

◆ kCommandReturnOk

int qwiic_huskylens.QwiicHuskylens.kCommandReturnOk = 0x2E
static

◆ nLearned

qwiic_huskylens.QwiicHuskylens.nLearned

Property Documentation

◆ connected

qwiic_huskylens.QwiicHuskylens.connected = property(is_connected)
static

The documentation for this class was generated from the following file: