private void OnDeactiveClick(int ActionID)
 {
     EmoMentalCommand.EnableMentalCommandAction(EmoMentalCommand.MentalCommandActionList[ActionID], false);
     EmoMentalCommand.EnableMentalCommandActionsList();
     Debug.Log("Deactive " + array_CogActionList[ActionID]);
     trainClearShow = false;
 }
예제 #2
0
    /// <summary>
    /// set action for the posAction Button = actionID
    /// </summary>
    /// <param name="possAction"></param>
    /// <param name="actionID"></param>
    void ChooseAction(int posAction, int actionID)
    {
        // set str_ActionChoose
        if (actionID != 0)
        {
            str_ActionChoose[posAction] = array_CogActionList[actionID];
        }
        else
        {
            str_ActionChoose[posAction] = "Choose Action";
        }


        // recheck enable, disable Actions
        for (int l = 1; l < 14; l++)
        {
            //EnableMentalCommandAction
            EmoMentalCommand.EnableMentalCommandAction(EmoMentalCommand.MentalCommandActionList[l], false);
        }

        for (int i = 1; i < 14; i++)
        {
            for (int j = 0; j < 3; j++)
            {
                if (str_ActionChoose[j] == array_CogActionList[i])
                {
                    EmoMentalCommand.EnableMentalCommandAction(EmoMentalCommand.MentalCommandActionList[i], true);
                }
            }
        }

        EmoMentalCommand.EnableMentalCommandActionsList();
    }
    void OnGUI()
    {
        if (trainClearShow)
        {
            if (GUI.Button(new Rect(130 + 230, 20, 50, 20), "Train"))
            {
                OnTrainClick(curAction);
            }
            if (GUI.Button(new Rect(190 + 230, 20, 50, 20), "Clear"))
            {
                OnClearClick(curAction);
            }
        }
        if (GUI.Button(new Rect(250 + 230, 20, 80, 20), "Deactive"))
        {
            OnDeactiveClick(curAction);
        }

        vec2_Scroll = GUI.BeginScrollView(new Rect(120, 20, 225, 80), vec2_Scroll, new Rect(0, 0, 100, 280));

        for (int i = 0; i < 14; i++)
        {
            if (GUI.Button(new Rect(0, i * 20, 210, 20), array_CogActionList[i]))
            {
                curAction = i;
                EmoMentalCommand.EnableMentalCommandAction(EmoMentalCommand.MentalCommandActionList[i], true);
                EmoMentalCommand.EnableMentalCommandActionsList();
                trainClearShow = true;
            }
        }

        GUI.EndScrollView();
    }
예제 #4
0
    /// <summary>
    /// Initiates trainging of mental command, called by Left_Button, Right_Button, and Neutral_Button
    /// </summary>
    /// <param name="type">Command to be trained ("Neutral","Left","Right")</param>
    public void TrainAction(string type)
    {
        LoggerCSV logger = LoggerCSV.GetInstance();

        trainType = type;
        EdkDll.IEE_MentalCommandAction_t toTrain = EdkDll.IEE_MentalCommandAction_t.MC_NEUTRAL;
        cube.SetAciton(cube.ACTION_RESET);
        switch (type)
        {
        case "Left":
            toTrain = EdkDll.IEE_MentalCommandAction_t.MC_LEFT;
            logger.AddEvent(LoggerCSV.EVENT_TRAINING_L);
            break;

        case "Right":
            toTrain = EdkDll.IEE_MentalCommandAction_t.MC_RIGHT;
            logger.AddEvent(LoggerCSV.EVENT_TRAINING_R);
            break;

        default:
            logger.AddEvent(LoggerCSV.EVENT_TRAINING_N);
            break;
        }

        StartCoroutine(UI.UpdateSlider());

        EmoMentalCommand.EnableMentalCommandAction(toTrain, true);
        EmoMentalCommand.EnableMentalCommandActionsList();
        EmoMentalCommand.StartTrainingMentalCommand(toTrain);
    }
예제 #5
0
    /// <summary>
    /// Clear mental command accepted by Accept_Clear_Button,
    /// Clears all data if neutral is cleared
    /// </summary>
    /// <param name="type">Command to be trained ("Neutral","Left","Right")</param>
    public void ClearTraining()
    {
        LoggerCSV logger     = LoggerCSV.GetInstance();
        string    statusText = "Neutral";

        EdkDll.IEE_MentalCommandAction_t action = EdkDll.IEE_MentalCommandAction_t.MC_NEUTRAL;
        switch (trainType)
        {
        case "clear left":
            statusText = "Left";
            action     = EdkDll.IEE_MentalCommandAction_t.MC_LEFT;
            trainType  = "clear left";
            logger.AddEvent(LoggerCSV.EVENT_TRAINING_CLEAR_L);
            break;

        case "clear right":
            statusText = "Right";
            action     = EdkDll.IEE_MentalCommandAction_t.MC_RIGHT;
            trainType  = "clear right";
            logger.AddEvent(LoggerCSV.EVENT_TRAINING_CLEAR_R);
            break;

        default:
            logger.AddEvent(LoggerCSV.EVENT_TRAINING_CLEAR_N);
            UI.UpdateStatusText("Current Aciton: None");
            trainType = "clear neutral";
            Debug.Log(action);
            EraseAction(action);
            //Clear left and right if enabled
            //Left
            if (EmoMentalCommand.MentalCommandActionsEnabled[5])
            {
                Debug.Log("left active - clear");
                EraseAction(EdkDll.IEE_MentalCommandAction_t.MC_LEFT);
            }
            //Right
            if (EmoMentalCommand.MentalCommandActionsEnabled[6])
            {
                Debug.Log("right active - clear");
                EraseAction(EdkDll.IEE_MentalCommandAction_t.MC_LEFT);
            }
            DeactivateRL();
            //Update UI and Training cube
            UI.UpdateStatusText("Cleared " + statusText + " Training Data");
            UI.UpdateUI(trainType);
            cube.SetAciton(cube.ACTION_RESET);
            return;
        }

        EraseAction(action);
        //Deactivate cleared action
        EmoMentalCommand.EnableMentalCommandAction(action, false);
        EmoMentalCommand.EnableMentalCommandActionsList();
        //Update UI and Training cube
        UI.UpdateUI(trainType);
        UI.ActivateButtons(true);
        cube.SetAciton(cube.ACTION_RESET);
        UI.UpdateStatusText("Cleared " + statusText + " Training Data");
    }
예제 #6
0
 // Use this for initialization
 void Start()
 {
     //enable MentalCommand action
     EmoMentalCommand.EnableMentalCommandAction(EdkDll.IEE_MentalCommandAction_t.MC_LIFT, true);
     EmoMentalCommand.EnableMentalCommandAction(EdkDll.IEE_MentalCommandAction_t.MC_PUSH, true);
     EmoMentalCommand.EnableMentalCommandAction(EdkDll.IEE_MentalCommandAction_t.MC_PULL, true);
     EmoMentalCommand.EnableMentalCommandActionsList();
 }
예제 #7
0
 /// <summary>
 /// Deactivates Right and Left mental commands
 /// </summary>
 void DeactivateRL()
 {
     EmoMentalCommand.EnableMentalCommandAction(EdkDll.IEE_MentalCommandAction_t.MC_RIGHT, false);
     EmoMentalCommand.EnableMentalCommandAction(EdkDll.IEE_MentalCommandAction_t.MC_LEFT, false);
     EmoMentalCommand.EnableMentalCommandActionsList();
 }