private static void LoadLimits(DynamixelDriver driver) { Console.WriteLine("Loading motor limits"); List <MinMax> minMaxPairs = JsonConvert.DeserializeObject <List <MinMax> >(File.ReadAllText("MinMaxPairs.json")); foreach (var minMaxPair in minMaxPairs) { ushort maxAngle = DynamixelDriver.DegreesToUnits(minMaxPair.Max); ushort minAngle = DynamixelDriver.DegreesToUnits(minMaxPair.Min); driver.SetCcwMaxAngleLimit((byte)minMaxPair.Index, maxAngle); driver.SetCwMinAngleLimit((byte)minMaxPair.Index, minAngle); } Console.ForegroundColor = ConsoleColor.Blue; Console.WriteLine(JsonConvert.SerializeObject(minMaxPairs)); Console.ResetColor(); Console.WriteLine("Limits loaded"); }
public ushort ToDynamixelUnits() { return(DynamixelDriver.DegreesToUnits(new Angle(_value + 150f))); }