Пример #1
0
        static void xy_cordinate(int x, int y)
        {
            //calcualte the x y cordinate and based on that cordinate pass command to the drone
            FlightWindow outer = new FlightWindow();

            if (x < -6)
            {
                //turning left
                if (left_count % 4 == 0)
                {
                    outer.manualLeft();
                }
                left_count++;
            }
            else if (x > 6)
            {
                if (right_count % 4 == 0)
                {
                    outer.manualright();
                }
                right_count++;
            }
        }
Пример #2
0
        private void flightToolStripMenuItem_Click(object sender, EventArgs e)
        {
            FlightWindow frm = new FlightWindow();

            frm.Show();
        }
Пример #3
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();
        }