Ganglion OpenBCI_Python errors

edited September 2018 in Ganglion
... I also tried the install on Ubuntu 18.04.1.
I use a Bluetooth CSR 4.0 Dongle (CSR 8510 Chipset)

The OpenBCI_GUI runs smoothly both on windows & linux (only with the latest OpenBCI_HUB though, if not, the Ganglion was not showing up).

On the windows side, the OpenBCI_NodeJS_Ganglion (with Noble and NodeJS) used with the LSL script is able to connect successfully to the Ganglion but generates a stream with a warning message, and in a first connection with Openvibe, the signals looked suspiciously nulls (Openvibe was set on the correct sampling frequency though) where I should have seen a 50 Hz signal on all channels like on the OpenBCI_GUI (electrodes plugged but not on my skull / bridged to my skin... acting like antennas...).
The Noble NodeJS module is able to detect the Ganglion (and to provide a MAC adress for the last point).

On the linux side, the OpenBCI_Python (with bluepy) is still not able to connect to the ganglion (to provide a LSL stream for Openvibe or other) when used with the MAC adress provided by Noble.
hcitool scan or lescan is not able to detect the Ganglion. And using the command (or just with --add print):

 sudo python user.py --board ganglion -p xx:xx:xx:xx:xx:xx 

I get the following error, any idea ? 


jeff@DESKTOP-H95KF48:~/Downloads/OpenBCI_Python$ sudo python user.py --board ganglion -p e5:98:a9:ea:3d:fa
[sudo] password for jeff:
------------user.py-------------
WARNING: no plugin selected, you will only be able to communicate with the board. You should select at least one plugin with '--add [plugin_name]'. Use '--list' to show available plugins or '--info [plugin_name]' to get more information.
Board type: OpenBCI Ganglion
('Port: ', 'e5:98:a9:ea:3d:fa')

------------SETTINGS-------------
Notch filtering:True
user.py: Logging Disabled.

-------INSTANTIATING BOARD-------
Looking for Ganglion board
Init BLE connection with MAC: e5:98:a9:ea:3d:fa
NB: if it fails, try with root privileges.
Traceback (most recent call last):
  File "user.py", line 126, in <module>
    aux=args.aux)
  File "/home/jeff/Downloads/OpenBCI_Python/openbci/ganglion.py", line 95, in __init__
    self.connect()
  File "/home/jeff/Downloads/OpenBCI_Python/openbci/ganglion.py", line 122, in connect
    self.gang = Peripheral(self.port, 'random') # ADDR_TYPE_RANDOM
  File "/home/jeff/Downloads/OpenBCI_Python/bluepy/bluepy/btle.py", line 353, in __init__
    self.connect(deviceAddr, addrType, iface)
  File "/home/jeff/Downloads/OpenBCI_Python/bluepy/bluepy/btle.py", line 402, in connect
    "Failed to connect to peripheral %s, addr type: %s" % (addr, addrType))
bluepy.bluepy.btle.BTLEException: Failed to connect to peripheral e5:98:a9:ea:3d:fa, addr type: random

jeff@DESKTOP-H95KF48:~/Downloads/OpenBCI_Python$



Comments

  • edited September 2018
    This seems a problem only related to the bluepy / btle part since:
    $ sudo python ./btle.py e5:98:a9:ea:3d:fa random
    ...results in the same error (both with random or public):

    Connecting to: e5:98:a9:ea:3d:fa, address type: random
    Running  /home/jeff/Downloads/OpenBCI_Python/bluepy/bluepy/bluepy-helper
    Sent:  conn e5:98:a9:ea:3d:fa random

    Got: "rsp=$stat state=$tryconn dst='e5:98:a9:ea:3d:fa mtu=h0 sec='low\n"
    Got: "rsp=$stat state=$disc mtu=h0 sec='low\n"
    Stopping  /home/jeff/Downloads/OpenBCI_Python/bluepy/bluepy/bluepy-helper
    Traceback (most recent call last):
      File "./btle.py", line 720, in <module>
        conn = Peripheral(devAddr, addrType)
      File "./btle.py", line 353, in __init__
        self.connect(deviceAddr, addrType, iface)
      File "./btle.py", line 402, in connect
        "Failed to connect to peripheral %s, addr type: %s" % (addr, addrType))
    __main__.BTLEException: Failed to connect to peripheral e5:98:a9:ea:3d:fa, addr type: random
  • wjcroftwjcroft Mount Shasta, CA
    Jeff, thanks for tracking this down.

    Can you open an issue for it here,


    Thanks!

    William

  • Hello William, not sure it's an OpenBCI or even a bluepy / btle issue: this hardware access problem appears to be linked to the Ubuntu linux I use, WSL (Windows Subsystem for Linux), nice for certains things but giving me an impoverished access to hardware and no libusb support : ^ (  I will reinstall a full fledged linux OS. 
  • edited September 2018

    Hello there

    Bluepy / btle & OpenBCI_Python runs smootly within a full fledged linux OS (Mint). 

    image

    Back on the windows 10 OS, OpenBCI_NodeJS_Ganglion easily finds & connects to the Ganglion to output a lsl stream (merci beaucoup NodeJS & Noble !)... but with a warning:

    image

    the NodeJS lsl_streamer complains about "[0] must be real number, not NoneType" while Openvibe complains about "Timeout reading sample from 0, filled rest of block with NaN" and many samples lost (received: 792 samples, expected : 39730). The signal information appears correct (4 channels, 200 Hz) though... but it seems a null stream.

    image

    Openvibe log output:

    [  INF  ] Connecting to device [LabStreamingLayer (LSL)]...
    [  INF  ] Opened an LSL stream with 4 channels and a nominal rate of 200 hz.
    [  INF  ] Connection succeeded !
    [  INF  ] Starting the acquisition...
    [  INF  ] Now acquiring...
    [  INF  ] Timeout reading sample from 0, filled rest of block with NaN
    ....
    ....
    [  INF  ] Timeout reading sample from 0, filled rest of block with NaN
    [  INF  ] Timeout reading sample from 0, filled rest of block with NaN
    [  INF  ] Timeout reading sample from 0, filled rest of block with NaN
    [  INF  ] Timeout reading sample from 0, filled rest of block with NaN
    [  INF  ] Timeout reading sample from 0, filled rest of block with NaN
    [  INF  ] Stopping the acquisition.
    [  INF  ] Stats after 198.645 seconds of 200hz sampling,
    [  INF  ]   Received : 792 samples
    [  INF  ]   Expected : 39730 samples
    [  INF  ]   Returned : 36780 samples (after drift correction)
    [  INF  ]   Added    : 35988 samples (0.905814%)
    [  INF  ]   Removed  : 0 samples (0%)
    [  INF  ] Estimated drift (tolerance = 2ms),
    [WARNING]   Slow peak  : -3342.75 samples (16713.7ms late, 835687% of tol.)
    [  INF  ]   Fast peak  : 0 samples (0ms early, 0% of tol.)
    [  INF  ]   Last estim : -0.0219727 samples (-0.109863ms, -5.49316% of tol.), after corr.
    [WARNING]   Remaining  : -2950 samples (-14750ms, -737500% of tol.), after corr.
    [  INF  ] Disconnecting.

    PS) Bravo to the Open BCI team for enabling a noob like me (for *.py or *.js) to install the full Ganglion package (_GUI, _NodeJS, _Python) without too much trouble !  

Sign In or Register to comment.