HUSKYLENSGeneral

HuskyLens With Raspberry

userHead lucadagostino84 2020-12-18 18:00:38 3847 Views6 Replies
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
2021-04-11 21:37:28 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!
userHeadPic polel129
2021-04-04 20:29:56 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
userHeadPic stevegale54
2021-03-03 08:05:55 I believe this is a issue on python library.

i'm getting the same errors like you.
userHeadPic danielmeireles
2021-03-02 22:24:24 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. userHeadPic klasstaffan
2021-02-27 23:04:37 Hi,

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

Can you help?

Thanks
userHeadPic polel129
2021-01-22 16:08:35 You may need to update the firmware, our staff will upload it soon userHeadPic 347945801