本文整理汇总了C#中Leg.GetMovements方法的典型用法代码示例。如果您正苦于以下问题:C# Leg.GetMovements方法的具体用法?C# Leg.GetMovements怎么用?C# Leg.GetMovements使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Leg
的用法示例。
在下文中一共展示了Leg.GetMovements方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CanGetMovmentFromLeftFrontLeg
public void CanGetMovmentFromLeftFrontLeg()
{
Leg leg = new Leg(1,1)
{
Side = Side.Left,
Position = Position.Front,
Offset = 00,
X = 5.7,
Y = 10.4,
Z = -9.8726896031426,
Coxa = new ServoBase(3.8, 60, 1, 0, 0, Side.Left),
Femur = new ServoBase(7.6, -90, 3, 0, 0, Side.Left),
Tibia = new ServoBase(10.4, -70, 5, 0, 0, Side.Left)
};
Leg.CalculateNewPosition(leg, 0,1);
MovmentComandAX12[] movement = leg.GetMovements();
List<byte> movmentInBytes;
//coxa
movmentInBytes = (List<byte>)movement[0].ToByte();
Assert.AreEqual(1, movmentInBytes[0]); //ServoId
Assert.AreEqual(0x1FF, BitConverter.ToInt16(movmentInBytes.ToArray(), 1));
Assert.AreEqual(0x050, BitConverter.ToInt16(movmentInBytes.ToArray(), 3));
//femur
movmentInBytes = (List<byte>)movement[1].ToByte();
Assert.AreEqual(3, movmentInBytes[0]); //ServoId
Assert.AreEqual(0x1FF, BitConverter.ToInt16(movmentInBytes.ToArray(), 1));
Assert.AreEqual(0x050, BitConverter.ToInt16(movmentInBytes.ToArray(), 3));
//Coxa
movmentInBytes = (List<byte>)movement[2].ToByte();
Assert.AreEqual(5, movmentInBytes[0]); //ServoId
Assert.AreEqual(0x1BB, BitConverter.ToInt16(movmentInBytes.ToArray(), 1));
Assert.AreEqual(0x050, BitConverter.ToInt16(movmentInBytes.ToArray(), 3));
}