Changes

Jump to navigation Jump to search
1,155 bytes added ,  16:12, 1 February 2022
no edit summary
Line 4: Line 4:  
| screenshot            =  
 
| screenshot            =  
 
| caption                =  
 
| caption                =  
| developer              = Christian Kothe; University of California San Diego.
+
| developer              = Christian Kothe; Chadwick Boulay.
 
| released              = <!-- {{Start date and age|YYYY|MM|DD|df=yes}} -->
 
| released              = <!-- {{Start date and age|YYYY|MM|DD|df=yes}} -->
 
| discontinued          =  
 
| discontinued          =  
Line 13: Line 13:  
| installed version      =  
 
| installed version      =  
 
| installed version date = <!-- {{Start date and age|YYYY|MM|DD|df=yes}} -->
 
| installed version date = <!-- {{Start date and age|YYYY|MM|DD|df=yes}} -->
| status                = in development
+
| status                = -in development-
 
| programming language  = C, C++, Python, Java, C#, MATLAB
 
| programming language  = C, C++, Python, Java, C#, MATLAB
 
| operating system      = Windows, Linux, MacOS, Android, iOS
 
| operating system      = Windows, Linux, MacOS, Android, iOS
Line 27: Line 27:  
     | downloads          =  
 
     | downloads          =  
 
     | manuals            = {{bulleted list
 
     | manuals            = {{bulleted list
         | [https://docs.unity3d.com/Manual/index.html Official Documentation]
+
         | [https://docs.openbci.com/ Documentation]
 +
        | [https://sccn.ucsd.edu/~mgrivich/LSL_Validation.html LSL Validation]
 +
        | [https://labstreaminglayer.readthedocs.io/info/supported_devices.html Supported Devices and Tools]
 +
    }}
 +
    | header2            = Templates
 +
    | data2              = {{bulleted list
 +
        | [https://surfdrive.surf.nl/files/index.php/s/qggfMMKsnUIDO0k example scripts (zip)]
 
     }}
 
     }}
 
   }}
 
   }}
 
}}
 
}}
   −
Unity is a cross-platform game engine that can be used to create experiments with more complex interactivity and/or more elaborate audiovisual content, such as full 3D virtual environments. Unity is free for personal/non-commercial use.
+
The DataHub Makes use of the lab streaming layer. The lab streaming layer (LSL) is a system for the unified collection of measurement time series in research experiments that handles both the networking, time-synchronization, (near-) real-time access as well as optionally the centralized collection, viewing and disk recording of the data.
    
<!-- Table of Contents will be generated here -->
 
<!-- Table of Contents will be generated here -->
    
==Installation==
 
==Installation==
We advise installing Unity via the [https://unity3d.com/get-unity/download Unity HUB]. This provides a handy overview of all your projects and allows you to easily switch between different Unity versions. You will be required to create an account.
+
Our support for LSL is mainly done in python. Download python here: [https://www.python.org/downloads/release/python-376/ Please choose a 64 bit version.]. Run the installer and make sure to add Python to the file path (it's an option in the installer).
 +
Open a command prompt, start with upgrading the pip installer by typing:<br/>
 +
<code style="background-color:#000; color:#fff; padding:1px 3px;">c:>python -m pip install --upgrade pip</code><br/>
 +
Then:<br/>
 +
<code style="background-color:#000; color:#fff; padding:1px 3px;">c:>pip install pylsl</code>
 +
 
 +
more info: [https://github.com/labstreaminglayer/liblsl-Python cross platform pylsl]
    
===Versions===
 
===Versions===
Unity is constantly updated, and new versions will frequently include Beta features that may not be super reliable and well documented yet. As such it is sometimes quite difficult to figure out which version to use. If you wish to create your own Unity projects, we advise to install the latest long term support (LTS) release. Beware that any tutorials, forum answers and plugins you find online may no longer be compatible with your version, so always check the date and official documentation. Of course you can also come to the TSG for help.
+
The TSG uses the version 1.15.0. Open a command and type the following to find the version used:
 +
 
 +
<code style="background-color:#000; color:#fff; padding:1px 3px;">c:>python</code><br/>
 +
<code style="background-color:#000; color:#fff; padding:1px 3px;">>>> import pylsl</code><br/>
 +
<code style="background-color:#000; color:#fff; padding:1px 3px;">>>> print(pylsl.__version__)</code><br/>
    
==Usage==
 
==Usage==
''(Under Construction)''<br/>
+
=== Python ===
We are working on templates and tips. Stay tuned!
+
A short example for sending lsl streaming data:
*[[Unity/Timing]]
+
<syntaxhighlight lang="python" line>
 +
#!/usr/bin/env python
 +
 
 +
import threading
 +
from pylsl import StreamInfo, StreamOutlet
 +
 
 +
def getData():
 +
    while running:
 +
        buffer_in = getSensorData()
 +
        send_data = True
 +
        time.sleep(0.001)
 +
 
 +
info = StreamInfo(
 +
    name='MyStream',
 +
    type='COP',
 +
    channel_count=4,
 +
    nominal_srate = 200,
 +
    source_id='BalanceBoard_stream'
 +
    )
 +
outlet = StreamOutlet(info)
 +
 
 +
threading.Thread(target=getData).start()
 +
while running == True:
 +
if send_data:
 +
outlet.push_chunk(buffer_in)
 +
send_data = False
 +
</syntaxhighlight>
 +
 
 +
A short example for receiving lsl data:
 +
<syntaxhighlight lang="python" line>
 +
#!/usr/bin/env python
   −
===Builds===
+
from pylsl import StreamInlet, resolve_stream
We advise not to run your experiment from the Unity Editor, this will cause unwanted overhead that harms the performance. You can create a PC Standalone build to run it on our [[Computers | lab computers]].
     −
==References==
+
streams = resolve_stream('name', 'MyStream')
<references />
+
#streams = resolve_streams()
   −
==External Links== <!-- Optional -->
+
inlet = StreamInlet(streams[0])
*{{Official website|https://unity3d.com}}
+
while True:
*[https://docs.unity3d.com/Manual/index.html Official Documentation]
+
    sample, timestamp = inlet.pull_sample()
 +
    print(timestamp, sample)
 +
</syntaxhighlight>

Navigation menu