Comments (14)
So your wife should give you a Easter decoration cutting job so you would need one than ;-)
from pylgbst.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
Yes, that function switches off the hub. Just call it on Hub instance.
from pylgbst.
Related Issues (20)
- LEDRGB: Current color can't be obtained/notified from the hub HOT 4
- Cannot connect to 88015 hub HOT 1
- Error on MacOS HOT 5
- 'MoveHub' object has no attribute 'connection' HOT 2
- Any plans for adding other hubs, maybe Mindstorms 515151? HOT 5
- [motors]Is there a way to ? HOT 1
- Technic Hub Port AB doesnt work HOT 16
- Connecting to WeDo SmartHub: no characteristic found HOT 7
- Blue Tooth Connection HOT 6
- Cannot run a Lego tram HOT 25
- How to get Sound Files with Lego Boost app? HOT 1
- Calling hub methods from callback functions blocks further operations HOT 6
- How to control a DC (train) motor ? HOT 40
- Support for Powered Up Remote Handset (Lego 88010) HOT 6
- Is pylgbst thread-safe? HOT 2
- To bleak or not to bleak...? HOT 3
- AttributeError: 'NoneType' object has no attribute 'timed' HOT 3
- Proper way to detect if motor is stuck during its move? HOT 3
- Remote WARNING:peripherals:Attempt to unsubscribe while port value updates are off: RemoteButton on port 0x0 HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pylgbst.