//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(); } }
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(); }
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(); }