Recommended Posts

Help!

Everything works fine with TechnicHub.

But with CityHub I cannot flash any pybricks firmware. Tried with the two CityHubs I have, with beta.pybricks.com and code.pybricks.com and always the same result:

existing Firmware is deleted and I get a The hub was disconnected before flashing was completed. Restart the hub and try again..

After this, the hub has no firmware so it enters immediatly the purple blinking mode. I can try to flash again but always with the same error...

If I try with powered up app, I can restore LEGO firmware with no problems...

Any hints?

Thanks in advance!

Share this post


Link to post
Share on other sites

@vascolp Pretty sure this is the issue I had.  I was only able to use my laptop or NUC PC that had an internal Intel Bluetooth radio to download firmware to the CityHub.  Both of my external USB adapters had this error.  It's only with the CityHub that I had issues, my TechnicHub works with either internal or USB BT

Share this post


Link to post
Share on other sites

Thats really odd...  I had no problems with CityHub last year... but in the meantime I changed my laptop!

And now I was able to flash LEGO firmware... but it wasn´t with the laptop but with the phone!

So I just tried to run beta.pybricks.com in the phone and... voila! I could flash it!

@BatteryPoweredBricks thanks for your help!

My old laptop had Bluetooth 4.2 and the new one has Bluetooth 5.... it seems consistent with your problems yes.

However, my phone is a pocophone F1 (about 4 years old) , which has bluetooth 5.0, and it works....  

So it seems that most recent devices can not flash CityHub??

 

Anyway, RemoteCityBla.py seems to work fine in the new pybricks beta version (as long as you delete the "from math import trunc" line). That's cool!

Share this post


Link to post
Share on other sites

Don't forget to unplug all devices.

The City Hub can only be updated when there is no sensor in Port A.

That's a builtin bug, so there's nothing we can do about that :-)

Share this post


Link to post
Share on other sites

Hi,

I can't for the life of me get my sets 42124 and 42109 to connect to the lego remote using pybricks. I manage to install the bootloader, run the program but then I can't connect the remotes. This used to work in the past but has not been working for me in the past few months. 

The last time it worked I was using beta.pybricks.com

Here is the code I'm using for the two sets: https://bit.ly/3fuypYG

I've got the same issue with set 42099.

I've also managed to connect all three sets with Control+ using the standard Lego bootloader.

Share this post


Link to post
Share on other sites

Thanks for reporting this @MAMZe! We'd love to fix this before we launch the beta as the main version.

To make testing simpler, would you mind sharing what happens when you run the following program? Any errors? I put colored lights in the program so you can see how far it gets. Which colors do you see?

Does it make a difference if you disconnect from the Pybricks app after loading the program, and then re-starting the program with the hub button?

Please use https://beta.pybricks.com/ when you try it. Thanks!

from pybricks.hubs import TechnicHub
from pybricks.pupdevices import Remote
from pybricks.parameters import Button, Color
from pybricks.tools import wait

hub = TechnicHub()

# Make the light red while we connect.
hub.light.on(Color.RED)

# Connect to the remote.
my_remote = Remote() 

# Make the light green when we are connected.
hub.light.on(Color.GREEN)

while True:
    # For any button press, make the light magenta.
    # Otherwise make it yellow.
    if my_remote.buttons.pressed():
        hub.light.on(Color.MAGENTA)
    else:
        hub.light.on(Color.YELLOW)
    wait(10)

 

Share this post


Link to post
Share on other sites

Ok so it connects fine and when I press the buttons I can see the Magenta lighting up, but then it very quickly disconnects after maybe 10 seconds.

Following that, I attempted the code for the Stig set in the previous link I mentioned, which also works this time, however after driving a few seconds the front wheels go crazy moving rapidly from one side to another.

Share this post


Link to post
Share on other sites
9 hours ago, MAMZe said:

Ok so it connects fine and when I press the buttons I can see the Magenta lighting up, but then it very quickly disconnects after maybe 10 seconds.

Following that, I attempted the code for the Stig set in the previous link I mentioned, which also works this time, however after driving a few seconds the front wheels go crazy moving rapidly from one side to another.

hmmmmm .... and the remote light is steady or it blinks?

Share this post


Link to post
Share on other sites

Yes the remote light stays on red. The weird activity only starts when i hit the left or right buttons.

