public override void UninitCalib()
        {
            do_gt2_cy?.SetDo(this, false, ignoreOrWaringOrError: null);

            if (Platform1 != null)
            {
                Platform1.EnterAuto(this).Home(2);
                Platform1.EnterAuto(this).MoveAbs("Wait", checkLimit: false);

                Platform1.ExitAuto();
            }


            if (Platform2 != null)
            {
                Platform2.EnterAuto(this).Home(2);
                Platform2.EnterAuto(this).MoveAbs("Wait", checkLimit: false);

                Platform2.ExitAuto();
            }


            PlatformCarrier?.EnterAuto(this).MoveAbs("Wait");

            do_clampy_cy.SetDo(this, false);

            PlatformCarrier?.ExitAuto();
        }
Пример #2
0
 public void Reset()
 {
     Hover.Reset();
     Platform1.Reset();
     Platform2.Reset();
     Obstacle1.Reset();
     Obstacle2.Reset();
 }
Пример #3
0
        public override void UninitCalib()
        {
            do_clampy_cy?.SetDo(this, false);
            do_gt2_cy?.SetDo(this, false);

            Platform1?.EnterAuto(this).Jump("Wait", JumpHeight1);
            Platform2?.EnterAuto(this).Jump("Wait", JumpHeight2);

            PlatformCarrier?.EnterAuto(this).MoveAbs("Wait");
        }
