示例#1
0
        public void Update(VesselAutopilot.VesselRSAS rsas)
        {
            PIDRclamp[] sasPID = new PIDRclamp[3];
            sasPID[(int)SASList.Pitch] = rsas.pidPitch;
            sasPID[(int)SASList.Bank] = rsas.pidRoll;
            sasPID[(int)SASList.Hdg] = rsas.pidYaw;

            foreach (SASList s in Enum.GetValues(typeof(SASList)))
            {
                PIDGains[(int)s, 0] = sasPID[(int)s].KP;
                PIDGains[(int)s, 1] = sasPID[(int)s].KI;
                PIDGains[(int)s, 2] = sasPID[(int)s].KD;
            }
        }
示例#2
0
        // used for adding a new stock preset
        public RSASPreset(VesselAutopilot.VesselRSAS rsas, string Name)
        {
            name = Name;

            PIDRclamp[] rsasPID = new PIDRclamp[3];
            rsasPID[(int)SASList.Pitch] = rsas.pidPitch;
            rsasPID[(int)SASList.Bank] = rsas.pidRoll;
            rsasPID[(int)SASList.Hdg] = rsas.pidYaw;

            foreach (SASList s in Enum.GetValues(typeof(SASList)))
            {
                PIDGains[(int)s, 0] = rsasPID[(int)s].KP;
                PIDGains[(int)s, 1] = rsasPID[(int)s].KI;
                PIDGains[(int)s, 2] = rsasPID[(int)s].KD;
            }
        }
示例#3
0
        private void drawPIDValues(PIDRclamp controller, string inputName, SASList controllerID)
        {
            stockPIDDisplay[(int)controllerID] = GUILayout.Toggle(stockPIDDisplay[(int)controllerID], inputName, GeneralUI.UISkin.customStyles[(int)myStyles.btnToggle]);

            if (stockPIDDisplay[(int)controllerID])
            {
                float kp, ki, kd;
                kp = (float)GeneralUI.labPlusNumBox(GeneralUI.KpLabel, controller.KP.ToString(), 45);
                ki = (float)GeneralUI.labPlusNumBox(GeneralUI.KiLabel, controller.KI.ToString(), 45);
                kd = (float)GeneralUI.labPlusNumBox(GeneralUI.KdLabel, controller.KD.ToString(), 45);

                if (kp != controller.KP || ki != controller.KI || kd != controller.KD)
                    controller.ReinitializePIDsOnly(kp, ki, kd);
            }
        }