PeterStaev / lego-spikeprime-mindstorms-vscode

Helps you connect and work with Lego's SPIKE Prime/MINDSTORMS Robot Inventor hubs
Apache License 2.0
61 stars 21 forks source link

Support for HubOS 3 #55

Open Strohgelaender opened 1 year ago

Strohgelaender commented 1 year ago

In December 2022, Lego released a new HubOS and Spike Prime Version v3.

After upgrading to HubOS 3, we were no longer able to connect the brick with VS Code using this extension. Reverting back to HubOS 2 resolved the issue.

Will there be support for HubOS 3+? Or do I need to stay on version 2 in order to continue using VSCode for programming python?

PeterStaev commented 1 year ago

Hey @Strohgelaender , I haven't updated personally my hub, since it is the Mindstorms one, and don't want to brake it :) But from what I read on the LEGO's site Python is currently not support on v3 and is expected to land in early 2023. I suspect this might be part of the problem. Also I suspect that they changed their API. Since I've used the reverse engineering done by other on the v2 API, I'm not sure if/when the extension will support v3.

In short - for now your best bet is to stick with v2.

ffernn-dev commented 1 year ago

Anyone know if there's a way to downgrade a Spike Prime to V2?

MrGibbage commented 1 year ago

The newest v3.2.4 Spike App (hub OS 1.2.107) has python (you have to go into the settings to enable python). It's my understanding the 3.2.4 uses bluetooth low energy, so I don't know how to get the windows COM port number since they aren't displayed the same way regular bluetooth devices are. I think if we can crack that nut, then we will be in business again.

MrGibbage commented 1 year ago

Anyone know if there's a way to downgrade a Spike Prime to V2?

@ffernn-dev If using windows, it seems the only way is to use pybricks: https://www.youtube.com/watch?v=3pm6iOUBn8E

ffernn-dev commented 1 year ago

The newest v3.2.4 Spike App (hub OS 1.2.107) has python (you have to go into the settings to enable python).

Yeah I saw this, but a lot of the functions seem to have been removed or renamed. Any unofficial documentation I found for version 2 doesn't work anymore haha

MrGibbage commented 1 year ago

True. I have also seen this. There are some interesting new functions too. And the documentation has not caught up yet. I wonder if it is still a work in progress???

MrGibbage commented 1 year ago

If this is going is going to take a revision to the plugin (pretty likely, I think), I would like to toss in a feature request. This is all based on the user experience with regular BT, so this could all change given the new BTLE usage. For my situation, I coach an FLL team and we have seven laptops and robots for practice. Most of the time a single team member will use the laptop and robot assigned to them. But from time to time a laptop will be used to control a different robot than the one assigned. What that means is the list of BT COM ports gets longer and longer. And with an incoming and outgoing port for each hub, the list is twice as long as it needs to be. It would be great if the list could first of all, only show the outgoing ports because that is the port needed to upload the code. Also, it would be great if the list would show at least the MAC address (prehaps last four) or even better, perhaps show the robot name. Just think about it. In any case, count me in if you need any help with testing or have questions about how teams are using your code.

PeterStaev commented 1 year ago

@MrGibbage please post new feature request as new issues. This issue is specifically for HubOS3 support. Added your comments to a separate task, so we will keep any conversation there.

dsplaisted commented 1 year ago

As of the recently released version 3.3.0 of the Lego Spike App, Python programming support is available again. Any update on supporting HubOS 3 from the VS Code extension? It looks like the extension is based on https://github.com/sanjayseshan/spikeprime-tools for connecting to the hub, do you know if anyone has even figured out how to connect to HubOS 3 programmatically?

PeterStaev commented 7 months ago

For anyone willing to downgrade, seems LEGO provide an online tool to do this: https://spikelegacy.legoeducation.com/hubdowngrade/#step-1

Haven't tried this personally.

PeterStaev commented 7 months ago

For the record - I've sent a message on X to the LEGO group asking if they are willing to provide API docs for HubOS3 communication so the extension can be updated. So far no response form them yet :(

b3rgman commented 7 months ago

They don't seem to make any of it public.

Strohgelaender commented 4 months ago

Lego released an official HubOS 3 communication protocol documentation under https://lego.github.io/spike-prime-docs/index.html

See https://github.com/LEGO/spike-prime-docs for the repository and https://github.com/LEGO/spike-prime-docs/tree/main/examples/python for a python example program.

PeterStaev commented 4 months ago

Nice find! I will review and when time permits see to update the extension.