Share this post


Link to post
Share on other sites

Update: tried with the regular version of pybricks (not beta) and it works fine. 

One other question: how can I use the left and right red buttons to set speed? I want the left button to set speed to 75% and the right button to set speed to 100%. I would like the speed to be held even after I depress the button.

Share this post


Link to post
Share on other sites

I have been wondering whether it would theoretically be possible to connect a hub running Pybricks with a bluetooth gamepad controller; I mean building up the bluetooth connection, and reading the button presses, hidden behind a python interface, just like for the lego remote. I am guessing this would need to be part of the FW. Do you @Pybricks guys see any theoretical obstacle for making that possible? Is there something special about the lego remote as a bluetooth device that is relied upon by the FW that enables it to build up the connection between the two?

If that would be possible, it would open the door for using a gamepad controller to control the hub directly without an intermediary phone, much like the RemoteBlaBla wouldn't it?

Share this post


Link to post
Share on other sites

I have been waiting for such kind of feature since I discovered PyBricks at the beginning of 2022... True, we already have BrickController2, but the smartphone remains necessary in the middle and it induces a palpable latency in the controls.

Share this post


Link to post
Share on other sites
Quote

I have been wondering whether it would theoretically be possible to connect a hub running Pybricks with a bluetooth gamepad controller;

One problem is that most gamepads use Bluetooth classic, and the Boost/City/Technic hubs only have Bluetooth Low Energy (BLE). By contrast, the SPIKE/MINDSTORMS hubs support both.

Maybe we should produce a remote that uses BLE, and connect to multiple hubs at once?

Quote

Ok so it connects fine and when I press the buttons I can see the Magenta lighting up, but then it very quickly disconnects after maybe 10 seconds.

@MAMZe, could you please post your issue here? https://github.com/pybricks/support/issues This sounds like a bug and we'd love to fix it for the upcoming release.

Share this post


Link to post
Share on other sites

I think it's conceivable that standard Python (if not MicroPython, even) has some BT HID library that allows it to communicate with a gamepad (or a keyboard or mouse, but right now I don't see much use for those in a LEGO model); would it be complicated to implement a method that returned a list of buttons/axes pressed in a paired controller, similarly to what is done with the LEGO PU controller?

That would have the disadvantage of fragmenting Pybricks a bit more, in the sense that some functionality is available only on some hubs, but on the other hand we already have some of that with the number of ports and the gyro/accelerometer.

Share this post


Link to post
Share on other sites
9 hours ago, Pybricks said:

One problem is that most gamepads use Bluetooth classic, and the Boost/City/Technic hubs only have Bluetooth Low Energy (BLE). By contrast, the SPIKE/MINDSTORMS hubs support both.

Oh that's a bummer. I am guessing then that's true for Xbox controllers too, do they use Bluetooth classic as well? I did know that the Spike/Mindstorms hubs have that, I did not know they also support BLE, thanks. I guess then that's why the Mindstorms app supports Xbox controllers. Or is that making the connection through the computer/phone as well? BTW, is Bluetooth classic limited to one connection?

9 hours ago, Pybricks said:

Maybe we should produce a remote that uses BLE, and connect to multiple hubs at once?

Do you mean manufacture? :) I guess that's what many people here are dreaming about.. but still not enough to make it a product that sells well I guess.. We are just a few hundred enthusiasts, maybe a thousand.

Share this post


Link to post
Share on other sites
1 hour ago, gyenesvi said:

is Bluetooth classic limited to one connection?

I don't think so: my phone can be connected to my Chinese smartwatch (which, judging by its poor range, definitely isn't BLE) and my car at the same time.

Share this post


Link to post
Share on other sites
Quote

Here is the code I'm using for the two sets: https://bit.ly/3fuypYG

You'll want to delete this line in your code. With the new updates, the firmware will do this for you, so doing it again sets the values way too high.

steer.control.pid(kp=old_kp*4, kd=old_kd*0.4)

 

On 11/9/2022 at 12:12 AM, gyenesvi said:

Do you mean manufacture? :) I guess that's what many people here are dreaming about.. but still not enough to make it a product that sells well I guess.. We are just a few hundred enthusiasts, maybe a thousand.