Пример #4
0
        public override void DoCalib()
        {
            Platform1?.EnterAuto(this).MoveAbs("Wait");


            //上工站点位数据采集
            Log($"上平台Align点位标定\n------------------------------------------------------");
            List <PosXYZ> upAlignPos = new List <PosXYZ>();
            bool          isFirst    = true;

            foreach (var pos in AlignPosUp)
            {
                if (isFirst)
                {
                    isFirst = false;
                    Platform1?.EnterAuto(this).Jump(pos, 0);
                }
                else
                {
                    Platform1?.EnterAuto(this).Jump(pos, JumpHeight1);
                }

                upAlignPos.Add(pos);
                DataList.Add(pos.ToString());
                Log($"CurPos {pos.ToString()}", LogLevel.Info);
            }
            //复位平台1
            Platform1?.EnterAuto(this).Jump("Wait", JumpHeight1);
            Log($"上平台Align点位标定 完成\n------------------------------------------------------");
            OnCalibProgress(50);



            Platform2?.EnterAuto(this).MoveAbs("Wait");
            //下工站点位 数据采集
            Log($"下平台Align点位标定\n------------------------------------------------------");
            List <PosXYZ> downAlingPos = new List <PosXYZ>();

            isFirst = true;
            foreach (var pos in AlignPosDown)
            {
                if (isFirst)
                {
                    isFirst = false;
                    Platform2?.EnterAuto(this).Jump(pos, 0);
                }
                else
                {
                    Platform2?.EnterAuto(this).Jump(pos, JumpHeight2);
                }

                downAlingPos.Add(pos);
                DataList.Add(pos.ToString());
                Log($"CurPos {pos.ToString()}", LogLevel.Info);
            }

            Log($"下平台Align点位标定 完成\n------------------------------------------------------");


            //计算下平台GT2偏移
            Log($"下平台GT1GT2偏移标定\n------------------------------------------------------");
            if (Platform2GtOffsetCalibGT1 != null && Platform2GtOffsetCalibGT2 != null)
            {
                Platform2?.EnterAuto(this).Jump(Platform2GtOffsetCalibGT1, JumpHeight1);
                Platform2?.EnterAuto(this).Jump(Platform2GtOffsetCalibGT2, JumpHeight1);

                var gt1 = Platform2GtOffsetCalibGT1 as PosXYZ;
                var gt2 = Platform2GtOffsetCalibGT2 as PosXYZ;
                OutputPlatform2GtOffset   = gt2 - gt1;
                OutputPlatform2GtOffset.Z = 0;
            }


            //复位平台2
            Platform2?.EnterAuto(this).Jump("Wait", JumpHeight2);
            Log($"下平台GT1GT2偏移标定 完成\n------------------------------------------------------");


            //复位治具
            PlatformCarrier?.EnterAuto(this).MoveAbs("Wait");
            OnCalibProgress(100);


            //计算上下平台坐标转换
            {
                var ret = XyzPlarformCalibration.CalcAffineTransform(
                    upAlignPos.Select(p => new PosXYZ(p.X, p.Y, 0)).ToList(),
                    downAlingPos.Select(p => new PosXYZ(p.X, p.Y, 0)).ToList());

                Log($"计算上下平台转换矩阵:\r\n"
                    + $"{ret.Item1[0, 0]:F6},{ret.Item1[0, 1]:F6},{ret.Item1[0, 2]:F6},{ret.Item1[0, 3]:F6}\r\n"
                    + $"{ret.Item1[1, 0]:F6},{ret.Item1[1, 1]:F6},{ret.Item1[1, 2]:F6},{ret.Item1[1, 3]:F6}\r\n"
                    + $"{ret.Item1[2, 0]:F6},{ret.Item1[2, 1]:F6},{ret.Item1[2, 2]:F6},{ret.Item1[2, 3]:F6}\r\n"
                    + $"{ret.Item1[3, 0]:F6},{ret.Item1[3, 1]:F6},{ret.Item1[3, 2]:F6},{ret.Item1[3, 3]:F6}\r\n", LogLevel.Info);

                Log($"计算上下平台转换误差:\r\n{ret.Item2:F2}\r\n", LogLevel.Info);

                OutputTransForm = new TransformParams(ret.Item1);
            }

            Log($"GT1GT2偏移:\r\n{OutputPlatform2GtOffset}\r\n", LogLevel.Info);
        }
        public override void DoCalib()
        {
            OutputStandardHeight = StandardHeight;

            Log("上平台GT高度标定\n----------------------------------------------------------");
            {
                //GT标定高度
                OutputGTCalibPos = Platform1GTCalibPos;
                DataList.Add(OutputGTCalibPos.ToString());

                //标准平面标定
                if (Platform1GTPlaneCalibPos != null)
                {
                    //update z
                    if (Platform1 != null && GtController != null)
                    {
                        bool isFirst = true;

                        foreach (var calibPos in Platform1GTPlaneCalibPos)
                        {
                            //product to up platform
                            var pos = new PosXYZ(calibPos.Data())
                            {
                                Z = Platform1GTCalibPos.Z
                            };
                            if (isFirst)
                            {
                                isFirst = false;
                                Platform1?.EnterAuto(this).Jump(Platform1.GetPos("P->UP", pos.Data()), 0);
                            }
                            else
                            {
                                Platform1?.EnterAuto(this).Jump(Platform1.GetPos("P->UP", pos.Data()), JumpHeight1);
                            }
                            Thread.Sleep(1000);
                            calibPos.Z = GtController.ReadData()[0];
                            DataList.Add(calibPos.ToString());
                        }
                    }

                    var fitplane = PlaneParams.FitPlane(Platform1GTPlaneCalibPos);
                    OutputUpStandardPlane = new PlaneParams()
                    {
                        Normal = fitplane.Normal, Origin = fitplane.Origin
                    };
                    DataList.Add(OutputUpStandardPlane.ToString());
                }
            }

            //复位上平台
            Platform1?.EnterAuto(this).Jump("Wait", JumpHeight1);
            Log("上平台GT高度标定 完成\n----------------------------------------------------------");


            //下GT高度标定

            //复位下平台Z轴
            if (Platform2 != null)
            {
                Platform2.EnterAuto(this).Home(2);
                Platform2.EnterAuto(this).MoveAbs(2, "Wait", checkLimit: false);
            }

            Log("下平台GT1高度标定\n----------------------------------------------------------");
            {
                do_gt2_cy?.SetDo(this, true, ignoreOrWaringOrError: null);
                {
                    //GT1GT2 高度差标定
                    OutputGT1CalibPos = Platform2GT1CalibPos;
                    //update z
                    if (Platform2 != null && GtController != null)
                    {
                        Platform2.EnterAuto(this).Jump(Platform2GT1CalibPos, 0);
                        Thread.Sleep(1000);
                        OutputGT1CalibPos.OffsetZ = GtController.ReadData()[1];
                    }

                    //GT1GT2 高度差标定
                    OutputGT2CalibPos = Platform2GT2CalibPos;
                    //update z
                    if (Platform2 != null && GtController != null)
                    {
                        Platform2.EnterAuto(this).Jump(Platform2GT2CalibPos, JumpHeight2);
                        Thread.Sleep(1000);
                        OutputGT2CalibPos.OffsetZ = GtController.ReadData()[2];
                    }


                    //GT1标准平面标定
                    if (Platform2GT1PlaneCalibPos != null)
                    {
                        //update z
                        if (Platform2 != null && GtController != null)
                        {
                            foreach (var calibPos in Platform2GT1PlaneCalibPos)
                            {
                                //product to up platform
                                var pos = new PosXYZ(calibPos.Data())
                                {
                                    Z = Platform2GT1CalibPos.Z
                                };
                                Platform2.EnterAuto(this).Jump(Platform2.GetPos("P->DOWN1", pos.Data()), JumpHeight2);
                                Thread.Sleep(1000);
                                calibPos.Z = GtController.ReadData()[1];
                                DataList.Add(calibPos.ToString());
                            }
                        }

                        var fitplane = PlaneParams.FitPlane(Platform2GT1PlaneCalibPos);
                        OutputDownStandardPlane = new PlaneParams()
                        {
                            Normal = fitplane.Normal, Origin = fitplane.Origin
                        };
                        DataList.Add(OutputDownStandardPlane.ToString());
                    }

                    //GT2标准平面标定
                    if (Platform2GT2PlaneCalibPos != null)
                    {
                        //update z
                        if (Platform2 != null && GtController != null)
                        {
                            foreach (var calibPos in Platform2GT2PlaneCalibPos)
                            {
                                //product to up platform
                                var pos = new PosXYZ(calibPos.Data())
                                {
                                    Z = Platform2GT2CalibPos.Z
                                };
                                Platform2.EnterAuto(this).Jump(Platform2.GetPos("P->DOWN2", pos.Data()), JumpHeight2);
                                Thread.Sleep(1000);
                                calibPos.Z = GtController.ReadData()[2];
                                DataList.Add(calibPos.ToString());
                            }
                        }

                        var fitplane = PlaneParams.FitPlane(Platform2GT2PlaneCalibPos);
                        OutputDownStandardPlane2 = new PlaneParams()
                        {
                            Normal = fitplane.Normal, Origin = fitplane.Origin
                        };
                        DataList.Add(OutputDownStandardPlane2.ToString());
                    }
                }
                do_gt2_cy?.SetDo(this, false, ignoreOrWaringOrError: null);
            }


            {
                //复位下平台
                //move platform2 wait
                if (Platform2 != null)
                {
                    Platform2.EnterAuto(this).Home(2);
                    Platform2.EnterAuto(this).MoveAbs("Wait", checkLimit: false);
                }
                Log("下平台GT1/2高度标定  完成\n----------------------------------------------------------");
            }

            //output
            DataList.Add(OutputGT1CalibPos.ToString());
            DataList.Add(OutputGT2CalibPos.ToString());
            DataList.Add(OutputStandardHeight.ToString());

            DataList.Add(OutputUpStandardPlane.ToString());
            DataList.Add(OutputDownStandardPlane.ToString());
        }
