Single-Order derivative function.
 public void DerivativePositiveTest10Hz()
 {
     Derivative d = new Derivative(0);
     d.Dt = 0.1;
     Assert.AreEqual(0, d.Get(0), double.Epsilon);
     for (int i = 0; i < TestRepeats; i++)
     {
         //Utility.AccurateWaitSeconds(0.1);
         Assert.AreEqual(1, d.Get(0.1 * (i + 1)), AcceptibleError);
     }
 }
예제 #2
0
        /// <summary>
        /// Creates a new instance of the SimplePID class
        /// </summary>
        /// <param name="p">Proportional constant</param>
        /// <param name="i">Integral Constant</param>
        /// <param name="d">Derivative Constant</param>
        /// <param name="min">Minimum allowed output of the PID loop</param>
        /// <param name="max">Maximum allowed output of the PID loop</param>
        public SimplePID(double p, double i, double d, double min, double max)
        {
            if(max < min)
                throw new ArgumentException($"Invalid Arguments: {max} Is less than {min}");

            m_kP = p; m_kI = i; m_kD = d;
            Max = max;
            Min = min;
            SetPoint = 0;
            m_d = new Derivative();
            m_i = new Integral();
            Continuous = false;
        }
 /// <summary>
 /// CSharpRoboticslib.Extras.EnhancedEncoder
 /// </summary>
 /// <param name="aChannel"></param>
 /// <param name="bChannel"></param>
 public EnhancedEncoder(int aChannel, int bChannel)
     : base(aChannel, bChannel)
 {
     m_velocityFilter = new Derivative();
 }