Пример #1
0
        public void Glue(GlueTargets glueTargets, GlueParameter gluePara)
        {
            lock (_motionLocker)
            {
                ClearInterpolationBuffer();

                PointInfo gluePoint;
                PointInfo risePoint;

                for (int i = 0; i < 4; i++)
                {
                    gluePoint = new PointInfo()
                    {
                        X = glueTargets.PointTargets[i].X,
                        Y = glueTargets.PointTargets[i].Y,
                        Z = glueTargets.PointTargets[i].Z + gluePara.GlueRadius,
                    };
                    AddPoint(gluePoint);
                    AddDigitalOutput(OutputState.On);
                    if (i == 0)
                    {
                        AddDelay(gluePara.PreShotTime);
                    }
                    else
                    {
                        AddDelay(gluePara.PreShotTime - gluePara.SecondLineLessPreShot);
                    }
                    AddDelay(gluePara.GluePeriod);
                    AddDigitalOutput(OutputState.Off);

                    risePoint = new PointInfo()
                    {
                        X = glueTargets.PointTargets[i].X,
                        Y = glueTargets.PointTargets[i].Y,
                        Z = glueTargets.PointTargets[i].Z + gluePara.RiseGlueHeight,
                    };
                    AddPoint(risePoint, gluePara.RiseGlueSpeed);
                    AddDelay(gluePara.CloseGlueDelay);
                }

                var lastRise = new PointInfo()
                {
                    X = glueTargets.PointTargets[3].X,
                    Y = glueTargets.PointTargets[3].Y,
                    Z = glueTargets.PointTargets[3].Z + 20,
                };
                AddPoint(lastRise);

                CheckEnoughSpace();
                StartInterpolation();
                WaitTillInterpolationEnd();
            }
        }
Пример #2
0
        public void Setup()
        {
            MotorX = _mc.MotorGluePointX;
            MotorY = _mc.MotorGluePointY;
            MotorZ = _mc.MotorGluePointZ;

            NeedleOutput    = Output.GluePoint;
            NeedleCleanPool = Output.GluePointClean;

            Preparation          = Helper.DummyAsyncTask();
            LaserRefereceZHeight = Properties.Settings.Default.LaserReferenceGluePoint;
            GlueParas            = Helper.GetGlueParameter(_glueParameters, _coordinateId);
        }
