hagino3000's blog

平成アーカイブス (更新停止)

エンジニアサポート新年会 CROSS 2012でEmotivについてLTをしました

日本ではあまり使っている人を見ない筋電/脳波ヘッドセットのEmotiv EPOC neuroheadsetを使ってみた。デモはNodejsでデータ飛ばしてCanvasに描画した。視線の位置のxyが取れるのでそれを使った方が面白かったかなぁ。

JavaのコードはSDKのサンプルをベースにJSON作っただけ。状態を取る部分のコードは次の通り。

JSONObject currentState = new JSONObject();

Edk.INSTANCE.EE_EmoEngineEventGetEmoState(eEvent, eState);
float timestamp = EmoState.INSTANCE.ES_GetTimeFromStart(eState);

JSONArray actions = new JSONArray();
if (EmoState.INSTANCE.ES_ExpressivIsBlink(eState) == 1) {
    actions.put("Blink");
}
if (EmoState.INSTANCE.ES_ExpressivIsLeftWink(eState) == 1) {
    actions.put("Left Wink");
}
if (EmoState.INSTANCE.ES_ExpressivIsRightWink(eState) == 1) {
    actions.put("Right Wink");
}
if (EmoState.INSTANCE.ES_ExpressivIsLookingLeft(eState) == 1) {
    actions.put("Looking Left");
}
if (EmoState.INSTANCE.ES_ExpressivIsLookingRight(eState) == 1) {
    actions.put("Looking Right");
}
if (EmoState.INSTANCE.ES_ExpressivIsLookingDown(eState) == 1) {
    actions.put("Looking Down");
}
currentState.put("actions", actions);

currentState.put("Excitement ShortTerm", EmoState.INSTANCE.ES_AffectivGetExcitementShortTermScore(eState));
currentState.put("Excitement LongTerm", EmoState.INSTANCE.ES_AffectivGetExcitementLongTermScore(eState));
currentState.put("Engagement Boredom", EmoState.INSTANCE.ES_AffectivGetEngagementBoredomScore(eState));
currentState.put("Frustration", EmoState.INSTANCE.ES_AffectivGetFrustrationScore(eState));
currentState.put("Meditation", EmoState.INSTANCE.ES_AffectivGetMeditationScore(eState));

send("state", currentState.toString());