Exemple #1
0
        public void TestGoodSetters()
        {
            Assert.AreEqual(0, Encoder0.CurrentPositionTicks);
            Encoder0.SetPositionFromEncoderTicks(750);
            Assert.AreEqual(750, Encoder0.CurrentPositionTicks);
            Encoder0.SetPositionFromDegrees(45.0);
            Assert.AreEqual(128, Encoder0.CurrentPositionTicks);
            Encoder0.SetPositionFromDegrees(405.0);
            Assert.AreEqual(128, Encoder0.CurrentPositionTicks);
            Encoder0.SetPositionFromDegrees(-315.0);
            Assert.AreEqual(128, Encoder0.CurrentPositionTicks);

            Assert.AreEqual(540, Encoder1.CurrentPositionTicks);
            Encoder1.SetPositionFromEncoderTicks(1024);
            Assert.AreEqual(1024, Encoder1.CurrentPositionTicks);
            Encoder1.SetPositionFromDegrees(36.0);
            Assert.AreEqual(409, Encoder1.CurrentPositionTicks);
            Encoder1.SetPositionFromDegrees(370.0);
            Assert.AreEqual(113, Encoder1.CurrentPositionTicks);
            Encoder1.SetPositionFromDegrees(-10.0);
            Assert.AreEqual(3982, Encoder1.CurrentPositionTicks);

            Reset();
        }
Exemple #2
0
 public void TestBadSetterUnderflow()
 {
     Encoder2.SetPositionFromEncoderTicks(-1);
 }