-
-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Question] How to custom-code input/controller #128
Comments
At this moment, you can connect to Pybricks using the nRF UART Service and send commands to the hub. Nothing else, for now... |
Note to self/others: https://github.com/virantha/bricknil/blob/master/bricknil/hub.py might be a good lead to start understanding the Bluetooth communication. Question to the devs/community which I could not find myself during the weekend: which Python bluetooth library(/ies) are used in the firmware? ubluetooth? This would help me understand how to program something that can run on the hub. |
We don't really have this capability yet, and probably not for a while. At the moment, a device can connect to a hub, but not yet the other way around. Here's a demo how you can make two hubs communicate with a PC in the middle for now.
Pybricks does not use this protocol, at least not for now. That protocol is great for remote controlling the hubs from a smart phone / tablet, but in case of Pybricks the code runs on the hub. Note that you can still nicely make remote-control-like functionality, by just sending small scripts to the hub that do the same thing as the remote control command would do. You can do that with the demo above as well. We'd like to implement this simple protocol in the long run, so it is easy do do non-blocking communication.
There are none. Except for the SPIKE Prime Hub, none of the hubs has enough space for pure Python libraries. Everything in the firmware is programmed in C, including the |
Hi Laurens, Again, thanks for the lightning-fast and extensive reply. This helps me to understand the issues why 'just' adding controllers is not feasible, you're working 100% on-brick, which is limited. The example you mention helps in understanding how the PC-in-the-middle approach could work, thanks a lot! (The Brick Automation Project seems similar, but then in a GUI style, instead of through Python). I was trying to understand and implement the low-level Bluetooth protocol, assuming at least something like uBluetooth would be available, this should be feasible. I also came across your C code, which I did not want to get into (Using C and helper functions to build a Python interface looks cumbersome :) ). I'm looking forward to pyBricks v4 or v5 which hopefully will include controller support, as I feel this is currently lacking (but I fully understand why!). Keep up the good work!!! |
This is done now in #186, so we can close his one. |
Question
I see on the roadmap that Powered Up remote handset support is expected in v4 or later. Is there any way we can custom-build this (or use alpha code) such that we can use this already in the mean time? If desired I could also help a bit in bringing this to pyBricks but would need a bit of a start to get going.
Ideally pyBricks would also support a smartphone as controller, or the different IR remotes that exist.
Context
Using pyBricks actually control and drive cars.
The text was updated successfully, but these errors were encountered: