Follow

Emotiv Xavier Tools: XavierEmoKey

XavierEmoKey allows you to connect detection results received from the EmoEngine to predefined keystrokes according to easy-to-define, logical rules.  This functionality may be used to experiment with the headset as an input controller during application development.  It also provides a mechanism for integrating the Emotiv neuroheadset with a preexisting application via the application’s legacy keyboard interface.  

Introduction to XavierEmoKey

XavierEmoKey translates Emotiv detection results to predefined sequences of keystrokes according to logical rules defined by the user through the XavierEmoKey user interface.  A set of rules, known as an “EmoKey Mapping”, can be saved for later reuse.  XavierEmoKey communicates with Emotiv EmoEngine in the same manner as a third-party application would: by using the Emotiv API exposed by InsightEDK.dll.  

Connecting XavierEmoKey to Emotiv EmoEngine

By default, XavierEmoKey will attempt to connect to Emotiv Xavier when the application launches.  If Emotiv Xavier isn’t running, then XavierEmoKey will display a warning message above the system tray.  The reason XavierEmoKey connects to the Xavier SDK, instead of connecting directly to the EmoEngine and the neuroheadset, is to allow the user to select his profile, configure the detection suite settings, and get contact quality feedback through the Xavier SDK user interface.  

XavierEmoKey can also be connected to XavierComposer.  This is useful when creating and testing a new EmoKey Mapping since the user can easily generate EmoState update events that satisfy the conditions for rules defined in XavierEmoKey.  Refer to the XavierComposer page for more information. 

XavierEmoKey Connect Menu

XavierEmoKey’s connection settings can be changed by using the application’s Connect menu. If XavierEmoKey is not able to connect to the target application (usually because the connection target is not running), then the XavierEmoKey icon in the system tray will be drawn as gray, instead of orange). If this occurs, then run the desired application (either Xavier Driver or Xavier Composer ) and then select Reconnect from the Connect menu.

Configuring XavierEmoKey Rules

The figure above shows an example of an EmoKey Mapping as it might be configured to communicate with an Instant Messenger (IM) application. In this example, XavierEmoKey will translate Blink events generated by Emotiv's Facial Expression suite to the text "LOL" (as long as the Facial Expression's Instantaneous Excitement detection is also reporting a score >0.3), which causes the IM program to send "LOL" automatically when the user is blinking. 

The topmost table in XavierEmoKey contains user interface controls that allow you to define rules that specify which keystrokes are emulated. Rules can be added by clicking on the Add Rule button. Existing rules can be deleted by selecting the appropriate row and pressing the Delete Rule button. Rules can be edited as outlined in the table below. 

Field

Description

Notes

Enabled

Checkbox to selectively enable or disable individual rules

The indicator “light” will turn green when the rule conditions are satisfied.

Player

Identifies the neuroheadset that is associated with this rule

Player 1 corresponds to user ID 0 in Xavier Composer and Xavier SDK.

Name

User-friendly rule name

Edit by double clicking on the cell.

Key

Keystroke sequence to be sent to the Windows input queue

Edit by double clicking on the cell.

Behavior

Checkbox to control whether the key sequence is sent only once, or repeatedly, each time an EmoState update satisfies the rule conditions

If checked, then XavierEmoKey must receive an EmoState update that does NOT satisfy the rule’s conditions before this rule can be triggered again.

XavierEmoKey Keyboard Emulation

XavierEmoKey emulates a Windows-compatible keyboard and sends keyboard input to the Windows operating system’s input queue.  The application with the input focus will receive the emulated keystrokes.  In practice, this often means that XavierEmoKey is run in the background.  Please note that closing the XavierEmoKey window will only hide the application window and that it will continue to run.  When running, the XavierEmoKey/Emotiv icon will be visible in the Windows system tray.  Double-click on this icon to bring XavierEmoKey back to the foreground.  Choose Quit from the Application or system-tray menu to really quit the application.

The Keys dialog allows the user to specify the desired keystrokes and customize the keystroke behavior.  The customizable options include:

  • Holding a key press: hold the key down for the duration of the rule activation period.  The Hold the key checkbox is only enabled when a single key has been specified in the keystroke edit box.
  • Hot keys or special keyboard keys: any combination of control, alt, shift, the Windows key, and another keystroke.  You may also use this option if you need to specify special keys such as Caps Lock, Shift, or Enter.
  • Key press duration and delay times: some applications, especially games, are sensitive to the timing of key presses.  If necessary, use these controls to adjust the simulated keyboard behavior.

Configuring XavierEmoKey Rule Trigger Conditions

The Trigger Conditions table in XavierEmoKey contains user interface controls that allow you to define logical conditions that determine when the corresponding rule is activated. Clicking on a new rule in the Rules table will refresh the contents of the Trigger Conditions table, causing it to display only the condition associated with the selected rule. 

Conditions can be added by clicking on the Add Condition button. Existing rules can be deleted by selecting the appropriate condition and pressing the Delete Condition button. All enabled conditions must be satisfied by the most recent EmoState update received from the Xavier SDK or Xavier Composer for a rule to be triggered. An example of conditions examining the Facial Expression laugh detection and the Performance Metric Instantaneous Excitement detection can be seen with the associated LOL rule in the above screen grabs. 

 

The fields of the Trigger Conditions table are described in the below table. 

Field

Description

Enabled

Checkbox to selectively enable or disable individual trigger conditions

Action

The name of the Expressiv  expression, Affectiv™detection, or Cognitiv action being examined by this condition.

Trigger

Description of the trigger condition being evaluated

Value

For non-binary trigger conditions, the value being compared to the action score returned by the designated detection

Double clicking on any of the fields of a condition in the Trigger Conditions table will reveal the Configure Condition dialog box. Use the controls on this dialog to specify an action (or detection) name, a comparison function, and a value that must evaluate to true for this condition to be satisfied.  

Saving Rules to a XavierEmoKey Mapping file

XavierEmoKey allows you to save the current set of rule definitions to a XavierEmoKey Mapping file that can be reloaded for subsequent use. Use the appropriate command in XavierEmoKey's Application menu to rename, save, and load EmoKey mapping files. 

 

Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request

Comments

Powered by Zendesk