Пример #6
0
        public IList <ApplicationSetting> GetApplicationSettings()
        {
            IList <ApplicationSetting> apl = null;

            string sqlCommandText = ModuleConfiguration.SQL_CMD_SelectApplicationSettings;

            var dbResult = this.dmlOperable.ExeReader(sqlCommandText, null);

            if (dbResult != null && dbResult.Count > 0)
            {
                apl = new List <ApplicationSetting>();

                for (int i = 0; i < dbResult.Count; i++)
                {
                    ApplicationSetting applicationSetting = new ApplicationSetting();
                    List <Platform1>   pl11 = new List <Platform1>();
                    Platform1          pl1  = new Platform1();
                    Platform1          pl2  = new Platform1();
                    Platform1          pl3  = new Platform1();
                    Platform1          pl4  = new Platform1();

                    applicationSetting.ID  = dbResult[0]["ID"].ToString();
                    pl1.PlatformIpAddress  = (string)dbResult[0]["PlatformIpAddress"];
                    pl1.PlatformPortNumber = Convert.ToInt32(dbResult[0]["PlatformPortNumber"]);
                    pl1.PlatformName       = (string)dbResult[0]["PlatformName"];
                    pl1.PlatformProtocol   = (string)dbResult[0]["PlatformProtocol"];
                    pl2.PlatformName       = (string)dbResult[0]["PlatformName2"];
                    pl2.PlatformIpAddress  = (string)dbResult[0]["PlatformIpAddress2"];
                    pl2.PlatformPortNumber = Convert.ToInt32(dbResult[0]["PlatformPortNumber2"]);
                    pl2.PlatformProtocol   = (string)dbResult[0]["PlatformProtocol2"];
                    pl3.PlatformName       = (string)dbResult[0]["PlatformName3"];
                    pl3.PlatformIpAddress  = (string)dbResult[0]["PlatformIpAddress3"];
                    pl3.PlatformPortNumber = Convert.ToInt32(dbResult[0]["PlatformPortNumber3"]);
                    pl3.PlatformProtocol   = (string)dbResult[0]["PlatformProtocol3"];
                    pl4.PlatformName       = (string)dbResult[0]["PlatformName4"];
                    pl4.PlatformIpAddress  = (string)dbResult[0]["PlatformIpAddress4"];
                    pl4.PlatformPortNumber = Convert.ToInt32(dbResult[0]["PlatformPortNumber4"]);
                    pl11.Add(pl1);
                    pl11.Add(pl2);
                    pl11.Add(pl3);
                    pl11.Add(pl4);
                    applicationSetting.Platform = pl11;

                    pl4.PlatformProtocol     = (string)dbResult[0]["PlatformProtocol4"];
                    applicationSetting.theme = (string)dbResult[0]["PlatformTheme"];
                    applicationSetting.Time  = (string)dbResult[0]["PlatformTime"];
                    applicationSetting.Type  = (string)dbResult[0]["PlatformType"];
                    applicationSetting.Notificationduration = (string)dbResult[0]["Notificationduration"];
                    applicationSetting.Alarmduration        = (string)dbResult[0]["Alarmduration"];
                    applicationSetting.AlarmMode            = (int?)dbResult[0]["AlarmMode"];
                    applicationSetting.AlarmSound           = (string)dbResult[0]["AlarmSound"];
                    applicationSetting.NotificationMode     = (int?)dbResult[0]["NotificationMode"];
                    applicationSetting.NotificationSound    = (string)dbResult[0]["NotificationSound"];
                    applicationSetting.Language             = (int?)dbResult[0]["Language"];

                    applicationSetting.BackgroundDataArchivingFrequency = (int?)dbResult[0]["BgValArchFrequency"];
                    applicationSetting.ImageCapturingMode   = (int?)dbResult[0]["ImageCapturingMode"];
                    applicationSetting.ImageCapturingCount  = (int?)dbResult[0]["ImageCapturingCount"];
                    applicationSetting.VideoCapturingMode   = (int?)dbResult[0]["VideoCapturingMode"];
                    applicationSetting.VideoCapturingLength = (int?)dbResult[0]["VideoCapturingLength"];

                    apl.Add(applicationSetting);
                }
            }

            return(apl);
        }
