コード例 #1
0
        /// <summary>
        /// laser 功率矫正初始化
        /// </summary>
        /// <returns></returns>
        public bool Load_Watt_Percent_Relate()
        {
            string File_Name = "Correct_File/Laser_Watt_Percent_Relate.csv";
            string File_Path = @"./\Config/" + File_Name;

            if (File.Exists(File_Path))
            {
                //获取矫正数据
                if (CSV_RW.DataTable_Double_Fit_Data(CSV_RW.OpenCSV(File_Path)).Count >= 1)
                {
                    Laser_Watt_Percent_Relate = new Double_Fit_Data(CSV_RW.DataTable_Double_Fit_Data(CSV_RW.OpenCSV(File_Path))[0]);
                    Log.Info("Laser_Watt_Percent_Relate 矫正文件加载成功!!!");
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            else
            {
                Log.Info("Laser_Watt_Percent_Relate 矫正文件不存在!!!,禁止加工,请检查!");
                return(false);
            }
        }
コード例 #2
0
 /// <summary>
 /// 保存刀具参数
 /// </summary>
 public void Save_Scissor_Para()
 {
     CSV_RW.SaveCSV_NoDate(Common_Collect.ListToDt <Tech_Parameter>(ScissorList), "Scissor_Parameter/ScissorList.csv");//刀具参数 保存
 }
コード例 #3
0
        /// <summary>
        /// 加载刀具参数
        /// </summary>
        public bool Load_Scissor_Para()
        {
            string File_Path = @"./\Config/" + "Scissor_Parameter/ScissorList.csv";

            if (File.Exists(File_Path))
            {
                ScissorList = Common_Collect.DtToList <Tech_Parameter> .ConvertToModel(CSV_RW.OpenCSV(File_Path));//刀具参数 读取

                return(true);
            }
            else
            {
                return(false);
            }
        }
コード例 #4
0
        /// <summary>
        /// 振镜桶形畸变数据采集
        /// </summary>
        private void Rtc_Barrel_Distortion_Figure_Data_Acquisition()
        {
            if (Program.SystemContainer.SysPara.Rtc_Distortion_Data_Type == 0)//只采集整圆图形
            {
                //生成相机采集数据点位
                List <Vector> Aquisition_Point = new List <Vector>();
                List <Vector> Rtc_Point = new List <Vector>();
                decimal       Gts_X = Program.SystemContainer.SysPara.Base_Gts.X, Gts_Y = Program.SystemContainer.SysPara.Base_Gts.Y;//X、Y坐标
                Vector        Cam = new Vector();
                Vector        Tem_Mark   = new Vector();
                Vector        Coordinate = new Vector();
                Vector        Tem_Datum  = new Vector();
                //数据采集
                DataTable Temp_Acquisition = new DataTable();
                Temp_Acquisition.Columns.Add("振镜坐标X", typeof(decimal));
                Temp_Acquisition.Columns.Add("振镜坐标Y", typeof(decimal));
                Temp_Acquisition.Columns.Add("实际坐标X", typeof(decimal));
                Temp_Acquisition.Columns.Add("实际坐标Y", typeof(decimal));
                DataTable Calibration_Data_Acquisition = new DataTable();
                Calibration_Data_Acquisition.Columns.Add("振镜坐标X", typeof(decimal));
                Calibration_Data_Acquisition.Columns.Add("振镜坐标Y", typeof(decimal));
                Calibration_Data_Acquisition.Columns.Add("实际坐标X", typeof(decimal));
                Calibration_Data_Acquisition.Columns.Add("实际坐标Y", typeof(decimal));
                //计算总间距
                Int16 No = (Int16)(Program.SystemContainer.SysPara.Rtc_Distortion_Data_Limit / Program.SystemContainer.SysPara.Rtc_Distortion_Data_Interval);
                ///Rtc要求数据 顺序:左上角-->右上角 Y坐标不变,依次变更X坐标
                ///Gts匹配 顺序:右上角-->右下角 X坐标不变,依次变更Y坐标 (Rts坐标轴交换,同时Rtc的X轴方向取反)
                for (int i = No / 2; i >= -No / 2; i--)
                {
                    for (int j = No / 2; j >= -No / 2; j--)
                    {
                        Aquisition_Point.Add(new Vector(Gts_X + i * Program.SystemContainer.SysPara.Rtc_Distortion_Data_Interval, Gts_Y + j * Program.SystemContainer.SysPara.Rtc_Distortion_Data_Interval));
                    }
                }
                //振镜打标数据
                for (int i = -No / 2; i <= No / 2; i++)     //Y坐标
                {
                    for (int j = -No / 2; j <= No / 2; j++) //X坐标
                    {
                        Rtc_Point.Add(new Vector(j * Program.SystemContainer.SysPara.Rtc_Distortion_Data_Interval, -i * Program.SystemContainer.SysPara.Rtc_Distortion_Data_Interval));
                    }
                }
                //进行数据采集
                if (Rtc_Point.Count == Aquisition_Point.Count)
                {
                    for (int i = 0; i < Aquisition_Point.Count; i++)
                    {
                        /*********************获取矫正数据**********************/
                        Tem_Mark = new Vector(Aquisition_Point[i].X + Program.SystemContainer.SysPara.Rtc_Org.X, Aquisition_Point[i].Y + Program.SystemContainer.SysPara.Rtc_Org.Y);
                        if (Program.SystemContainer.SysPara.Rtc_Get_Data_Align == 1)
                        {
                            //对齐中心
                            do
                            {
                                Program.SystemContainer.GTS_Fun.Gts_Ready_Correct(Tem_Mark.X, Tem_Mark.Y);
                                //调用相机,获取对比的坐标信息
                                Thread.Sleep(500);
                                //相机反馈的当前坐标
                                Cam = new Vector(Program.SystemContainer.T_Client.Get_Cam_Deviation_Coordinate_Correct(1));//触发拍照
                                if (Cam.Length == 0)
                                {
                                    MessageBox.Show("相机坐标提取失败,请检查!!!");
                                    CSV_RW.SaveCSV(Temp_Acquisition, "Rtc_Data_Aquisition_Temp_Fail");        //原始数据保存
                                    CSV_RW.SaveCSV(Calibration_Data_Acquisition, "Rtc_Data_Aquisition_Fail"); //原始数据保存
                                    return;
                                }
                                Coordinate = Program.SystemContainer.GTS_Fun.Get_Coordinate(1);
                                Tem_Mark   = new Vector(Coordinate - Cam);//获取实际位置
                            } while (!Differ_Deviation(Cam, Program.SystemContainer.SysPara.Pos_Tolerance));
                        }
                        else
                        {
                            //实际测量
                            Program.SystemContainer.GTS_Fun.Gts_Ready_Correct(Tem_Mark.X, Tem_Mark.Y);
                            //调用相机,获取对比的坐标信息
                            Thread.Sleep(500);
                            //相机反馈的当前坐标
                            Cam = new Vector(Program.SystemContainer.T_Client.Get_Cam_Deviation_Coordinate_Correct(1));//触发拍照
                            if (Cam.Length == 0)
                            {
                                MessageBox.Show("相机坐标提取失败,请检查!!!");
                                CSV_RW.SaveCSV(Temp_Acquisition, "Rtc_Data_Aquisition_Temp_Fail");        //原始数据保存
                                CSV_RW.SaveCSV(Calibration_Data_Acquisition, "Rtc_Data_Aquisition_Fail"); //原始数据保存
                                return;
                            }
                            Coordinate = Program.SystemContainer.GTS_Fun.Get_Coordinate(1);
                        }
                        //添加数据
                        Temp_Acquisition.Rows.Add(new object[] { Rtc_Point[i].X, Rtc_Point[i].Y, Tem_Mark.Y, Tem_Mark.X });

                        //运行和暂停切换
                        if (on_off)
                        {
                            ma = new ManualResetEvent(false);
                            ma.WaitOne();
                        }
                        //退出循环
                        if (stop)
                        {
                            CSV_RW.SaveCSV(Temp_Acquisition, "Rtc_Data_Aquisition_Temp_Exit");        //原始数据保存
                            CSV_RW.SaveCSV(Calibration_Data_Acquisition, "Rtc_Data_Aquisition_Exit"); //原始数据保存
                            return;
                        }
                    }
                }
                else
                {
                    MessageBox.Show("打标数据不匹配!!!");
                    return;
                }
                Tem_Datum = new Vector(Convert.ToDecimal(Temp_Acquisition.Rows[((No + 1) * (No + 1) - 1) / 2][2].ToString()), Convert.ToDecimal(Temp_Acquisition.Rows[((No + 1) * (No + 1) - 1) / 2][3].ToString()));
                //数据处理
                for (int i = 0; i < Temp_Acquisition.Rows.Count; i++)
                {
                    decimal t1, t2, t3, t4;
                    t1 = Convert.ToDecimal(Temp_Acquisition.Rows[i][0].ToString());
                    t2 = Convert.ToDecimal(Temp_Acquisition.Rows[i][1].ToString());
                    t3 = Convert.ToDecimal(Temp_Acquisition.Rows[i][2].ToString());
                    t4 = Convert.ToDecimal(Temp_Acquisition.Rows[i][3].ToString());
                    Calibration_Data_Acquisition.Rows.Add(new object[] { t1, t2, -(t3 - Tem_Datum.X), (t4 - Tem_Datum.Y) });
                }
                CSV_RW.SaveCSV(Temp_Acquisition, "Rtc_Data_Aquisition_Temp");        //原始数据保存
                CSV_RW.SaveCSV(Calibration_Data_Acquisition, "Rtc_Data_Aquisition"); //原始数据保存
            }
            else
            {
                appendInfo("只支持整圆图形采集!!!!");
            }
        }