alexandrebarachant / muse-lsl

Python script to stream EEG data from the muse 2016 headset
BSD 3-Clause "New" or "Revised" License
616 stars 182 forks source link

Fix AUXR and PPG channels not streaming under bgapi #128

Closed stepheninx closed 3 years ago

stepheninx commented 4 years ago

It appears that muse (self.select_preset) was no longer being called when the streaming started. This prevented the select preset command from being sent to the headset, which means that it would never sample data on anything except for the default channels.

At this time, it is not enough to subscribe to the GATT attributes of the desired data, the correct preset number must also be sent in order to instruct the headset which channels are to be sampled.

I have added a new command line argument '-P' '--preset', which allows an integer to be passed for selecting the preset. For reference::

20 - 5-Channel EEG channel streaming
21 - 4-Channel EEG channel streaming
22 - 4-Channel EEG channel streaming without accel/gyro

50 - Same as 20, but includes PPG data
51 - Same as 21, but includes PPG data

I have not yet tested this with a backend other than BGAPI, so I'm not sure if Bluemuse will send the preset information either.

jdpigeon commented 4 years ago

Hey @stepheninx, thanks for this awesome work! I appreciate that you've cleanly added this to the CLI.

I wonder, if there's a coupling between the gatt characteristics request and the preset value, would it make sense to abstract over the two parameters instead of making them separate?

For instance, if you want to stream acc/gryo + ppg -- preset = 21. Just 4 channel eeg == preset = 22. Do you think there are cases where having independent control over the characteristics and presets is necessary?

stepheninx commented 4 years ago

You're welcome! I think you're right, there are a few ways to make the integration cleaner, by determining the preset based off of the desired data channels. I like having the ability to override the preset, in case there is a new one to test, but it would definitely make it easier to not have to worry about the preset number :)

xloem commented 3 years ago

Just a comment here, documentating all the charactistic and preset combinations, and verifying they are correct for all the muses, could take some time and collaboration. It would make sense to provide a user-settable preset until that happens. This would also help people collect and verify such data. Note also that one of the presets ('53') changes the muse into some kind of different mode, which might be usable for uploading/downloading firmware, and would be good to let people see so interest develops around open-source firmware and integrity verification and such.

xloem commented 3 years ago

@stepheninx is there any chance you could rebase/merge this with the bluemuse changes in master?

jdpigeon commented 3 years ago

Thanks for this! I had to do some rebasing and cleaning things up, so I moved these updates over here: https://github.com/alexandrebarachant/muse-lsl/pull/155

DominiqueMakowski commented 11 months ago

Huh, no actually it works all good sorry my bad! will delete the previous comment