Ejemplo n.º 1
0
        public double GetParam(Ctrl ctrl, PID.Param param)
        {
            double ans = double.MaxValue;

            lock (this.pidMutex)
            {
                switch (ctrl)
                {
                case Ctrl.THROTTLE:
                    if (this.throttlePid != null)
                    {
                        ans = this.throttlePid.GetParam(param);
                    }
                    break;

                case Ctrl.ROLL:
                    if (this.rollPid != null)
                    {
                        ans = this.rollPid.GetParam(param);
                    }
                    break;

                case Ctrl.PITCH:
                    if (this.pitchPid != null)
                    {
                        ans = this.pitchPid.GetParam(param);
                    }
                    break;

                case Ctrl.YAW:
                    if (this.yawPid != null)
                    {
                        ans = this.yawPid.GetParam(param);
                    }
                    break;
                }
            }
            return(ans);
        }
Ejemplo n.º 2
0
        public bool RefreshParam(Ctrl ctrl, PID.Param param, double val)
        {
            bool ok = false;

            lock (this.pidMutex)
            {
                switch (ctrl)
                {
                case Ctrl.THROTTLE:
                    if (this.throttlePid != null)
                    {
                        ok = this.throttlePid.RefreshParam(param, val);
                    }
                    break;

                case Ctrl.ROLL:
                    if (this.rollPid != null)
                    {
                        ok = this.rollPid.RefreshParam(param, val);
                    }
                    break;

                case Ctrl.PITCH:
                    if (this.pitchPid != null)
                    {
                        ok = this.pitchPid.RefreshParam(param, val);
                    }
                    break;

                case Ctrl.YAW:
                    if (this.yawPid != null)
                    {
                        ok = this.yawPid.RefreshParam(param, val);
                    }
                    break;
                }
            }
            return(ok);
        }