Esempio n. 1
0
        /// <summary>
        /// Y轴终点再现
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnAxisYGoTo2_Click(object sender, EventArgs e)
        {
            double diff = double.Parse(this.txtYEndX.Text) - double.Parse(this.txtYStartX.Text);

            if (Math.Abs(diff) > 5)
            {
                MessageBox.Show("示教时请确保设备X轴固定", "", MessageBoxButtons.OKCancel);
                return;
            }
            Result res = Result.OK;

            res = Machine.Instance.Robot.MovePosZAndReply(double.Parse(this.txtPosZ2.Text));
            if (!res.IsOk)
            {
                return;
            }
            AxisYCPK cpk = CPKMgr.Instance.FindByName(typeof(AxisYCPK).Name) as AxisYCPK;

            if (cpk != null)
            {
                PointD p = cpk.calPoint();
                res = CpkMove.MoveToPosHigh(p.X, p.Y);
                if (!res.IsOk)
                {
                    return;
                }
                res = CpkMove.MoveToPosSlowly(double.Parse(this.txtYEndX.Text), double.Parse(this.txtYEndY.Text));
                if (!res.IsOk)
                {
                    return;
                }
            }
            //CpkMove.moveToPosDown(double.Parse(this.txtYEndX.Text), double.Parse(this.txtYEndY.Text), double.Parse(this.txtPosZ2.Text));
        }
Esempio n. 2
0
        private void DoAxisYCPK()
        {
            if (!this.cbUseASV.Checked)
            {
                this.checkGage();
            }
            Result res = Result.OK;

            res = Machine.Instance.Robot.MovePosZAndReply(double.Parse(this.txtPosZ2.Text));
            if (!res.IsOk)
            {
                return;
            }

            res = CpkMove.MoveToPosHigh(double.Parse(this.txtYStartX.Text), double.Parse(this.txtYStartY.Text));
            if (!res.IsOk)
            {
                return;
            }

            double diff = double.Parse(this.txtYEndX.Text) - double.Parse(this.txtYStartX.Text);

            if (Math.Abs(diff) > 5)
            {
                MessageBox.Show("示教时请确保设备X轴固定", "", MessageBoxButtons.OKCancel);
                return;
            }
            CPKMgr.Instance.ExecuteOne(typeof(AxisYCPK).Name);
        }
Esempio n. 3
0
        private void moveAndRead()
        {
            Result res = Result.OK;
            double height;

            this.isStop = false;
            dataInput.Clear();
            for (int i = 0; i < this.CpkPrm.YPointsNum; i++)
            {
                res = CpkMove.MoveToPosHigh(Start.X, Start.Y);
                if (!res.IsOk)
                {
                    return;
                }
                if (this.isStop)
                {
                    this.isStop = false;
                    break;
                }

                if (this.CpkMeasureType == 1) // 相机定位
                {
                    res = CpkMove.MoveToPosSlowly(End.X, End.Y);
                    if (!res.IsOk)
                    {
                        return;
                    }
                    double posInCamera;
                    bool   result = this.CaptruePos(out posInCamera);
                    if (!result)
                    {
                        return;
                    }
                    height = height = Machine.Instance.Robot.PosY + posInCamera;
                }
                else // 通信千分表
                {
                    res = CpkMove.MoveToPosHigh(pointTrans.X, pointTrans.Y);
                    if (!res.IsOk)
                    {
                        return;
                    }
                    res = CpkMove.MoveToPosSlowly(End.X, End.Y);
                    if (!res.IsOk)
                    {
                        return;
                    }
                    Thread.Sleep(3000);
                    //读取高度
                    int retCode = Machine.Instance.DigitalGage.DigitalGagable.ReadHeight(out height);
                    if (retCode != 0)
                    {
                        return;
                    }
                }
                dataInput.Add(height);
            }
        }
Esempio n. 4
0
        private void DoAxisXYCPK()
        {
            Result res = Result.OK;

            res = Machine.Instance.Robot.MovePosZAndReply(double.Parse(this.txtPosZ3.Text));
            if (!res.IsOk)
            {
                return;
            }

            res = CpkMove.MoveToPosHigh(double.Parse(this.txtXYStartX.Text), double.Parse(this.txtXYStartY.Text));
            if (!res.IsOk)
            {
                return;
            }
            CPKMgr.Instance.ExecuteOne(typeof(AxisXYCPK).Name);
        }
Esempio n. 5
0
        private void btnAxisXYGoTo1_Click(object sender, EventArgs e)
        {
            Result res = Result.OK;

            res = Machine.Instance.Robot.MovePosZAndReply(double.Parse(this.txtPosZ3.Text));
            if (!res.IsOk)
            {
                return;
            }
            AxisXYCPK cpk = CPKMgr.Instance.FindByName(typeof(AxisXYCPK).Name) as AxisXYCPK;

            if (cpk != null)
            {
                res = CpkMove.MoveToPosHigh(double.Parse(this.txtXYStartX.Text), double.Parse(this.txtXYStartY.Text));
                if (!res.IsOk)
                {
                    return;
                }
            }
        }
Esempio n. 6
0
        private void moveAndRead()
        {
            Result res = Result.OK;
            double height, height2;

            dataInput.Clear();
            dataInput2.Clear();
            this.isStop = false;
            for (int i = 0; i < this.CpkPrm.XYPointsNum; i++)
            {
                res = CpkMove.MoveToPosHigh(Start.X, Start.Y);
                if (!res.IsOk)
                {
                    return;
                }
                if (this.isStop)
                {
                    this.isStop = false;
                    break;
                }
                res = CpkMove.MoveToPosSlowly(End.X, End.Y);
                if (!res.IsOk)
                {
                    return;
                }
                double posInCameraX, posInCameraY;
                bool   result = this.CaptruePos(out posInCameraX, out posInCameraY);
                if (!result)
                {
                    return;
                }
                height  = Machine.Instance.Robot.PosX + posInCameraX;
                height2 = Machine.Instance.Robot.PosY + posInCameraY;
                dataInput.Add(height);
                dataInput2.Add(height2);
            }
        }