Exemplo n.º 1
0
        /// <summary>
        /// 获取当前点的坐标系坐标
        /// </summary>
        /// <param name="type"></param>
        /// 0 - NO COMPENSATION
        /// 1 - AFFINITY COMPENSATION
        /// 2 - LINE COMPENSATION
        /// <returns></returns>
        public static Vector Get_Coordinate(int type)
        {
            Vector Result = new Vector(0, 0);

            double[] Curent_Pos = new double[2];
            MC.GT_GetCrdPos(1, out Curent_Pos[0]);
            Vector Tem_Pos = new Vector(-(decimal)Curent_Pos[0] / Para_List.Parameter.Gts_Pos_reference, -(decimal)Curent_Pos[1] / Para_List.Parameter.Gts_Pos_reference);

            //calculate data
            if (type == 0)
            {
                Result = new Vector(Tem_Pos);
            }
            else
            {
                if (Para_List.Parameter.Gts_Affinity_Type == 2)//线性
                {
                    Result = new Vector(Gts_Cal_Data_Resolve.Get_Line_Fit_Coordinate_MA(Tem_Pos.X, Tem_Pos.Y, Fit_Matrices_MA));
                }
                else
                {
                    Result = new Vector(Gts_Cal_Data_Resolve.Get_Affinity_Point(1, Tem_Pos.X, Tem_Pos.Y, affinity_Matrices));
                }
            }
            return(Result);
        }
Exemplo n.º 2
0
        /// <summary>
        /// 插补运动运行
        /// </summary>
        public static void Interpolation_Start()
        {
            //设置X轴误差带
            Gts_Return = MC.GT_SetAxisBand(1, Para_List.Parameter.Axis_X_Band, 4 * Para_List.Parameter.Axis_X_Time);//20-0.1um,4*2-250us
            Log.Commandhandler("X轴到位误差带", Gts_Return);
            //设置Y轴误差带
            Gts_Return = MC.GT_SetAxisBand(2, Para_List.Parameter.Axis_Y_Band, 4 * Para_List.Parameter.Axis_Y_Time);//20-0.1um,4*2-250us
            Log.Commandhandler("Y轴到位误差带", Gts_Return);

            //缓存区延时指令
            Gts_Return = MC.GT_BufDelay(1, 2, 0);//2ms
            Log.Commandhandler("Line_Interpolation--缓存区延时指令", Gts_Return);
            //启动坐标系1、FIFO0插补运动
            Gts_Return = MC.GT_CrdStart(1, 0);
            Log.Commandhandler("Line_Interpolation--启动坐标系1、FIFO0插补运动", Gts_Return);
            //脉冲输出
            do
            {
                //查询坐标系1、FIFO0插补运动状态
                Gts_Return = MC.GT_CrdStatus(
                    1,           //坐标系1
                    out run,     //插补运动状态
                    out segment, //当前已完成的插补段数
                    0
                    );

                //查询剩余插补段数
                Gts_Return = MC.GT_GetRemainderSegNum(
                    1,                  //坐标系1
                    out Remain_Segment, //剩余插补段数
                    0
                    );
                //获取坐标系位置
                Gts_Return = MC.GT_GetCrdPos(1, out Crd_Pos[0]);
                //延时
                Thread.Sleep(100);
            } while (run == 1);

            ////到位检测
            //do
            //{
            //    //延时
            //    Thread.Sleep(100);
            //} while (!Prompt.Refresh.Axis01_Posed || !(Prompt.Refresh.Axis02_Posed));
            //延时
            Thread.Sleep(Para_List.Parameter.Posed_Time);
        }