Releases: neurotechcenter/UnityBCI2000
Version 2.0.0-b5
Added a couple of Unity helper methods:
PollSystemState:
Asynchronously wait for a specified system state within a coroutine
CurrentSampleOffset
Due to how BCI2000 handles data (signal, events) in blocks, it is not possible to get the most recently captured sample. In lieu of this, we instead get the value of the sample exactly one block length after it is collected, so as to normalize the latency.
This should be the final beta release before 2.0.0
Version 2.0.0-b4
- Fixed loading of parameter files
- Updated BCI2000RemoteNET to 1.0.0-b3, which adds system logging and per-sample event access.
Version 2.0.0-b3
- Fixed freeze when connecting to already-running operator
Version 2.0.0-b2
- Compatible with version 1.0.0-b2 of BCI2000RemoteNET
- Removed unnecessary files
- Updated readme
Version 2.0.0-b1
UnityBCI2000 has been rewritten to use the new version of the BCI2000RemoteNET library. This will bring more reliable communication and control of BCI2000.
Interface changes are extensive, and migration to version 2.0 is non-trivial, but recommended for reliability and ease of maintenance.
The major interface changes are as follows:
-
Starting a local operator is now explicit through the
StartLocalOperator
option, which will start the operator whose executable is located atOperatorPath
listening for input atOperatorAddress:OperatorPort
. -
Control of BCI2000 is done directly through BCI2000RemoteNET, unifying the interface and removing the shim layer of
UnityBCI2000
methods. This is done by going through theControl
member property ofUnityBCI2000
, for example, in order to set an event:
UnityBCI2000 bci = ...; bci.Control.SetEvent("event", 1);
BCI2000RemoteNET is found here: https://github.com/neurotechcenter/BCI2000RemoteNET
Full documentation will be hosted on bci2000.org soon, but the source code is fully documented and html documentation can be generated using doxygen.
The Control
property cannot be accessed during scene initialization (Awake, Start) during scene initialization due to how the order of initialization of game objects being undefined. UnityBCI2000
instead provides methods OnIdle()
and OnConnected()
which take Action<BCI2000Remote>
delegates and run them with the BCI2000Remote
instance during Start()
, before and after BCI2000's modules are started, respectively. This is to provide a way to ensure that certain operations such as adding events or setting parameters occur when BCI2000 is in a valid state to do so, as, for example, events and parameters cannot be added once the BCI2000 modules have started.
Adding a parameter to BCI2000:
void Awake() { UnityBCI2000 bci = ...; bci.OnIdle( bci => { bci.AddParameter("Application:AParam", "AParam", "1"); }); }
Adding and visualizing events:
void Awake() { UnityBCI2000 bci = ...; bci.OnIdle( bci => { bci.AddEvent("EventX", 32, 0); bci.AddEvent("EventY", 16, 0); }); bci.OnConnected( bci => { bci.Visualize("EventX"); bci.Visualize("EventY"); }); }
Keep in mind that these only have a defined order if BCI2000's startup is not being controlled manually, that is, if options such as StartModules
, StartWithScene
, etc. are left as default. Otherwise they simply run the commands during the Start()
method. For example, if BCI2000 is already running and you are simply connecting to it, trying to use BCI2000Remote.AddEvent()
will fail no matter what.
Note on BCI2000RemoteNET:
UnityBCI2000 uses the .NET Standard version of BCI2000RemoteNET, maintained on the netstandard2.1
branch. If you are compiling BCI2000RemoteNET yourself, make sure you compile from that branch. This will hopefully cease to be a problem when Unity implements support for .NET 8.0.
1.0.1
Updated BCI2000RemoteNET.dll
BCI2000RemoteNET.dll changelog:
- Fixed a bug which would cause connections to an already-running BCI2000 operator using TelnetIp and TelnetPort to fail
1.0.0
UnityBCI2000
v0.3.2
Updated BCI2000RemoteNET version
Added default log file name
v0.3.1
Implemented functionality of AddParam and SetParam
0.3.0b
Further simplified interface, updated for use with newest version of BCI2000RemoteNET