Skip to content
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

GanglionDelegate::parse_raw() - Line 159: struct not defined, packet not defined #10

Open
matteo-mazzanti opened this issue Dec 22, 2019 · 6 comments · May be fixed by #11
Open

GanglionDelegate::parse_raw() - Line 159: struct not defined, packet not defined #10

matteo-mazzanti opened this issue Dec 22, 2019 · 6 comments · May be fixed by #11

Comments

@matteo-mazzanti
Copy link

Dears,
in the file ganglion.py, at line ~159, in GanglionDelegate::parse_raw(), the variable "struct" is not defined, as well as the variable "packet". Probably a copy-paste from Cyton board code.
Kind Regards
Matteo

@ikmckenz
Copy link

The issue is currently here:

https://github.com/OpenBCI/pyOpenBCI/blob/2bdffe75aa18dcc2f5b2e068ca833045a8acd143/pyOpenBCI/ganglion.py#L201-L204

The problem is twofold. First struct isn't imported, which isn't a big problem to fix, just add import struct at the top of the file. The second problem is that it relies on the variable "packet" which is nowhere to be seen before this. I agree it looks like a copy/paste without testing from the old Python Ganglion driver, which has this in it:

https://github.com/OpenBCI/OpenBCI_Python/blob/25232ac7602e0b651796dcaa0bc710c1d9cc700c/openbci/ganglion.py#L468-L472

So that means that if we want to replicate the functionality of the old code the packet variable should be changed to the new raw_data variable name.

I can make a PR to do this if desired.

@matteo-mazzanti
Copy link
Author

matteo-mazzanti commented Feb 11, 2020

Thanks Ian.

I don't know what a PR is, sorry.

Maybe you can give me some advises to read some board settings using this library.
I have a coding session on Saturday afternoon with some other fellas (https://www.meetup.com/MindLAB-Space-Malmo/events/fcdxmrybcdbtb/), I will get in contact with you with a specific help request (I will report the snippets that I am not able to get to work).

Thanks in advice.
/Matteo M.

@ikmckenz ikmckenz linked a pull request Feb 12, 2020 that will close this issue
@ikmckenz
Copy link

ikmckenz commented Feb 12, 2020

I made the pull request to fix these issues, you can see it above. Please let me know if this patch fixes this issue, as I don't have a Ganglion to test with. You may run into other issues, I think I see some problems in the code that may stop you, but we'll at least fix this issue for now.

@matteo-mazzanti-ps
Copy link

OK. I will test by the end of the week.
/Matteo

@matteo-mazzanti-ps
Copy link

matteo-mazzanti-ps commented Feb 22, 2020

Dear Ian,
The library works, the lines 203 and 204 never get executed.

I have wrapped pyOpenBCI in a module for the Ganglion board
Separation-of-concern has been applied to connect() and start_stream().
The module apply also other minor improvements.
You can check it here:
https://gitlab.com/mindlab.space/openbci/pyopenbci_sandbox/-/blob/master/boards/ganglion.py

It would be fantastic if you could expose in pyOpenBCI, or show me examples for exposing the other Ganglion SDK commands (https://docs.openbci.com/docs/03Ganglion/GanglionSDK), above all, the query register settings command "?".

Thanks so much so far.
Looking forward to hearing from you.
/MatteoM.

@ikmckenz
Copy link

Glad to hear the changes work for you. For your other improvements I would make issues for them describing the changed functionality here on GitHub and then propose them for inclusion in a pull request that closes your issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants