Пример #1
0
        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);
        }
Пример #2
0
 public static double ConvertBackSpeed(MotorParameter motorPara, int pulseSpeed)
 {
     return(CalSpeed((uint)pulseSpeed) / motorPara.Ratio);
 }
Пример #3
0
        public static uint ConvertSpeed(MotorParameter motorPara, double speed)
        {
            uint content = (uint)(speed * motorPara.Ratio);

            return(CalSpeed(content));
        }
Пример #4
0
        public static double ConvertBackDistance(MotorParameter motorPara, int pulseDistance)
        {
            double factor = motorPara.IsReversed ? -1 : 1;

            return(Math.Round(pulseDistance / motorPara.Ratio * factor, 2));
        }