public static uint ConvertDistance(MotorParameter motorPara, double distance) { distance *= motorPara.IsReversed ? -1 : 1; //uint content = (uint)(Math.Abs(distance) * this.motorParaMap[axis].Ratio); uint content = (uint)Math.Round((Math.Abs(distance) * motorPara.Ratio)); if (distance < 0) { content |= 0x80000000; } return(content); }
public static double ConvertBackSpeed(MotorParameter motorPara, int pulseSpeed) { return(CalSpeed((uint)pulseSpeed) / motorPara.Ratio); }
public static uint ConvertSpeed(MotorParameter motorPara, double speed) { uint content = (uint)(speed * motorPara.Ratio); return(CalSpeed(content)); }
public static double ConvertBackDistance(MotorParameter motorPara, int pulseDistance) { double factor = motorPara.IsReversed ? -1 : 1; return(Math.Round(pulseDistance / motorPara.Ratio * factor, 2)); }