If we did it, we'd have to partner with some existing third-party hardware providers. Instead, we'd provide the remote firmware to be compatible with (more than one) LEGO hubs.

Share this post


Link to post
Share on other sites
2 hours ago, Pybricks said:

If we did it, we'd have to partner with some existing third-party hardware providers. Instead, we'd provide the remote firmware to be compatible with (more than one) LEGO hubs.

Interesting idea.. do you mean replacing the FW on an existing product just like for the lego hub, or team up with the providers to create the FW to be compatible from the start?

On 11/8/2022 at 2:38 PM, Pybricks said:

One problem is that most gamepads use Bluetooth classic, and the Boost/City/Technic hubs only have Bluetooth Low Energy (BLE). By contrast, the SPIKE/MINDSTORMS hubs support both.

Back to existing controllers. Wikipedia says that the latest Xbox Series controllers (since 2020) do support BLE:

https://en.wikipedia.org/wiki/Xbox_Wireless_Controller#Third_revision_(2020)

They seem to be fairly accessible out there, I have bought one second hand for $40 just for controlling lego models (through phone for now).

The latest PlayStation 5 controllers also support Bluetooth 5.1, which includes BLE according to my understanding:

https://en.wikipedia.org/wiki/DualShock#DualSense

Have you looked into these ones? If only these major ones were supported that would already be a big step forward. Would it be possible to build up a bluetooth connection to these using Pybricks FW on all hubs?

I know that decoding their communication protocol is another thing.. Does that seem like a possible way (I really cannot judge), or would these also require replacing the firmware (if a BLE connection is possible)?

Another thing I wanted to ask as it's not clear to me. Can Pybricks be controlled from a phone like the original lego FW can? Or is it just for running programs on it directly?

Edited by gyenesvi

Share this post


Link to post
Share on other sites
2 hours ago, Pybricks said:

You'll want to delete this line in your code. With the new updates, the firmware will do this for you, so doing it again sets the values way too high.


steer.control.pid(kp=old_kp*4, kd=old_kd*0.4)

I did that, but while driving the wheels would suddenly turn full left and block themselves in that position.

 

Share this post


Link to post
Share on other sites
Quote

I did that, but while driving the wheels would suddenly turn full left and block themselves in that position.

Do you have small script to reproduce this? Ideally something that we can try with just a hub/motor and some technic elements. (I probably don't have the same Technic set as you.)

We updated the beta version (https://beta.pybricks.com/) yesterday. This should fix the program crash and remote disconnect you saw earlier. Please let me know if this is still happening.

Quote

Can Pybricks be controlled from a phone like the original lego FW can? Or is it just for running programs on it directly?

Both. But we aren't currently working on such an app.

 

 

Share this post


Link to post
Share on other sites

Controller support Bluetooth Low Energy (BLE):

New Xbox Series Controller support Bluetooth Low Energy (BLE), in my opinion the best BLE Controller because of proportional steering and two choices for batteries: AA batteries or rechargeable battery pack
(For the sake of completeness the older Xbox One Controller support Bluetooth Low Energy (BLE) after Firmware Update, see Video)

 

Edited by Al Ex

Share this post


Link to post
Share on other sites
On 11/12/2022 at 2:17 PM, Pybricks said:

Both. But we aren't currently working on such an app.

That's understandable, but maybe others can work on the app side :) But for that the communication protocol is needed. Is that documented somewhere?

I'd still be interested in your opinion about connecting Xbox Series Controllers. Given that they support BLE, is there a theoretical chance/obstacle that they could be connected directly to a hub with Pybricks?

Share this post


Link to post
Share on other sites
On 11/5/2022 at 9:27 PM, MAMZe said:

One other question: how can I use the left and right red buttons to set speed? I want the left button to set speed to 75% and the right button to set speed to 100%. I would like the speed to be held even after I depress the button.

This might help, not exactly what you want but it should give you an idea of how to do it.
https://github.com/MxWinters/PyBricks-Remote-Technic-Hub

Share this post


Link to post
Share on other sites
On 11/12/2022 at 2:17 PM, Pybricks said:

We updated the beta version (https://beta.pybricks.com/) yesterday. This should fix the program crash and remote disconnect you saw earlier. Please let me know if this is still happening.

I have tried this version, but it seems that the function to include the current program in the curstom firmware is not available anymore... Is this normal?

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.