Example #1
0
 public PIDSample(Autopilot.PID pid)
 {
     p     = pid.p;
     i     = pid.i;
     d     = pid.d;
     total = pid.outputValue;
 }
 private void DrawContent(int windowID)
 {
     GUILayout.BeginVertical();
     GUI.DragWindow(new Rect(0, 0, 10000, 20));
     if (GUILayout.Button(modeStrings[displayMode]))
     {
         watchPID    = null;
         displayMode = (displayMode + 1) % 3;
     }
     GUILayout.Box(drawTexture);
     GUILayout.BeginHorizontal();
     GUILayout.Label("P", GUILayout.MaxWidth(30));
     pString = GUILayout.TextField(pString);
     GUILayout.EndHorizontal();
     GUILayout.BeginHorizontal();
     GUILayout.Label("I", GUILayout.MaxWidth(30));
     iString = GUILayout.TextField(iString);
     GUILayout.EndHorizontal();
     GUILayout.BeginHorizontal();
     GUILayout.Label("D", GUILayout.MaxWidth(30));
     dString = GUILayout.TextField(dString);
     GUILayout.EndHorizontal();
     if (GUILayout.Button("Save"))
     {
         SavePIDs();
     }
     GUILayout.EndVertical();
 }
 public void SetPID(Autopilot.PID pid)
 {
     if (watchPID == null)
     {
         watchPID = pid;
         pString  = pid.kP.ToString();
         iString  = pid.kI.ToString();
         dString  = pid.kD.ToString();
     }
 }