コード例 #1
0
        public static short arcInterpolation(long[] targetPos, long[] centerPos, ushort arcDir, PositionMode positionMode) // 圆弧查补
        {
            short m;

            if (mInpterplaType.run_flag == RUN)
            {
                return(-1);
            }
            //运行到起点坐标
            ushort[] axis1 = new ushort[] { 0, 1, 2, 3 };
            RFIDControl.dmc_set_vector_profile_multicoor(mInpterplaType.card_num, mInpterplaType.car_num, mInpterplaType.m_speed_min, mInpterplaType.m_speed_max, mInpterplaType.m_acc_time, mInpterplaType.m_dcc_time, 0);      //设置插补速度
                                                                                                                                                                                                                                 //运行到起点
            mInpterplaType.m_ndist[X] = mInpterplaType.m_start[X] - mAxis[X].m_positon;
            mInpterplaType.m_ndist[Y] = mInpterplaType.m_start[Y] - mAxis[Y].m_positon;
            m = RFIDControl.dmc_line_multicoor(mInpterplaType.card_num, mInpterplaType.car_num, mInpterplaType.axis_cout, axis1, mInpterplaType.m_ndist, REL_MODE);  //执行
            mInpterplaType.run_flag = RUN;
            checkDmcMessage(m);
            while (mInpterplaType.run_flag == RUN)
            {
                ;
            }
            //开始画轨迹
            RFIDControl.dmc_set_vector_profile_multicoor(mInpterplaType.card_num, mInpterplaType.car_num, mInpterplaType.m_speed_min, mInpterplaType.m_speed_max, mInpterplaType.m_acc_time, mInpterplaType.m_dcc_time, 0);      //设置插补速度
            ushort[] axis = new ushort[] { X, Y };

            m = RFIDControl.dmc_arc_move_multicoor(mInpterplaType.card_num, mInpterplaType.car_num, axis, targetPos, centerPos, arcDir, (ushort)positionMode); //以当前点为起点,半径为2000 pulse,顺时针走一个半圆,相对模式
            mInpterplaType.run_flag = RUN;
            checkDmcMessage(m);

            return(m);
        }
コード例 #2
0
        public static short lineInterpolation()
        {
            short m;

            if (mInpterplaType.run_flag == RUN)
            {
                return(-1);
            }
            ushort[] axis = new ushort[] { 0, 1, 2, 3 };
            RFIDControl.dmc_set_vector_profile_multicoor(mInpterplaType.card_num, mInpterplaType.car_num, mInpterplaType.m_speed_min, mInpterplaType.m_speed_max, mInpterplaType.m_acc_time, mInpterplaType.m_dcc_time, 0);      //设置插补速度
                                                                                                                                                                                                                                 //运行到起点
            mInpterplaType.m_ndist[X] = mInpterplaType.m_start[X] - mAxis[X].m_positon;
            mInpterplaType.m_ndist[Y] = mInpterplaType.m_start[Y] - mAxis[Y].m_positon;
            m = RFIDControl.dmc_line_multicoor(mInpterplaType.card_num, mInpterplaType.car_num, mInpterplaType.axis_cout, axis, mInpterplaType.m_ndist, REL_MODE);  //执行
            mInpterplaType.run_flag = RUN;
            checkDmcMessage(m);
            while (mInpterplaType.run_flag == RUN)
            {
                ;
            }
            //运行到终点
            mInpterplaType.m_ndist[X] = mInpterplaType.m_end[X] - mInpterplaType.m_start[X];
            mInpterplaType.m_ndist[Y] = mInpterplaType.m_end[Y] - mInpterplaType.m_start[Y];
            m = RFIDControl.dmc_line_multicoor(mInpterplaType.card_num, mInpterplaType.car_num, mInpterplaType.axis_cout, axis, mInpterplaType.m_ndist, REL_MODE);  //执行
            mInpterplaType.run_flag = RUN;
            checkDmcMessage(m);
            return(m);
        }