An encoder with corrected rate calculation and distance per pulse setting
Inheritance: WPILib.Encoder
コード例 #1
0
 public void EnhancedEncoderRateTest()
 {
     using (Encoder e = new EnhancedEncoder(0, 1) {Dt = 0.1})
     {
         e.Reset();
         e.Get(); //Push the value to the Derivative
         SimData.Encoder[0].Count = 4000;
         Assert.AreEqual(10000, e.GetRate());
     }
 }
コード例 #2
0
 public static void TestEnhancedTurnRate()
 {
     using (EnhancedEncoder left = new EnhancedEncoder(0, 1), right = new EnhancedEncoder(2, 3))
     {
         EnhancedDriveEncoders e = new EnhancedDriveEncoders(left, right);
         e.Dt = 1;
         SimData.Encoder[0].Count = 4000;
         SimData.Encoder[1].Count = -4000;
         Assert.AreEqual(1000, e.TurnSpeed);
     }
 }