OpenBCI / OpenBCI_GUI

A cross platform application for the OpenBCI Cyton and Ganglion. Tested on Mac, Windows and Ubuntu/Mint Linux.
MIT License
719 stars 259 forks source link

LSL issues streaming more than one data type #592

Closed lopezvaa closed 5 years ago

lopezvaa commented 5 years ago

Update

It seems that the issue is not the data type that is sent via LSL is that the widget will not send more than 1 stream. If I change Stream 1 in the GUI to be the digital read instead of EEG, I get my digital inputs through LSL as expected but the EEG (now on stream 2) is not there, even if the stream is turned on.

Problem

The LSL streaming of Accelerometer of Digital Channels does not work. The streams come out empty after being recorded with Lab Recorder for LSL streams.

The stream channels are visible and the info for each outlet is recorded correctly. But there is no data available in the stream

Expected

According to the Network Widget Guide, accelerometer or analogue or digital inputs should be possible to stream with the LSL protocol in the latest release 4.1.5 beta3.

The EEG channels are recorded as expected and can be seen in the figure below.

image

When recorded with and LSL stream recorder like Lab Recorder, I expect to see an LSL stream with accelerometer or auxiliary input just as the EEG timeseries above. Instead those streams are empty, see below figure.

image

Operating System and Version

Windows 10, 64-bit

GUI Version

4.1.5 beta3 release

Running standalone app

Problem was found in both stand alone and processing versions

Type of OpenBCI Board

Cyton

Are you using a WiFi Shield?

No

retiutut commented 5 years ago

@lopezvaa Please tell me exactly what I need to receive LSL just like you are here. Step by step.

I have already reproduced the other issue you have just opened, and I need help replicating this issue also. Thanks!

lopezvaa commented 5 years ago

Sure @Richard Waltmanmailto:notifications@github.com ,

I’m away from my workstation for the evening but I can give you more details tomorrow. In short: 1) set up OpenBCI GUI on a new session via dongle, select the widgets timeseries, networking and digital read on

2) set the networking widget to stream via LSL protocol 2 active streams (obci_eeg1, timeseries, type EEG, 8 chn; obci_eeg2, accel/aux, type DIGITAL, 5 chn)

3) start the data stream on the session and start the LSL stream

image Note: I had to use a playback file here because I don't have the board with me (that is why I'm using accelerometer data instead of the digital inputs as I suggested)

4)in a different software (I use matlab and MatLSL-lib) create a simple LSL consumer script with 2 inlets, one of obci_eeg1 and one for obci_eeg2. Pull one or more chunks from each LSL inlet and display the data received.

image

5) you will see that the obci_eeg1 data chunk has 8 chns and however many samples, representing the EEG data. But the second stream obci_eeg2 is empty even when it was detected as an active stream.

image

6) repeat steps 1 to 5 but now invert the order of the streams in step 2 (obci_eeg1 to be the aux data and obci_eeg2 the EEG data)

image

7) you will now see that your data pull receives the 5 chns of DIGITAL inputs but the EEG stream is empty.

image Note: the figure only shows 3 aux chns because I was using a playback file.

That will replicate the error. I can elaborate with screen dumps tomorrow for more clarity if needed.

Thanks for looking into the issues Kind regards Alejandro

lopezvaa commented 5 years ago

I think the problem may be in the checkForData function of the Networking Widget

Boolean checkForData() {
    if (this.dataType.equals("TimeSeries")) {
        return dataProcessing.newDataToSend;
    } else if (this.dataType.equals("FFT")) {
        return dataProcessing.newDataToSend;
    } else if (this.dataType.equals("EMG")) {
        return dataProcessing.newDataToSend;
    } else if (this.dataType.equals("BandPower")) {
        return dataProcessing.newDataToSend;
    } else if (this.dataType.equals("Accel/Aux")) {
        return dataProcessing.newDataToSend;
    } else if (this.dataType.equals("Focus")) {
        return dataProcessing.newDataToSend;
    } else if (this.dataType.equals("Pulse")) {
        return dataProcessing.newDataToSend;
    } else if (this.dataType.equals("SSVEP")) {
        return dataProcessing.newDataToSend;
    }
    return false;
}

When you have simultaneous streams running dataProcessing.newDataToSend seems to be dominated by the first stream data type.

But I have not been able to find a solution to it. Yet, in just getting the hang of processing.

lopezvaa commented 5 years ago

Bingo! that seems to be it. but I still haven't found a solution, I just hardcoded a fix for the moment. here a snapshot of the result.

image

retiutut commented 5 years ago

@lopezvaa Can you make a Pull Request so we can start coding/merging a solution to this issue?

retiutut commented 5 years ago

I have just replicated this issue while trying to receive data using pylsl:

"""Example program to demonstrate how to read a multi-channel time-series
from LSL in a chunk-by-chunk manner (which is more efficient)."""

from pylsl import StreamInlet, resolve_stream

numStreams = 2
# first resolve an EEG stream on the lab network
print("looking for an EEG stream...")
stream1 = resolve_stream('name', 'obci_eeg1')
stream2 = resolve_stream('name', 'obci_eeg2')

# create a new inlet to read from the stream
inlet = StreamInlet(stream1[0])
inlet2 = StreamInlet(stream2[0])

while True:
    for i in range(numStreams):
        # get a new sample (you can also omit the timestamp part if you're not
        # interested in it)
        if i == 0:
            chunk, timestamps = inlet.pull_chunk()
            #if timestamps:
                #print("Stream", i + 1, " == ", chunk)
        elif i == 1:
            chunk, timestamps = inlet2.pull_chunk()
            if timestamps:
                    print("Stream", i + 1, " == ", chunk)
retiutut commented 5 years ago

Screen Shot 2019-10-01 at 4 14 58 PM

retiutut commented 5 years ago

@lopezvaa Try https://github.com/OpenBCI/OpenBCI_GUI/releases/tag/v4.1.6 !!! 🔥

lopezvaa commented 5 years ago

@lopezvaa Try https://github.com/OpenBCI/OpenBCI_GUI/releases/tag/v4.1.6 !!! 🔥

Thanks @retiutut I'm jsut back from a conference, so I'll get back to this now and try the suggested version! Awesome!