Cylon to TouchDesigner using python streamer_osc plugin
This is for an exhibit at our science and technology center. We are intending to use three Cylon amplifiers to stream (2 channels each) to a TouchDesigner application being written by a third party. This will then create a visualisation of the user's mind state (or at least the muscle tension in their forehead).
The Cylon unit is operating reliably using the wireless dongle and the OpenBCI GUI application, and by using the GUI, we can reliably stream data to a TouchDesigner test application.
Since our exhibit will be fully autonomous (no operator and turn key operation), I thought to use the "python user.py -p COM4 -a streamer_osc". However this produces no output on the TouchDesigner test application.
To diagnose, I have used "python user.py -p COM4 -a streamer_osc -a sample_rate" with the following result:
------------user.py-------------
Board type: OpenBCI Cyton (v3 API)
('Port: ', 'COM4')
------------SETTINGS-------------
Notch filtering:True
user.py: Logging Disabled.
-------INSTANTIATING BOARD-------
Connecting to V3 at port COM4
Serial established...
OpenBCI V3 8-16 channel
On Board ADS1299 Device ID: 0x3E
LIS3DH Device ID: 0x33
Firmware: v3.1.1
$$$
No daisy:
(8, 'EEG channels and', 3, 'AUX channels at', 250.0, 'Hz.')
------------PLUGINS--------------
Found plugins:
[ streamer_osc ]
[ streamer_tcp ]
[ udp_server ]
[ csv_collect ]
[ noise_test ]
[ print ]
[ sample_rate ]
[ streamer_lsl ]
Activating [ streamer_osc ] plugin...
Selecting OSC streaming. IP: localhost, port: 12345, address: /openbci
Plugin [ streamer_osc] added to the list
Activating [ sample_rate ] plugin...
--- at t: 0.00042967084509 ---Plugin [ sample_rate] added to the list
elapsed_time: 0.00042967084509--------------INFO---------------
nb_samples_out: 0User serial interface enabled...
View command map at http://docs.openbci.com.
Type /start to run (/startimp for impedance
checking, if supported) -- and /stop
before issuing new commands afterwards.
Type /exit to exit.
Board outputs are automatically printed as:
% <tab> message
$$$ signals end of message
sampling rate: 0.0
-------------BEGIN---------------
Board type: OpenBCI Cyton (v3 API)
('Port: ', 'COM4')
------------SETTINGS-------------
Notch filtering:True
user.py: Logging Disabled.
-------INSTANTIATING BOARD-------
Connecting to V3 at port COM4
Serial established...
OpenBCI V3 8-16 channel
On Board ADS1299 Device ID: 0x3E
LIS3DH Device ID: 0x33
Firmware: v3.1.1
$$$
No daisy:
(8, 'EEG channels and', 3, 'AUX channels at', 250.0, 'Hz.')
------------PLUGINS--------------
Found plugins:
[ streamer_osc ]
[ streamer_tcp ]
[ udp_server ]
[ csv_collect ]
[ noise_test ]
[ print ]
[ sample_rate ]
[ streamer_lsl ]
Activating [ streamer_osc ] plugin...
Selecting OSC streaming. IP: localhost, port: 12345, address: /openbci
Plugin [ streamer_osc] added to the list
Activating [ sample_rate ] plugin...
--- at t: 0.00042967084509 ---Plugin [ sample_rate] added to the list
elapsed_time: 0.00042967084509--------------INFO---------------
nb_samples_out: 0User serial interface enabled...
View command map at http://docs.openbci.com.
Type /start to run (/startimp for impedance
checking, if supported) -- and /stop
before issuing new commands afterwards.
Type /exit to exit.
Board outputs are automatically printed as:
% <tab> message
$$$ signals end of message
sampling rate: 0.0
-------------BEGIN---------------
--> --- at t: 10.0229468269 ---
elapsed_time: 10.022517156
nb_samples_out: 0
sampling rate: 0.0
--- at t: 26.5617074939 ---
elapsed_time: 16.538760667
nb_samples_out: 0
sampling rate: 0.0
/--- at t: 36.5657277708 ---
elapsed_time: 10.0040202769
nb_samples_out: 0
sampling rate: 0.0 /start
--> Warning: Skipped 29 bytes before start found
--- at t: 46.5726070113 ---
elapsed_time: 10.0068792406
nb_samples_out: 842
sampling rate: 84.1421166139
--- at t: 56.579188487 ---
elapsed_time: 10.0065814757
nb_samples_out: 2526
sampling rate: 252.433861269
--- at t: 66.5838676926 ---
elapsed_time: 10.0046792056
nb_samples_out: 2438
sampling rate: 243.685974321
--- at t: 76.5943666847 ---
elapsed_time: 10.0104989921
nb_samples_out: 2453
sampling rate: 245.042729832
/s--- at t: 86.6023137925 ---
elapsed_time: 10.0079471078
tnb_samples_out: 2526
sampling rate: 252.399415463
op
Stopping streaming...
Wait for buffer to flush...
--> --- at t: 96.6094063662 ---
elapsed_time: 10.0070925736
nb_samples_out: 241
sampling rate: 24.0829190124
In another terminal I have used the OpenBCI GUI Networking test kit:
C:\Users\User\Documents\OpenBCI\TestKit\OpenBCI_GUI-master\Networking-Test-Kit\OSC>python osc_receive.py
--------------------
-- OSC LISTENER --
--------------------
('IP:', 'localhost')
('PORT:', 12345)
('ADDRESS:', '/openbci')
--------------------
print option selected
Listening...
--------------------
-- OSC LISTENER --
--------------------
('IP:', 'localhost')
('PORT:', 12345)
('ADDRESS:', '/openbci')
--------------------
print option selected
Listening...
but with no response.
Could someone advise what my next step should be?
If I can get it working, how would I best auto start the user.py application?
Alternatively, is there a way to automate the OpenBCI GUI to commence streaming without user input?
We have no previous experience with BCI but some electronics and python experience.
Comments
To avoid the issue with the Python SDK, I have managed to hack the
OpenBCI_GUI processing code to allow autostart for OSC output from a Cyton on COM4 with
50Hz notchfilter and no logging.
Still to do:
Modifying the code and exporting to an exe file under Processing was surprisingly easy and I noted comments in the code that suggest this is the intended way to configure the system. Not being familiar with Processing, I found that locating the file where global variables are defined was difficult.
Can anyone guess why the GUI might
stop forwarding OSC data after a certain time?