Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
If you upgrade from EmotivBCI before v3.6.5, you should notice that we change the format of training profiles so that the existing training profile (i.e. created before v3.6.5) will not be fully supported. We call them readonly profiles which can only run at a live mode and cannot run on training mode.
These readonly training profiles only support headsets with 14 EEG channels (i.e. EPOC X and Flex with EPOC X config mapping).
You can use the Cortex API to develop a brain–computer interface (BCI), using facial expressions, mental commands, or both.
Before you start programming your own BCI, it is strongly recommended that you use EmotivBCI to get familiar with the main BCI features of Cortex. You should also check out the EmotivBCI Node-RED Toolbox.
To use the BCI features with an EPOC Flex headset, you must use a special EEG mapping. Please see Data Subscription for details.
To get the results of the facial expression detection and the mental command detection, you must subscribe to the data streams "fac" and "com" respectively.
To use the mental command detection, you must load a training profile that contains training data for at least one action. For the facial expression detection, the training is optional.
A profile is a persistent object that stores training data for the facial expression and mental command detections. A profile belongs to a user and is synchronized to the EMOTIV cloud.
You can use queryProfile to list the profiles of the current user. Use setupProfile to manage the profiles, and also to load or unload a profile for a headset. You can use training to add training data to a profile.
Before v3.6.5, a profile can be loaded for both Epoc/Flex and Insight. Since v3.6.5, a profile can only be loaded for Epoc/Flex or Insight since their EEG channels are different. If you upgrade from version before 3.6.5, the existing profiles will become readonly. See Readonly training profile.
The training works that same for the mental command detection and the facial expression detection. However, they don't use the same actions, events or controls. So you should call getDetectionInfo to know what actions, controls and events you can use for each detection.
Before you start a training, you must subscribe to the data stream "sys" to receive the training events from Cortex. Then you can follow these steps:
Start the training by calling training with the action you want to train and the control "start".
On the "sys" stream, you receive the event "started".
After a few seconds, you receive one of these two events:
Event "succeeded", the training is a success. Now you must accept it or reject it.
Event "failed", the data collected during the training is of poor quality, you must start over from the beginning.
Call training with the control "accept" to add the training to the profile. Or you can use the control "reject" to reject this training, and then you must start over from the beginning.
Cortex sends the event "completed" to confirm that the training was successfully completed.
You should save the profile to persist this training. If you unload the profile without saving, then the training is lost.
After step 2, but before step 3, you can send the control "reset" to cancel the training.
The following chart illustrates the flow of BCI training with corresponding request for each step:
The following chart illustrates the streaming of Mental Commands data in live:
This method is to control the training of the mental command and facial expression detections. Before you start a training, you should to the "sys" data stream.
See for details.
To get the available status for a detection, call , and check the field controls of the result object. Or you can check this list:
However, note that for the facial expression detection, only these actions can be trained: "neutral", "surprise", "frown", "smile", "clench".
The result is an object containing these fields:
Start a mental command training for the action "push".
Accept a successful training for the action "push".
This method is to manage the training profiles of the user.
You create, rename or delete a profile. You can load and unload a profile for a headset if the EEG channels of this headset is supported by this training profile. And you can save a profile after the user completed a , or after you changed the of the profile.
Before you load or unload a profile, you can call to know if a profile is currently loaded, and if it was loaded by your application.
Depending on the status, this method has different effects, and uses different parameters.
Create a new profile. It can be an empty profile, or a copy of a loaded profile.
Load an existing profile for a specific headset. If a profile is already loaded, then you must unload it first.
Unload the profile of a specific headset. After the unload, this headset will use a default empty profile. You should set the parameter profile to an empty string. You cannot unload a profile that was loaded by another application.
Save the profile used by a headset. You can save it with a new name, so it creates a new profile. Or you can save it with the same name, ie the name you used to load it. You cannot save a profile that was loaded by another application.
Rename an existing profile.
Delete an existing profile. If this profile is loaded for a headset, then it is automatically unloaded. You cannot delete a profile that is currently loaded by another application.
The result is an object containing these fields:
To get the available actions for a detection, call , and check the field actions of the result object.
Name
Type
Required
Description
cortexToken
string
yes
A token returned by authorize.
uuid
string
The unique ID of this profile.
name
string
The name of the profile.
readOnly
boolean
If a headset is created before v3.6.5, the profile will become read-only when upgrading to v3.6.5. See readonly profile. This field is available since v3.6.5.
eegChannels
array
The list of EEG channels of a headset with which this profile can be loaded.
For example, if eegChannels
of a profile is ["AF3","T7","Pz","T8","AF4"], this profile can be loaded for Insight headset.
This field is available since v3.6.5.
Name
Type
Required
Description
detection
string
yes
Must be "mentalCommand" or "facialExpression".
Name
Type
Description
actions
array of strings
The actions that this detection can detect.
controls
array of strings
The list of the status you can use when you call the training method.
events
array of strings
The events you can receive in the "sys" data stream when you train this detection.
signature
array of strings
The different types of signature that you can get or set with facialExpressionSignatureType.
Name | Type | Description |
action |
| The action you set in the request. |
status |
| The status you set in the request. |
message |
| A success message. |
Name | Type | Required | Description |
profile |
| yes | The name of the profile to load. |
headset |
| yes | The id of the headset to load the profile to. |
Name | Type | Required | Description |
headset |
| yes | The id of the headset to unload the profile. |
profile |
| yes | Cortex will ignore this parameter. Should be an empty string. |
Name | Type | Required | Description |
headset |
| yes | The profile used by this headset will be saved. |
profile |
| yes | The name of the profile. If no profile with that name exists, then the method creates a new profile. If it is the name of the profile that was previously loaded to this headset, then the method saves to this profile. |
Name | Type | Required | Description |
profile |
| yes | The name of the profile you want to rename. |
newProfileName |
| yes | The new name of the profile. |
Name | Type | Required | Description |
profile |
| yes | The name of the profile you want to delete. |
Name | Type | Description |
action |
| The status you used in the request. |
name |
| The profile you used in the request. |
message |
| A success message. |
Name | Type | Required | Description |
cortexToken |
| yes |
headset |
| yes |
Name | Type | Description |
name |
| The name of the loaded profile, or |
loadedByThisApp |
|
This field was added in Cortex 2.1 |
Name | Type | Required | Description |
cortexToken |
| yes |
headset |
| yes |
Name | Type | Description |
action |
| Is always "load". |
name |
| Is always "Guest Profile". |
message |
| A success message. |
Name | Type | Required | Description |
cortexToken |
| yes |
session |
| yes |
detection |
| yes | Must be "mentalCommand" or "facialExpression". |
status |
| yes | Control what this method does, like start the training, or cancel it... Available status depends on which detection you selected. |
action |
| yes | The action you want to train. Available actions depends on which detection you selected. |
Status | Description |
start | Start a new training for the specified action. |
accept | Accept a successful training and add it to the profile. |
reject | Reject a successful training. It is not added to the profile. |
reset | Cancel the current training. |
erase | Erase all the training data for the specified action. |
Name | Type | Required | Description |
cortexToken |
| yes |
status |
| yes | Must be "create", "load", "unload", "save", "rename" or "delete". |
profile |
| yes | The name of the profile. |
headset |
| yes or no, depending on "status" |
newProfileName |
| no | If the status is "rename", then you must set this parameter, and it is the new name of the profile. |
Name | Type | Required | Description |
profile |
| yes |
headset |
| yes | If omitted, create an empty profile. If set, create a copy of the profile currently loaded for this headset. |
A token returned by .
A headset id returned by .
A token returned by .
A headset id returned by .
A token returned by .
A session id returned by . The training will be for the headset linked to this session.
A token returned by .
A headset id returned by .
The name of the new profile. It must be unique for the user. Use to check if a name is already in use.