Exemple #1
0
    static void engine_CognitivEmoStateUpdated(object sender, EmoStateUpdatedEventArgs e)
    {
        //Debug.LogError("CognitivEmoStateUpdated");
        isNotResponding = false;
        EmoState es = e.emoState;

        EdkDll.EE_CognitivAction_t cogAction = es.CognitivGetCurrentAction();
        currentCognitivAction = cogAction.ToString();
        //Debug.LogError(cogAction);
        float power = (float)es.CognitivGetCurrentActionPower();

        //Debug.LogError(power + ":" +(uint)cogAction);
        //CognitivActionPower[(uint)cogAction] = power;
        for (int i = 1; i < cognitivActionList.Length; i++)
        {
            if (cogAction == cognitivActionList[i])
            {
                CognitivActionPower[i] = power;
                //Debug.LogError(CognitivActionPower[i] + "----------------------");
            }
            else
            {
                CognitivActionPower[i] = 0;
            }
        }
    }
Exemple #2
0
        private void engine_CognitivEmoStateUpdated(object sender, EmoStateUpdatedEventArgs e)
        {
            EmoState     es            = e.emoState;
            FlightWindow outer         = new FlightWindow();
            Single       timeFromStart = es.GetTimeFromStart();
            Single       power         = es.CognitivGetCurrentActionPower();      // get power

            EdkDll.EE_CognitivAction_t cogAction = es.CognitivGetCurrentAction(); // get detected command

            Boolean isActive = es.CognitivIsActive();

            textBox1.Text = "Action:" + cogAction.ToString() + "|" + "Power" + power;
            switch (cogAction)
            {
            case EdkDll.EE_CognitivAction_t.COG_NEUTRAL:
            {
                count_clear("tf");
                outer.manualHover();           //forcing manula hovering.
                break;
            }

            case EdkDll.EE_CognitivAction_t.COG_PUSH:
            {
                count_clear("tf");
                outer.button1_Click(sender, e);                // forward command
                break;
            }

            case EdkDll.EE_CognitivAction_t.COG_PULL:
            {
                count_clear("t");
                if (forward_count % 2 == 0)
                {
                    outer.Backwards_Click(sender, e);              // forwad backward
                }
                forward_count++;

                break;
            }

            case EdkDll.EE_CognitivAction_t.COG_LIFT:
            {
                // if (takeoff_bool == false)
                // {
                if (takeoff_count % 3 == 0)
                {
                    outer.Takeoff_Click(sender, e);             // takeoff
                }

                //takeoff_bool = true;

                //}
                //else
                //{
                //    // already take off so rotate
                //    if (takeoff_count % 2 == 0)
                //    {
                //        outer.button7_Click(sender, e); /// more up
                //    }
                takeoff_count++;
                //}
                count_clear("f");

                break;
            }

            case EdkDll.EE_CognitivAction_t.COG_DROP:
            {
                outer.Landing_Click(sender, e);          // landing
                count_clear("tf");
                takeoff_bool = false;
                break;
            }
            }


            // Console.Write("{0}", cogAction);
            cogLog.WriteLine("{0},{1},{2},{3}", timeFromStart, cogAction, power, isActive);   // writing to log file
            cogLog.Flush();
        }