예제 #1
0
 public SoftservoControler()
 {
     wmx                   = new WMX3Api();
     status                = new CoreMotionStatus();
     s_JogCommand          = new Motion.JogCommand();
     fx_PosBlock           = new Motion.PosCommand();
     fx_LinearIntplCommand = new Motion.LinearIntplCommand();
     fx_CenterAndEndCir    = new Motion.CenterAndEndCircularIntplCommand();
     fx_ThroughAndEnd      = new Motion.ThroughAndEndCircularIntplCommand();
 }
예제 #2
0
        public bool ArcXYMove(short num, short AxisX, short AxisY, short AxisZ, double dAcc, double dDec, double dSpeed, double posX, double posY, double dR, short iCCW)
        {
            try
            {
                fx_CenterAndEndCir = new Motion.CenterAndEndCircularIntplCommand();
                fx_CenterAndEndCir.Profile.Type             = ProfileType.SCurve;
                fx_CenterAndEndCir.Profile.StartingVelocity = 0;
                fx_CenterAndEndCir.Profile.EndVelocity      = 0;
                fx_CenterAndEndCir.Axis[0]      = AxisX;
                fx_CenterAndEndCir.Axis[1]      = AxisY;
                fx_CenterAndEndCir.CenterPos[0] = 0.0; //单位为脉冲pulse(相对)
                fx_CenterAndEndCir.CenterPos[1] = 0.0; //单位为脉冲pulse(相对)

                CommonTool.Circle_Center(dCurrentPos[AxisX],
                                         dCurrentPos[AxisY],
                                         posX,
                                         posY,
                                         dR,
                                         iCCW,
                                         ref fx_CenterAndEndCir.CenterPos[0],
                                         ref fx_CenterAndEndCir.CenterPos[1]);

                fx_CenterAndEndCir.Profile.Velocity = dSpeed;                    //单位为deg
                fx_CenterAndEndCir.EndPos[0]        = posX;                      //单位为脉冲pulse
                fx_CenterAndEndCir.EndPos[1]        = posY;                      //单位为脉冲pulse
                fx_CenterAndEndCir.Profile.Acc      = dAcc / 0.001;              //单位为deg/s
                fx_CenterAndEndCir.Profile.Dec      = dDec / 0.001;              //单位为deg/s
                fx_CenterAndEndCir.Profile.JerkAcc  = dAcc / 0.001;              //单位为deg/s^2
                fx_CenterAndEndCir.Profile.JerkDec  = dDec / 0.001;              //单位为deg/s^2
                fx_CenterAndEndCir.Clockwise        = (byte)(iCCW == 0 ? 1 : 0); //如果为0,则电弧将以逆时针方向。 如果为1,则弧线将按顺时针方向旋转。
                int ret = cmApi.Motion.StartCircularIntplPos(fx_CenterAndEndCir);
                if (ret != 0)
                {
                    //   Global.logger.ErrorFormat("WMX3 执行圆弧插补出现错误!错误信息:{0}", WMX3Api.ErrorToString(ret));
                    return(false);
                }
                return(true);
            }
            catch (Exception ex)
            {
                //   Global.logger.ErrorFormat("WMX3 执行圆弧插补出现异常!异常信息:{0}", ex.Message);
                return(false);
            }
        }