Git Product home page Git Product logo

Comments (14)

smartheit avatar smartheit commented on July 28, 2024 1

So your wife should give you a Easter decoration cutting job so you would need one than ;-)

from pylgbst.

smartheit avatar smartheit commented on July 28, 2024 1

Hi Andrey,
the exhibition is over and people loved Vernie reacting on hand gestures. Thanks for the library. I am closing now the issue. However, it happened sometimes that pylgbst lib is not reacting anymore and only a restarted solved that.
Cheers
Marco

from pylgbst.

undera avatar undera commented on July 28, 2024

Hi
This may be related to the way you organized your code. Can it be that you initiate the hub object multiple times?
It would be the best just to share your code snippet here.

from pylgbst.

undera avatar undera commented on July 28, 2024

Looks like this issue: IanHarvey/bluepy#351 or IanHarvey/bluepy#172

And the bluepy lib looks as unmaintained. Maybe worth trying with Bleak as the most modern one.

from pylgbst.

smartheit avatar smartheit commented on July 28, 2024

Hi Andrey,
thanks for your answer.

The test code is based on your example android_remote.py. It is a sever - client test where you can specify the vernie task via command line. The shell script test.sh continuously switches the LED on and off by calling the client "python3 test3_client.py LED,1,0". Sooner or later the creas
test_vernie.zip

Regards
Marco

from pylgbst.

undera avatar undera commented on July 28, 2024

From what I read in those issues in bluepy, this is quite possible. There is an issue of thread safety in the library. Since the library is not quite maintained.
I suggest you to check Bleak first.

Another strategy could be to have the script continuously running. The issue relates exactly to the process of shutting down the bluepy connection.

from pylgbst.

smartheit avatar smartheit commented on July 28, 2024

Just to inform you: I am still trying to port bleak onto the system. It requires dbus and this is not available on the embedded board. Thus I need to modify the yocto project in order to get that running.

from pylgbst.

smartheit avatar smartheit commented on July 28, 2024

I moved to bleak now. I don't get crashes but Vernie switches off after some time and than pylgbst cannot issue commands anymore. The python application needs to be restarted and Vernie needs to be powered on again. Do you know by coincidence how to avoid this auto switch off?
Thanks
Marco

from pylgbst.

undera avatar undera commented on July 28, 2024

Usually the Hub only disconnects when the client disconnects from it. I also observed that when Hub has low voltage and just shuts down. But I'm not sure what happens in your case.

from pylgbst.

smartheit avatar smartheit commented on July 28, 2024

I changed the battery, so 100% is displayed:

INFO:root:Trying get_connection_bleak
INFO:comms-bleak:Discovering devices... Press green button on Hub
/usr/local/lib/python3.10/dist-packages/pylgbst/comms/cbleak.py:150: FutureWarning: The discover function will removed in a future version, use BleakScanner.discover instead.
devices = await bleak.discover(timeout=1, **kwargs)
INFO:comms:Found LEGO Move Hub at 00:16:53:C5:EC:43
INFO:comms-bleak:Device matched: BLEDevice(00:16:53:C5:EC:43, LEGO Move Hub)
INFO:hub:Attached peripheral MOTOR_INTERNAL_TACHO => EncodedMotor on port 0x0
INFO:hub:Attached peripheral MOTOR_INTERNAL_TACHO => EncodedMotor on port 0x1
INFO:hub:Attached peripheral VISION_SENSOR => VisionSensor on port 0x2
INFO:hub:Attached peripheral MOTOR_EXTERNAL_TACHO => EncodedMotor on port 0x3
INFO:hub:Attached peripheral MOTOR_INTERNAL_TACHO => EncodedMotor on port 0x10
INFO:hub:Attached peripheral RGB_LIGHT => LEDRGB on port 0x32
INFO:hub:Attached peripheral TILT_INTERNAL => TiltSensor on port 0x3a
INFO:hub:Attached peripheral CURRENT => Current on port 0x3b
INFO:hub:Attached peripheral VOLTAGE => Voltage on port 0x3c
WARNING:hub:Have no dedicated class for peripheral type 0x42 (UNKNOWN) on port 0x46
INFO:hub:Attached peripheral UNKNOWN => Peripheral on port 0x46
INFO:hub:b'LEGO Move Hub' on b'001653c5ec43'
INFO:hub:Voltage: 100%
Vernie the Robot is ready.

It wouldn't be a problem if the Software could recover when pressing the connection button again but in this case a restart of the program is required.

from pylgbst.

smartheit avatar smartheit commented on July 28, 2024

Hi Andrey,
Is there a way to have a kind of ping mechanism in the pylgbst library to detect if Vernie is still up?
With the current setup Vernie goes to sleep and the application does not get it.
Thanks
Marco

from pylgbst.

undera avatar undera commented on July 28, 2024

Unfortunately, I don't have access to my hardware piece anymore. So I can't experiment with it to understand the problem and how to fix it.
Hopefully, someone else will pick this up to contribute.

from pylgbst.

smartheit avatar smartheit commented on July 28, 2024

One Idea is that the python app takes control and switches Vernie off so that it is in a defined state.
I saw in the code that there is a function

def switch_off(self):
        self.send(MsgHubAction(MsgHubAction.SWITCH_OFF))

Does this function switch off the Hub completely? And if so how can it be called using your API?

from pylgbst.

undera avatar undera commented on July 28, 2024

Yes, that function switches off the hub. Just call it on Hub instance.

from pylgbst.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.