public bool LineXYZMove(short num, short AxisX, short AxisY, short AxisZ, double dAcc, double dDec, double dSpeed, double posX, double posY, double posZ) { bool sRtn = false; double[] PositionArray = new double[] { posX, posY }; double TransPara = 0; APS168_W64.ASYNCALL p = new APS168_W64.ASYNCALL(); int[] Axis_ID_Array = new int[] { AxisX, AxisY }; // config speed profile APS168_W64.APS168.APS_set_axis_param_f(Axis_ID_Array[0], (int)APS_Define_W32.APS_Define.PRA_SF, 0.5); APS168_W64.APS168.APS_set_axis_param_f(Axis_ID_Array[0], (int)APS_Define_W32.APS_Define.PRA_ACC, dAcc); APS168_W64.APS168.APS_set_axis_param_f(Axis_ID_Array[0], (int)APS_Define_W32.APS_Define.PRA_DEC, dDec); APS168_W64.APS168.APS_set_axis_param_f(Axis_ID_Array[0], (int)APS_Define_W32.APS_Define.PRA_VM, dSpeed); ////servo on //APS168_W64.APS168.APS_set_servo_on(Axis_ID_Array[0], 1); //Thread.Sleep(500); // Wait stable. ////servo on //APS168_W64.APS168.APS_set_servo_on(Axis_ID_Array[1], 1); //Thread.Sleep(500); // Wait stable. // Start a 2 dimension linear interpolation sRtn = APS168_W64.APS168.APS_line( 2 // I32 Dimension , Axis_ID_Array // I32 *Axis_ID_Array , (int)APS_Define_W32.APS_Define.OPT_ABSOLUTE // I32 Option , PositionArray // F64 *PositionArray , ref TransPara // F64 *TransPara , ref p // ASYNCALL *Wait ) == 0 ? true : false; return(sRtn); }
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) { if (!bInitOK) { return(false); } try { double[] centerArray = new double[] { 1000.0, 0.0 }; double angle = (90.0 * 3.14159265 / 180.0); double transPara = 0; APS168_W64.ASYNCALL p = new APS168_W64.ASYNCALL(); int[] axisArr = new int[] { AxisX, AxisY }; double[] endArr = new double[] { posX, posY }; // config speed profile APS168_W64.APS168.APS_set_axis_param_f(AxisX, (Int32)APS_Define_W32.APS_Define.PRA_SF, 0.5); APS168_W64.APS168.APS_set_axis_param_f(AxisX, (Int32)APS_Define_W32.APS_Define.PRA_ACC, dAcc / 0.001); APS168_W64.APS168.APS_set_axis_param_f(AxisX, (Int32)APS_Define_W32.APS_Define.PRA_DEC, dDec / 0.001); APS168_W64.APS168.APS_set_axis_param_f(AxisX, (Int32)APS_Define_W32.APS_Define.PRA_VM, dSpeed); ////servo on //APS168_W64.APS168.APS_set_servo_on(Axis_ID_Array[0], 1); //Thread.Sleep(500); // Wait stable. //servo on //APS168.APS_set_servo_on(Axis_ID_Array[1], 1); //Thread.Sleep(500); // Wait stable. // Start a 2 dimension linear interpolation APS168_W64.APS168.APS_arc2_ce( axisArr, 0, centerArray, endArr, iCCW, ref transPara, ref p ); return(true); } catch (Exception e) { // Global.logger.ErrorFormat("凌华运动控制卡圆弧插补运动失败,错误:{0}。", e.Message); return(false); } }