Пример #3
0
        public void GlueOld(GlueTargets glueTargets, GlueParameter gluePara)
        {
            ClearInterpolationBuffer();

            #region First point.
            //Go to first point and delay.
            int index      = 0;
            var firstPoint = new PointInfo()
            {
                X = glueTargets.ArcTargets[index].XStart,
                Y = glueTargets.ArcTargets[index].YStart,
                Z = glueTargets.ArcTargets[index].Z + gluePara.GlueHeightOffset[index],
            };
            AddPoint(firstPoint);
            AddDigitalOutput(OutputState.On);
            AddDelay(gluePara.PreShotTime);

            AddArc(glueTargets.ArcTargets[index], gluePara.GlueSpeed);
            //Todo  Pre close to avoid sharp ending.
            AddDigitalOutput(OutputState.Off);

            var firstRise = new PointInfo()
            {
                X = glueTargets.ArcTargets[index].XEnd,
                Y = glueTargets.ArcTargets[index].YEnd,
                Z = glueTargets.ArcTargets[index].Z + gluePara.RiseGlueHeight,
            };
            AddPoint(firstRise, gluePara.RiseGlueSpeed);

            AddDelay(gluePara.CloseGlueDelay);
            #endregion

            #region Second point.
            index++;
            var secondPoint = new PointInfo()
            {
                X = glueTargets.ArcTargets[index].XStart,
                Y = glueTargets.ArcTargets[index].YStart,
                Z = glueTargets.ArcTargets[index].Z + gluePara.GlueHeightOffset[index],
            };
            AddPoint(secondPoint);
            AddDigitalOutput(OutputState.On);
            AddDelay(gluePara.PreShotTime - gluePara.SecondLineLessPreShot);

            AddArc(glueTargets.ArcTargets[index], gluePara.GlueSpeed);
            //Todo  Pre close to avoid sharp ending.
            AddDigitalOutput(OutputState.Off);

            var secondRise = new PointInfo()
            {
                X = glueTargets.ArcTargets[index].XEnd,
                Y = glueTargets.ArcTargets[index].YEnd,
                Z = glueTargets.ArcTargets[index].Z + gluePara.RiseGlueHeight,
            };
            AddPoint(secondRise, gluePara.RiseGlueSpeed);

            AddDelay(gluePara.CloseGlueDelay);
            #endregion

            #region third point.
            index++;
            var thirdPoint = new PointInfo()
            {
                X = glueTargets.ArcTargets[index].XStart,
                Y = glueTargets.ArcTargets[index].YStart,
                Z = glueTargets.ArcTargets[index].Z + gluePara.GlueHeightOffset[index],
            };
            AddPoint(thirdPoint);
            AddDigitalOutput(OutputState.On);
            AddDelay(gluePara.PreShotTime - gluePara.SecondLineLessPreShot);

            AddArc(glueTargets.ArcTargets[index], gluePara.GlueSpeed);
            //Todo  Pre close to avoid sharp ending.
            AddDigitalOutput(OutputState.Off);

            var thirdRise = new PointInfo()
            {
                X = glueTargets.ArcTargets[index].XEnd,
                Y = glueTargets.ArcTargets[index].YEnd,
                Z = glueTargets.ArcTargets[index].Z + gluePara.RiseGlueHeight,
            };
            AddPoint(thirdRise, gluePara.RiseGlueSpeed);

            AddDelay(gluePara.CloseGlueDelay);
            #endregion

            #region fourth point.
            index++;
            var fourthPoint = new PointInfo()
            {
                X = glueTargets.ArcTargets[index].XStart,
                Y = glueTargets.ArcTargets[index].YStart,
                Z = glueTargets.ArcTargets[index].Z + gluePara.GlueHeightOffset[index],
            };
            AddPoint(fourthPoint);
            AddDigitalOutput(OutputState.On);
            AddDelay(gluePara.PreShotTime - gluePara.SecondLineLessPreShot);

            AddArc(glueTargets.ArcTargets[index], gluePara.GlueSpeed);
            //Todo  Pre close to avoid sharp ending.
            AddDigitalOutput(OutputState.Off);

            var fourthRise = new PointInfo()
            {
                X = glueTargets.ArcTargets[index].XEnd,
                Y = glueTargets.ArcTargets[index].YEnd,
                Z = glueTargets.ArcTargets[index].Z + gluePara.RiseGlueHeight,
            };
            AddPoint(fourthRise, gluePara.RiseGlueSpeed);

            AddDelay(gluePara.CloseGlueDelay);
            #endregion

            var finishRise = new PointInfo()
            {
                X = glueTargets.ArcTargets[index].XEnd,
                Y = glueTargets.ArcTargets[index].YEnd,
                Z = glueTargets.ArcTargets[index].Z + gluePara.RiseGlueHeight + 20,
            };
            AddPoint(finishRise, 10);

            CheckEnoughSpace();
            StartInterpolation();
            WaitTillInterpolationEnd();
        }
