Beispiel #1
0
        public void CanGetMovementFromLeftTibiaZeroOffset()
        {
            ServoBase tibia = new ServoBase(10.4, 0, 5, 0, 0, Side.Left);
            MovmentComandAX12 movmentComandAX12 = tibia.GetMovement();

            List<byte> movmentInBytes = (List<byte>) movmentComandAX12.ToByte();
            Assert.AreEqual(5, movmentInBytes[0]); //ServoId
            Assert.AreEqual(0x1ff, BitConverter.ToInt16(movmentInBytes.ToArray(), 1));
            Assert.AreEqual(0x050, BitConverter.ToInt16(movmentInBytes.ToArray(), 3));
        }
Beispiel #2
0
        public void CanGetMovementForLeftCoxaWithOffset()
        {
            ServoBase coxa = new ServoBase(10.4, 20, 5, 0, 0, Side.Left);
            MovmentComandAX12 movmentComandAX12 = coxa.GetMovement();

            List<byte> movmentInBytes = (List<byte>)movmentComandAX12.ToByte();
            Assert.AreEqual(5, movmentInBytes[0]); //ServoId
            Assert.AreEqual(0x1BB, BitConverter.ToInt16(movmentInBytes.ToArray(), 1));
            Assert.AreEqual(0x050, BitConverter.ToInt16(movmentInBytes.ToArray(), 3));
        }
Beispiel #3
0
        public void CanGetMovementForRightFemurWithOffset()
        {
            ServoBase servoBase = new ServoBase(10.4, 20, 5, 0, 0, Side.Right);
            MovmentComandAX12 movmentComandAX12 = servoBase.GetMovement();

            List<byte> movmentInBytes = (List<byte>)movmentComandAX12.ToByte();
            Assert.AreEqual(5, movmentInBytes[0]); //ServoId
            Assert.AreEqual(0x243, BitConverter.ToInt16(movmentInBytes.ToArray(), 1));
            Assert.AreEqual(0x050, BitConverter.ToInt16(movmentInBytes.ToArray(), 3));
        }