| 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)] |
| | }} | | }} |
| | }} | | }} |
| Line 46: |
Line 52: |
| | | | |
| | ===Versions=== | | ===Versions=== |
| − | The TSG uses the version 1.15.0. Open a command to find your version used: | + | 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;">c:>python</code><br/> |
| Line 53: |
Line 59: |
| | | | |
| | ==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> |