Page 1 of 1

HuskyLens With Raspberry

Unread postPosted:Fri Dec 18, 2020 10:00 am
by lucadagostino84
Hi everyone,
I'm having some problems configuring HuskyLens with Raspbery Pi.
I have connected Huskylens to I2C and set up I2C in the chamber.
When I run the example script from the library however it generates an error, where am I going wrong?

this is my code:
Code: Select all
from huskylib import HuskyLensLibrary

camera = HuskyLensLibrary("I2C","",address=0x32)

print("First request a knock: {}".format(camera.knock()))
camera.algorthim("ALGORITHM_FACE_RECOGNITION")

while(true):
    data=camera.blocks()
    x=0
    for i in data:
        x=x+1
        print("Face {} data: {}".format(x,i)) 

This is the error:

First request a knock: Knock Recieved
Traceback (most recent call last):
File "/home/pi/huskycam/test/huskylib.py", line 179, in processReturnData
commandSplit[4][2:4]+commandSplit[4][0:2], 16)
TypeError: int() can't convert non-string with explicit base

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "prova.py", line 6, in <module>
camera.algorthim("ALGORITHM_FACE_RECOGNITION")
File "/home/pi/huskycam/test/huskylib.py", line 387, in algorthim
return self.processReturnData()
File "/home/pi/huskycam/test/huskylib.py", line 217, in processReturnData
self.huskylensSer.timeout=5
AttributeError: 'SMBus' object has no attribute 'timeout'
[email protected]:~/huskycam/test $ python3 prova.py
First request a knock: Knock Recieved
Traceback (most recent call last):
File "/home/pi/huskycam/test/huskylib.py", line 179, in processReturnData
commandSplit[4][2:4]+commandSplit[4][0:2], 16)
TypeError: int() can't convert non-string with explicit base

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "prova.py", line 6, in <module>
camera.algorthim("ALGORITHM_FACE_RECOGNITION")
File "/home/pi/huskycam/test/huskylib.py", line 387, in algorthim
return self.processReturnData()
File "/home/pi/huskycam/test/huskylib.py", line 217, in processReturnData
self.huskylensSer.timeout=5
AttributeError: 'SMBus' object has no attribute 'timeout'


thanks for support

Luca

Re: HuskyLens With Raspberry

Unread postPosted:Fri Jan 22, 2021 8:08 am
by 347945801
You may need to update the firmware, our staff will upload it soon

Re: HuskyLens With Raspberry

Unread postPosted:Sat Feb 27, 2021 3:04 pm
by polel129
Hi,

I'm getting the same errors and I have the lastest firmware (0.5.1 norm)

Can you help?

Thanks

Re: HuskyLens With Raspberry

Unread postPosted:Tue Mar 02, 2021 2:24 pm
by klasstaffan
HuskyLens is pretty easy-to-use. You can change various algorithms by pressing the function button. Click the learning button, HuskyLens starts learning new things. After that, HuskyLens is able to recognize them.

Re: HuskyLens With Raspberry

Unread postPosted:Wed Mar 03, 2021 12:05 am
by danielmeireles
I believe this is a issue on python library.

i'm getting the same errors like you.

Re: HuskyLens With Raspberry

Unread postPosted:Sun Apr 04, 2021 12:29 pm
by stevegale54
I think its an error with the python library when the returned data is null or all zeroes.
I have forked the library and it seems to work, although I am still testing.

The code can be found here
https://github.com/windy54/HUSKYLENSPython.git

It might not be the most elegant fix but it seems to work!

Also I have added a main function, so if you type
python3 huskylib.py it will runa face recogntiion example.

The function hl.blocks() now returns a class rather than list, so an earlier example I tried did not work.

Steve

Re: HuskyLens With Raspberry

Unread postPosted:Sun Apr 11, 2021 1:37 pm
by polel129
Hi Steve,

Thank you so much for your library! The I2C connection still has problems with smbus, so I connected Huskylens to the USB port of Raspberry and used the serial connection.

Here's my code for reading block attributes. If the object on the screen is recognized, then an mp3 file is played. My project is for blind people.
Code: Select all
import time
from huskylib import HuskyLensLibrary
import vlc

hl = HuskyLensLibrary("SERIAL", "/dev/ttyUSB0", 3000000)

while True:
    result = hl.requestAll()
    for i in result:
        b_learned = getattr(i,"learned")
        b_id = getattr(i,"ID")
        if b_learned == True:
            media = vlc.MediaPlayer(str(b_id)+".mp3")
            media.play()
            time.sleep(5)
            break

I want to express my disappointment for DFRobot technical support. I first contacted them on March 15, about the problem with the python library and Raspberry. We exchanged a few email messages and they reassured me that they are going to fix it. The last email I had from them was on March 31. Since then, they don't even bother to reply to my messages.

Thanks again Steve!