Пример #4
0
        public void Glue(GlueTargets glueTargets, GlueParameter gluePara)
        {
            lock (_motionLocker)
            {
                ClearInterpolationBuffer();

                #region First point.
                AddPoint(glueTargets.GroupPoints.Group1Points[0]);
                AddDigitalOutput(OutputState.On);
                AddDelay(gluePara.PreShotTime);

                //for (int i = 0; i < glueTargets.GroupPoints.Group1Points.Length; i++)
                //{
                //    AddPoint(glueTargets.GroupPoints.Group1Points[i], gluePara.GlueSpeed, gluePara.GlueSpeed);
                //}
                AddPoint(glueTargets.GroupPoints.Group1Points[10], gluePara.GlueSpeed, gluePara.GlueSpeed);

                AddDigitalOutput(OutputState.Off);
                glueTargets.GroupPoints.Group1Points[glueTargets.GroupPoints.Group1Points.Length - 2].Z +=
                    gluePara.RiseGlueHeight;
                AddPoint(glueTargets.GroupPoints.Group1Points[glueTargets.GroupPoints.Group1Points.Length - 2],
                         gluePara.RiseGlueSpeed, 0);
                AddDelay(gluePara.CloseGlueDelay);
                #endregion

                #region Second point.
                AddPoint(glueTargets.GroupPoints.Group2Points[0]);
                AddDigitalOutput(OutputState.On);
                AddDelay(gluePara.PreShotTime - -gluePara.SecondLineLessPreShot);

                //for (int i = 0; i < glueTargets.GroupPoints.Group2Points.Length; i++)
                //{
                //    AddPoint(glueTargets.GroupPoints.Group2Points[i], gluePara.GlueSpeed, gluePara.GlueSpeed);
                //}
                AddPoint(glueTargets.GroupPoints.Group2Points[10], gluePara.GlueSpeed, gluePara.GlueSpeed);

                AddDigitalOutput(OutputState.Off);
                glueTargets.GroupPoints.Group2Points[glueTargets.GroupPoints.Group2Points.Length - 2].Z +=
                    gluePara.RiseGlueHeight;
                AddPoint(glueTargets.GroupPoints.Group2Points[glueTargets.GroupPoints.Group2Points.Length - 2],
                         gluePara.RiseGlueSpeed, 0);
                AddDelay(gluePara.CloseGlueDelay);
                #endregion

                #region Third point.
                AddPoint(glueTargets.GroupPoints.Group3Points[0]);
                AddDigitalOutput(OutputState.On);
                AddDelay(gluePara.PreShotTime - -gluePara.SecondLineLessPreShot);

                //for (int i = 0; i < glueTargets.GroupPoints.Group3Points.Length; i++)
                //{
                //    AddPoint(glueTargets.GroupPoints.Group3Points[i], gluePara.GlueSpeed, gluePara.GlueSpeed);
                //}
                AddPoint(glueTargets.GroupPoints.Group3Points[10], gluePara.GlueSpeed, gluePara.GlueSpeed);

                AddDigitalOutput(OutputState.Off);
                glueTargets.GroupPoints.Group3Points[glueTargets.GroupPoints.Group3Points.Length - 2].Z +=
                    gluePara.RiseGlueHeight;
                AddPoint(glueTargets.GroupPoints.Group3Points[glueTargets.GroupPoints.Group3Points.Length - 2],
                         gluePara.RiseGlueSpeed, 0);
                AddDelay(gluePara.CloseGlueDelay);
                #endregion

                #region Fourth point.
                AddPoint(glueTargets.GroupPoints.Group4Points[0]);
                AddDigitalOutput(OutputState.On);
                AddDelay(gluePara.PreShotTime - -gluePara.SecondLineLessPreShot);

                //for (int i = 0; i < glueTargets.GroupPoints.Group4Points.Length; i++)
                //{
                //    AddPoint(glueTargets.GroupPoints.Group4Points[i], gluePara.GlueSpeed, gluePara.GlueSpeed);
                //}
                AddPoint(glueTargets.GroupPoints.Group4Points[10], gluePara.GlueSpeed, gluePara.GlueSpeed);

                AddDigitalOutput(OutputState.Off);
                glueTargets.GroupPoints.Group4Points[glueTargets.GroupPoints.Group4Points.Length - 2].Z +=
                    gluePara.RiseGlueHeight;
                AddPoint(glueTargets.GroupPoints.Group4Points[glueTargets.GroupPoints.Group4Points.Length - 2],
                         gluePara.RiseGlueSpeed, 0);
                AddDelay(gluePara.CloseGlueDelay);
                #endregion

                glueTargets.GroupPoints.Group4Points[glueTargets.GroupPoints.Group4Points.Length - 1].Z += 20;
                AddPoint(glueTargets.GroupPoints.Group4Points[glueTargets.GroupPoints.Group4Points.Length - 1]);

                CheckEnoughSpace();
                StartInterpolation();
                WaitTillInterpolationEnd();
            }
        }