Пример #7
0
        public ApplicationSetting GetApplicationSetting(string ID)
        {
            ApplicationSetting apl = null;

            string sqlCommandText = ModuleConfiguration.SQL_CMD_SelectApplicationSettingById;

            var dbResult = this.dmlOperable.ExeReader(sqlCommandText, new Dictionary <string, object>()
            {
                { "@ID", long.Parse(ID) }
            });

            if (dbResult != null && dbResult.Count == 1)
            {
                apl    = new ApplicationSetting();
                apl.ID = dbResult[0]["ID"].ToString();
                Platform1 pl1 = new Platform1();
                Platform1 pl2 = new Platform1();
                Platform1 pl3 = new Platform1();
                Platform1 pl4 = new Platform1();

                apl.ID = dbResult[0]["ID"].ToString();
                pl1.PlatformIpAddress  = (string)dbResult[0]["PlatformIpAddress"];
                pl1.PlatformPortNumber = Convert.ToInt32(dbResult[0]["PlatformPortNumber"]);
                pl1.PlatformName       = (string)dbResult[0]["PlatformName"];
                pl1.PlatformProtocol   = (string)dbResult[0]["PlatformProtocol"];
                pl2.PlatformName       = (string)dbResult[0]["PlatformName2"];
                pl2.PlatformIpAddress  = (string)dbResult[0]["PlatformIpAddress2"];
                pl2.PlatformPortNumber = Convert.ToInt32(dbResult[0]["PlatformPortNumber2"]);
                pl2.PlatformProtocol   = (string)dbResult[0]["PlatformProtocol2"];
                pl3.PlatformName       = (string)dbResult[0]["PlatformName3"];
                pl3.PlatformIpAddress  = (string)dbResult[0]["PlatformIpAddress3"];
                pl3.PlatformPortNumber = Convert.ToInt32(dbResult[0]["PlatformPortNumber3"]);
                pl3.PlatformProtocol   = (string)dbResult[0]["PlatformProtocol3"];
                pl4.PlatformName       = (string)dbResult[0]["PlatformName4"];
                pl4.PlatformIpAddress  = (string)dbResult[0]["PlatformIpAddress4"];
                pl4.PlatformPortNumber = Convert.ToInt32(dbResult[0]["PlatformPortNumber4"]);


                apl.Platform.Add(pl1);
                apl.Platform.Add(pl2);
                apl.Platform.Add(pl3);
                apl.Platform.Add(pl4);
                apl.theme = (string)dbResult[0]["theme"];
                apl.Time  = (string)dbResult[0]["Time"];
                apl.Type  = (string)dbResult[0]["Type"];
                apl.Notificationduration = (string)dbResult[0]["Notificationduration"];
                apl.Alarmduration        = (string)dbResult[0]["Alarmduration"];
                apl.AlarmMode            = (int?)dbResult[0]["AlarmMode"];
                apl.AlarmSound           = (string)dbResult[0]["AlarmSound"];
                apl.NotificationMode     = (int?)dbResult[0]["NotificationMode"];
                apl.NotificationSound    = (string)dbResult[0]["NotificationSound"];
                apl.Language             = (int?)dbResult[0]["Language"];

                apl.BackgroundDataArchivingFrequency = (int?)dbResult[0]["BgValArchFrequency"];
                apl.ImageCapturingMode   = (int?)dbResult[0]["ImageCapturingMode"];
                apl.ImageCapturingCount  = (int?)dbResult[0]["ImageCapturingCount"];
                apl.VideoCapturingMode   = (int?)dbResult[0]["VideoCapturingMode"];
                apl.VideoCapturingLength = (int?)dbResult[0]["VideoCapturingLength"];
            }

            return(apl);
        }