Closed NarinderBrar closed 4 years ago
Update, According to following link in "Getting live actions" https://emotiv.gitbook.io/cortex-api/bci
We have query profile, and got 2 existing profiles.
When we try to load one profile, got following 2 msgs in console.
Msg 1:
Received: Invalid Parameters.
UnityEngine.Debug:Log(Object)
EmotivUnityPlugin.CortexClient:WebSocketClient_MessageReceived(Object, MessageReceivedEventArgs) (at Assets/Plugins/Emotiv-Unity-Plugin/Src/CortexClient.cs:234)
WebSocket4Net.WebSocket:FireMessageReceived(String)
WebSocket4Net.Command.Text:ExecuteCommand(WebSocket, WebSocketCommandInfo)
WebSocket4Net.WebSocket:ExecuteCommand(WebSocketCommandInfo)
WebSocket4Net.WebSocket:OnDataReceived(Byte[], Int32, Int32)
WebSocket4Net.WebSocket:client_DataReceived(Object, DataEventArgs)
SuperSocket.ClientEngine.ClientSession:OnDataReceived(Byte[], Int32, Int32)
SuperSocket.ClientEngine.AuthenticatedStreamTcpSession:OnDataRead(IAsyncResult)
System.Runtime.CompilerServices.AsyncTaskMethodBuilder1:SetResult(Int32) Mono.Net.Security.<StartOperation>d__58:MoveNext() System.Runtime.CompilerServices.AsyncTaskMethodBuilder
1:SetResult(AsyncProtocolResult)
Mono.Net.Security.1:SetResult(Nullable
1)
Mono.Net.Security.
Msg 2:
MessageErrorRecieved :code -32602 message Invalid Parameters.method name setupProfile
UnityEngine.Debug:Log(Object)
EmotivUnityPlugin.DataStreamProcess:MessageErrorRecieved(Object, ErrorMsgEventArgs) (at Assets/Plugins/Emotiv-Unity-Plugin/Src/DataStreamProcess.cs:297)
EmotivUnityPlugin.CortexClient:WebSocketClient_MessageReceived(Object, MessageReceivedEventArgs) (at Assets/Plugins/Emotiv-Unity-Plugin/Src/CortexClient.cs:236)
WebSocket4Net.WebSocket:FireMessageReceived(String)
WebSocket4Net.Command.Text:ExecuteCommand(WebSocket, WebSocketCommandInfo)
WebSocket4Net.WebSocket:ExecuteCommand(WebSocketCommandInfo)
WebSocket4Net.WebSocket:OnDataReceived(Byte[], Int32, Int32)
WebSocket4Net.WebSocket:client_DataReceived(Object, DataEventArgs)
SuperSocket.ClientEngine.ClientSession:OnDataReceived(Byte[], Int32, Int32)
SuperSocket.ClientEngine.AuthenticatedStreamTcpSession:OnDataRead(IAsyncResult)
System.Runtime.CompilerServices.AsyncTaskMethodBuilder1:SetResult(Int32) Mono.Net.Security.<StartOperation>d__58:MoveNext() System.Runtime.CompilerServices.AsyncTaskMethodBuilder
1:SetResult(AsyncProtocolResult)
Mono.Net.Security.1:SetResult(Nullable
1)
Mono.Net.Security.
Hi @NarinderBrar 1) For first question:
Following function from DataStreamManager class printing only NEUTRAL command with 0 pow value.
It is default data because no profile. You need a trained profile (a least one action trained) and subscribe "com", you may see different value. It look like Live mode when you do with BCI Application. We have some minor update. Please pull the latest. Currently, we have not supported Training with a UI yet. So i will guide you with some snippets: ` // 1.change app config and start authorize such as unity-example ...
// 2. Create and init BCITraining BCITraining _bciTraining = new BCITraining(); _bciTraining.Init();
// 3. connect to headset and then subscribe data. You need subscribe {"dev", "sys", "com", "fac"}
List
// 4. Query Profiles and load an existed profile. You might see the data at OnMentalCommandReceived()
// 5. Do some training ...` 2) For error"Invalid parameter" when you load profile. Please make sure the profile is not using other Apps (BCI ..) and please reference to doc[https://emotiv.gitbook.io/cortex-api/bci/setupprofile] If the issue still happen, please send us the request you sent to Cortex. Thanks
Thanks, Now its working
Following is the code
using System.Collections; using System.Collections.Generic; using UnityEngine; using EmotivUnityPlugin;
public class TestTraining : MonoBehaviour { BCITraining _bciTraining = new BCITraining();
void Start()
{
_bciTraining.Init();
}
public void Sub()
{
List<string> dataStreamList = new List<string>() { DataStreamName.DevInfos, DataStreamName.SysEvents, DataStreamName.MentalCommands };
DataStreamManager.Instance.SubscribeMoreData(dataStreamList);
}
public void GetDetectionInfo()
{
_bciTraining.GetDetectionInfo("mentalCommand");
}
public void QueryProfile()
{
_bciTraining.QueryProfile();
}
public void LoadProfile()
{
_bciTraining.LoadProfile("OpenMenu");
}
}
We are unable to access mental commands from a trained profile.
Following function from DataStreamManager class printing only NEUTRAL command with 0 pow value.
Also with the help of BCITraining class, we are able to create a profile, and can also print the list of all available profiles, even from native emotive applications.
But we are not able to apply these trained commands in applications.
Thanks for help in advance.