コード例 #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();
        //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;
            }
        }
    }
コード例 #2
0
        //Update fields when Emo state updated
        void CognitivEmoStateUpdated()
        {
            if (FEmoState[0] != null)
            {
                EmoState es = FEmoState[0];

                mCogAction = es.CognitivGetCurrentAction();
                mPower     = es.CognitivGetCurrentActionPower();
                mIsActive  = es.CognitivIsActive();
            }
        }
コード例 #3
0
    private static void engine_CognitivEmoStateUpdated(object sender, EmoStateUpdatedEventArgs e)
    {
        EmoState emoState = e.emoState;

        EdkDll.EE_CognitivAction_t eE_CognitivAction_t = emoState.CognitivGetCurrentAction();
        float num = emoState.CognitivGetCurrentActionPower();

        for (int i = 1; i < EmoCognitiv.cognitivActionList.Length; i++)
        {
            if (eE_CognitivAction_t == EmoCognitiv.cognitivActionList[i])
            {
                EmoCognitiv.CognitivActionPower[i] = num;
            }
        }
    }
コード例 #4
0
        static void engine_CognitivEmoStateUpdated(object sender, EmoStateUpdatedEventArgs e)
        {
            EmoState es = e.emoState;

            Single timeFromStart = es.GetTimeFromStart();

            EdkDll.EE_CognitivAction_t cogAction = es.CognitivGetCurrentAction();
            Single  power    = es.CognitivGetCurrentActionPower();
            Boolean isActive = es.CognitivIsActive();

            cogLog.WriteLine(
                "{0},{1},{2},{3}",
                timeFromStart,
                cogAction, power, isActive);
            cogLog.Flush();
        }
コード例 #5
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();
        }