Exemple #1
0
        public Boolean move_SingleAxis(Coordinate_Axis newAxis, Coordinate_Axis oldAxis)
        {


            if (newAxis.A1 < axisUpLimited[0] && newAxis.A1 > axisDownLimited[0])
            {
                if (newAxis.A2 < axisUpLimited[1] && newAxis.A2 > axisDownLimited[1])
                {
                    if (newAxis.A3 < axisUpLimited[2] && newAxis.A3 > axisDownLimited[2])
                    {
                        if (newAxis.A4 < axisUpLimited[3] && newAxis.A4 > axisDownLimited[3])
                        {
                            if (newAxis.A5 < axisUpLimited[4] && newAxis.A5 > axisDownLimited[4])
                            {
                                if (newAxis.A6 < axisUpLimited[5] && newAxis.A6 > axisDownLimited[5])
                                {
                                    Coordinate_Axis Axis = new Coordinate_Axis();
                                    float[] AxisWaitTime = new float[6];

                                    AxisWaitTime[0] = (newAxis.A1 - oldAxis.A1) / Vel;
                                    AxisWaitTime[1] = (newAxis.A2 - oldAxis.A2) / Vel;
                                    AxisWaitTime[2] = (newAxis.A3 - oldAxis.A3) / Vel;
                                    AxisWaitTime[3] = (newAxis.A4 - oldAxis.A4) / Vel;
                                    AxisWaitTime[4] = (newAxis.A5 - oldAxis.A5) / Vel;
                                    AxisWaitTime[5] = (newAxis.A6 - oldAxis.A6) / Vel;
                                    //Axis.A1 = newAxis.A1 - oldAxis.A1;
                                    //Axis.A2 = newAxis.A2 - oldAxis.A2;
                                    //Axis.A3 = newAxis.A3 - oldAxis.A3;
                                    //Axis.A4 = newAxis.A4 - oldAxis.A4;
                                    //Axis.A5 = newAxis.A5 - oldAxis.A5;
                                    //Axis.A6 = newAxis.A6 - oldAxis.A6;


                                    AxisCommand[0] = (Math.Sign(AxisWaitTime[0]) * Vel).ToString();
                                    AxisCommand[1] = "0";
                                    AxisCommand[2] = "0";
                                    AxisCommand[3] = "0";
                                    AxisCommand[4] = "0";
                                    AxisCommand[5] = "0";
                                    move_KukaArm("Axis");

                                    Thread.Sleep(Math.Abs((int)AxisWaitTime[0]) * 12);
                                    AxisCommand[0] = "0";
                                    AxisCommand[1] = (Math.Sign(AxisWaitTime[1]) * Vel).ToString();
                                    AxisCommand[2] = "0";
                                    AxisCommand[3] = "0";
                                    AxisCommand[4] = "0";
                                    AxisCommand[5] = "0";
                                    move_KukaArm("Axis");

                                    Thread.Sleep(Math.Abs((int)AxisWaitTime[1]) * 12);
                                    AxisCommand[0] = "0";
                                    AxisCommand[1] = "0";
                                    AxisCommand[2] = (Math.Sign(AxisWaitTime[2]) * Vel).ToString();
                                    AxisCommand[3] = "0";
                                    AxisCommand[4] = "0";
                                    AxisCommand[5] = "0";
                                    move_KukaArm("Axis");

                                    Thread.Sleep(Math.Abs((int)AxisWaitTime[2]) * 12);
                                    AxisCommand[0] = "0";
                                    AxisCommand[1] = "0";
                                    AxisCommand[2] = "0";
                                    AxisCommand[3] = (Math.Sign(AxisWaitTime[3]) * Vel).ToString(); ;
                                    AxisCommand[4] = "0";
                                    AxisCommand[5] = "0";
                                    move_KukaArm("Axis");

                                    Thread.Sleep(Math.Abs((int)AxisWaitTime[3]) * 12);
                                    AxisCommand[0] = "0";
                                    AxisCommand[1] = "0";
                                    AxisCommand[2] = "0";
                                    AxisCommand[3] = "0";
                                    AxisCommand[4] = (Math.Sign(AxisWaitTime[4]) * Vel).ToString();
                                    AxisCommand[5] = "0";
                                    move_KukaArm("Axis");

                                    Thread.Sleep(Math.Abs((int)AxisWaitTime[4]) * 12);
                                    AxisCommand[0] = "0";
                                    AxisCommand[1] = "0";
                                    AxisCommand[2] = "0";
                                    AxisCommand[3] = "0";
                                    AxisCommand[4] = "0";
                                    AxisCommand[5] = (Math.Sign(AxisWaitTime[5]) * Vel).ToString();
                                    move_KukaArm("Axis");

                                    Thread.Sleep(Math.Abs((int)AxisWaitTime[5]) * 12);
                                    AxisCommand[0] = "0";
                                    AxisCommand[1] = "0";
                                    AxisCommand[2] = "0";
                                    AxisCommand[3] = "0";
                                    AxisCommand[4] = "0";
                                    AxisCommand[5] = "0";
                                    move_KukaArm("Axis");

                                }
                            }
                        }
                    }
                }
                return true;
            }

            else
            {
                return false;
            }

        }
Exemple #2
0
        public void move_Axis(Coordinate_Axis newAxis)
        {

            AxisCommand[0] = newAxis.A1.ToString();
            AxisCommand[1] = newAxis.A2.ToString();
            AxisCommand[2] = newAxis.A3.ToString();
            AxisCommand[3] = newAxis.A4.ToString();
            AxisCommand[4] = newAxis.A5.ToString();
            AxisCommand[5] = newAxis.A6.ToString();
            move_KukaArm("Axis");
            //(12ms =  一單位)
            Thread.Sleep(12);
            AxisCommand[0] = "0";
            AxisCommand[1] = "0";
            AxisCommand[2] = "0";
            AxisCommand[3] = "0";
            AxisCommand[4] = "0";
            AxisCommand[5] = "0";
            move_KukaArm("Axis");

        }
Exemple #3
0
        private void KukaMoveXyzabcModeThread()
        {
            switch (XyzabcMode)
            {
                case "X":
                {
                    if (MoveType == "0")
                    {
                        newXyzabc = new Coordinate_XYZABC();
                        oldXyzabc = new Coordinate_XYZABC();
                        newXyzabc.X = float.Parse(X_Command.Text);
                        newXyzabc.Y = float.Parse(Y_Value.Text);
                        newXyzabc.Z = float.Parse(Z_Value.Text);
                        newXyzabc.A = float.Parse(A_Value.Text);
                        newXyzabc.B = float.Parse(B_Value.Text);
                        newXyzabc.C = float.Parse(C_Value.Text);
                        oldXyzabc.X = float.Parse(X_Value.Text);
                        oldXyzabc.Y = float.Parse(Y_Value.Text);
                        oldXyzabc.Z = float.Parse(Z_Value.Text);
                        oldXyzabc.A = float.Parse(A_Value.Text);
                        oldXyzabc.B = float.Parse(B_Value.Text);
                        oldXyzabc.C = float.Parse(C_Value.Text);
                        if (!KukaRobotControlObject.move_XYZABC_SingalMode(newXyzabc, oldXyzabc))
                            myListBox("Error : Xyzabc Out of limited!!", ListMsg);
                        oldXyzabc = null;
                        newXyzabc = null;
                    }
                    else if (MoveType == "1")
                    {
                        newXyzabc = new Coordinate_XYZABC();
                        newXyzabc.X = 1;
                        newXyzabc.Y = 0;
                        newXyzabc.Z = 0;
                        newXyzabc.A = 0;
                        newXyzabc.B = 0;
                        newXyzabc.C = 0;
                        KukaRobotControlObject.move_XYZABC(newXyzabc);
                        newXyzabc = null;
                    }
                    else if (MoveType == "-1")
                    {
                        newXyzabc = new Coordinate_XYZABC();
                        newXyzabc.X = -1;
                        newXyzabc.Y = 0;
                        newXyzabc.Z = 0;
                        newXyzabc.A = 0;
                        newXyzabc.B = 0;
                        newXyzabc.C = 0;
                        KukaRobotControlObject.move_XYZABC(newXyzabc);
                        newXyzabc = null;
                    }
                    break;
                }
                case "Y":
                {
                    if (MoveType == "0")
                    {
                        newXyzabc = new Coordinate_XYZABC();
                        oldXyzabc = new Coordinate_XYZABC();
                        newXyzabc.X = float.Parse(X_Value.Text);
                        newXyzabc.Y = float.Parse(Y_Command.Text);
                        newXyzabc.Z = float.Parse(Z_Value.Text);
                        newXyzabc.A = float.Parse(A_Value.Text);
                        newXyzabc.B = float.Parse(B_Value.Text);
                        newXyzabc.C = float.Parse(C_Value.Text);
                        oldXyzabc.X = float.Parse(X_Value.Text);
                        oldXyzabc.Y = float.Parse(Y_Value.Text);
                        oldXyzabc.Z = float.Parse(Z_Value.Text);
                        oldXyzabc.A = float.Parse(A_Value.Text);
                        oldXyzabc.B = float.Parse(B_Value.Text);
                        oldXyzabc.C = float.Parse(C_Value.Text);
                        if (!KukaRobotControlObject.move_XYZABC_SingalMode(newXyzabc, oldXyzabc))
                            myListBox("Error : Xyzabc Out of limited!!", ListMsg);
                        oldXyzabc = null;
                        newXyzabc = null;
                    }
                    else if (MoveType == "1")
                    {
                        newXyzabc = new Coordinate_XYZABC();
                        newXyzabc.X = 0;
                        newXyzabc.Y = 1;
                        newXyzabc.Z = 0;
                        newXyzabc.A = 0;
                        newXyzabc.B = 0;
                        newXyzabc.C = 0;
                        KukaRobotControlObject.move_XYZABC(newXyzabc);
                        newXyzabc = null;
                    }
                    else if (MoveType == "-1")
                    {
                        newXyzabc = new Coordinate_XYZABC();
                        newXyzabc.X = 0;
                        newXyzabc.Y = -1;
                        newXyzabc.Z = 0;
                        newXyzabc.A = 0;
                        newXyzabc.B = 0;
                        newXyzabc.C = 0;
                        KukaRobotControlObject.move_XYZABC(newXyzabc);
                        newXyzabc = null;
                    }
                    break;
                }
                case "Z":
                {
                    if (MoveType == "0")
                    {
                        newXyzabc = new Coordinate_XYZABC();
                        oldXyzabc = new Coordinate_XYZABC();
                        newXyzabc.X = float.Parse(X_Value.Text);
                        newXyzabc.Y = float.Parse(Y_Value.Text);
                        newXyzabc.Z = float.Parse(Z_Command.Text);
                        newXyzabc.A = float.Parse(A_Value.Text);
                        newXyzabc.B = float.Parse(B_Value.Text);
                        newXyzabc.C = float.Parse(C_Value.Text);
                        oldXyzabc.X = float.Parse(X_Value.Text);
                        oldXyzabc.Y = float.Parse(Y_Value.Text);
                        oldXyzabc.Z = float.Parse(Z_Value.Text);
                        oldXyzabc.A = float.Parse(A_Value.Text);
                        oldXyzabc.B = float.Parse(B_Value.Text);
                        oldXyzabc.C = float.Parse(C_Value.Text);
                        if (!KukaRobotControlObject.move_XYZABC_SingalMode(newXyzabc, oldXyzabc))
                            myListBox("Error : Xyzabc Out of limited!!", ListMsg);
                        oldXyzabc = null;
                        newXyzabc = null;
                    }
                    else if (MoveType == "1")
                    {
                        newXyzabc = new Coordinate_XYZABC();
                        newXyzabc.X = 0;
                        newXyzabc.Y = 0;
                        newXyzabc.Z = 1;
                        newXyzabc.A = 0;
                        newXyzabc.B = 0;
                        newXyzabc.C = 0;
                        KukaRobotControlObject.move_XYZABC(newXyzabc);
                        newXyzabc = null;
                    }
                    else if (MoveType == "-1")
                    {
                        newXyzabc = new Coordinate_XYZABC();
                        newXyzabc.X = 0;
                        newXyzabc.Y = 0;
                        newXyzabc.Z = -1;
                        newXyzabc.A = 0;
                        newXyzabc.B = 0;
                        newXyzabc.C = 0;
                        KukaRobotControlObject.move_XYZABC(newXyzabc);
                        newXyzabc = null;
                    }
                    break;
                }
                case "A":
                {
                    if (MoveType == "0")
                    {
                        newXyzabc = new Coordinate_XYZABC();
                        oldXyzabc = new Coordinate_XYZABC();
                        newXyzabc.X = float.Parse(X_Value.Text);
                        newXyzabc.Y = float.Parse(Y_Value.Text);
                        newXyzabc.Z = float.Parse(Z_Value.Text);
                        newXyzabc.A = float.Parse(A_Command.Text);
                        newXyzabc.B = float.Parse(B_Value.Text);
                        newXyzabc.C = float.Parse(C_Value.Text);
                        oldXyzabc.X = float.Parse(X_Value.Text);
                        oldXyzabc.Y = float.Parse(Y_Value.Text);
                        oldXyzabc.Z = float.Parse(Z_Value.Text);
                        oldXyzabc.A = float.Parse(A_Value.Text);
                        oldXyzabc.B = float.Parse(B_Value.Text);
                        oldXyzabc.C = float.Parse(C_Value.Text);
                        if (!KukaRobotControlObject.move_XYZABC_RotationMode(newXyzabc, oldXyzabc))
                            myListBox("Error : Xyzabc Out of limited!!", ListMsg);
                        oldXyzabc = null;
                        newXyzabc = null;
                    }
                    else if (MoveType == "1")
                    {
                        newXyzabc = new Coordinate_XYZABC();
                        newXyzabc.X = 0;
                        newXyzabc.Y = 0;
                        newXyzabc.Z = 0;
                        newXyzabc.A = 1;
                        newXyzabc.B = 0;
                        newXyzabc.C = 0;
                        KukaRobotControlObject.move_XYZABC(newXyzabc);
                        newXyzabc = null;
                    }
                    else if (MoveType == "-1")
                    {
                        newXyzabc = new Coordinate_XYZABC();
                        newXyzabc.X = 0;
                        newXyzabc.Y = 0;
                        newXyzabc.Z = 0;
                        newXyzabc.A = -1;
                        newXyzabc.B = 0;
                        newXyzabc.C = 0;
                        KukaRobotControlObject.move_XYZABC(newXyzabc);
                        newXyzabc = null;
                    }
                    break;
                }
                case "B":
                {
                    if (MoveType == "0")
                    {
                        newXyzabc = new Coordinate_XYZABC();
                        oldXyzabc = new Coordinate_XYZABC();
                        newXyzabc.X = float.Parse(X_Value.Text);
                        newXyzabc.Y = float.Parse(Y_Value.Text);
                        newXyzabc.Z = float.Parse(Z_Value.Text);
                        newXyzabc.A = float.Parse(A_Value.Text);
                        newXyzabc.B = float.Parse(B_Command.Text);
                        newXyzabc.C = float.Parse(C_Value.Text);
                        oldXyzabc.X = float.Parse(X_Value.Text);
                        oldXyzabc.Y = float.Parse(Y_Value.Text);
                        oldXyzabc.Z = float.Parse(Z_Value.Text);
                        oldXyzabc.A = float.Parse(A_Value.Text);
                        oldXyzabc.B = float.Parse(B_Value.Text);
                        oldXyzabc.C = float.Parse(C_Value.Text);
                        if (!KukaRobotControlObject.move_XYZABC_RotationMode(newXyzabc, oldXyzabc))
                            myListBox("Error : Xyzabc Out of limited!!", ListMsg);
                        oldXyzabc = null;
                        newXyzabc = null;
                    }
                    else if (MoveType == "1")
                    {
                        newXyzabc = new Coordinate_XYZABC();
                        newXyzabc.X = 0;
                        newXyzabc.Y = 0;
                        newXyzabc.Z = 0;
                        newXyzabc.A = 0;
                        newXyzabc.B = 1;
                        newXyzabc.C = 0;
                        KukaRobotControlObject.move_XYZABC(newXyzabc);
                        newXyzabc = null;
                    }
                    else if (MoveType == "-1")
                    {
                        newXyzabc = new Coordinate_XYZABC();
                        newXyzabc.X = 0;
                        newXyzabc.Y = 0;
                        newXyzabc.Z = 0;
                        newXyzabc.A = 0;
                        newXyzabc.B = -1;
                        newXyzabc.C = 0;
                        KukaRobotControlObject.move_XYZABC(newXyzabc);
                        newXyzabc = null;
                    }
                    break;
                }
                case "C":
                {
                    if (MoveType == "0")
                    {
                        newXyzabc = new Coordinate_XYZABC();
                        oldXyzabc = new Coordinate_XYZABC();
                        newXyzabc.X = float.Parse(X_Value.Text);
                        newXyzabc.Y = float.Parse(Y_Value.Text);
                        newXyzabc.Z = float.Parse(Z_Value.Text);
                        newXyzabc.A = float.Parse(A_Value.Text);
                        newXyzabc.B = float.Parse(B_Value.Text);
                        newXyzabc.C = float.Parse(C_Command.Text);
                        oldXyzabc.X = float.Parse(X_Value.Text);
                        oldXyzabc.Y = float.Parse(Y_Value.Text);
                        oldXyzabc.Z = float.Parse(Z_Value.Text);
                        oldXyzabc.A = float.Parse(A_Value.Text);
                        oldXyzabc.B = float.Parse(B_Value.Text);
                        oldXyzabc.C = float.Parse(C_Value.Text);
                        if (!KukaRobotControlObject.move_XYZABC_RotationMode(newXyzabc, oldXyzabc))
                            myListBox("Error : Xyzabc Out of limited!!", ListMsg);
                        oldXyzabc = null;
                        newXyzabc = null;
                    }
                    else if (MoveType == "1")
                    {
                        newXyzabc = new Coordinate_XYZABC();
                        newXyzabc.X = 0;
                        newXyzabc.Y = 0;
                        newXyzabc.Z = 0;
                        newXyzabc.A = 0;
                        newXyzabc.B = 0;
                        newXyzabc.C = 1;
                        KukaRobotControlObject.move_XYZABC(newXyzabc);
                        newXyzabc = null;
                    }
                    else if (MoveType == "-1")
                    {
                        newXyzabc = new Coordinate_XYZABC();
                        newXyzabc.X = 0;
                        newXyzabc.Y = 0;
                        newXyzabc.Z = 0;
                        newXyzabc.A = 0;
                        newXyzabc.B = 0;
                        newXyzabc.C = -1;
                        KukaRobotControlObject.move_XYZABC(newXyzabc);
                        newXyzabc = null;
                    }
                    break;
                }

                case "A1" :
                {
                    if (MoveType == "0")
                    {

                    }
                    else if (MoveType == "1")
                    {
                        newAxis = new Coordinate_Axis();
                        newAxis.A1 = 1;
                        newAxis.A2 = 0;
                        newAxis.A3 = 0;
                        newAxis.A4 = 0;
                        newAxis.A5 = 0;
                        newAxis.A6 = 0;
                        KukaRobotControlObject.move_Axis(newAxis);
                        newAxis = null;
                    }
                    else if (MoveType == "-1")
                    {
                        newAxis = new Coordinate_Axis();
                        newAxis.A1 = -1;
                        newAxis.A2 = 0;
                        newAxis.A3 = 0;
                        newAxis.A4 = 0;
                        newAxis.A5 = 0;
                        newAxis.A6 = 0;
                        KukaRobotControlObject.move_Axis(newAxis);
                        newAxis = null;
                    }
                    break;
                }
                case "A2":
                {
                    if (MoveType == "0")
                    {

                    }
                    else if (MoveType == "1")
                    {
                        newAxis = new Coordinate_Axis();
                        newAxis.A1 = 0;
                        newAxis.A2 = 1;
                        newAxis.A3 = 0;
                        newAxis.A4 = 0;
                        newAxis.A5 = 0;
                        newAxis.A6 = 0;
                        KukaRobotControlObject.move_Axis(newAxis);
                        newAxis = null;
                    }
                    else if (MoveType == "-1")
                    {
                        newAxis = new Coordinate_Axis();
                        newAxis.A1 = 0;
                        newAxis.A2 = -1;
                        newAxis.A3 = 0;
                        newAxis.A4 = 0;
                        newAxis.A5 = 0;
                        newAxis.A6 = 0;
                        KukaRobotControlObject.move_Axis(newAxis);
                        newAxis = null;
                    }
                    break;
                }
                case "A3":
                {
                    if (MoveType == "0")
                    {

                    }
                    else if (MoveType == "1")
                    {
                        newAxis = new Coordinate_Axis();
                        newAxis.A1 = 0;
                        newAxis.A2 = 0;
                        newAxis.A3 = 1;
                        newAxis.A4 = 0;
                        newAxis.A5 = 0;
                        newAxis.A6 = 0;
                        KukaRobotControlObject.move_Axis(newAxis);
                        newAxis = null;
                    }
                    else if (MoveType == "-1")
                    {
                        newAxis = new Coordinate_Axis();
                        newAxis.A1 = 0;
                        newAxis.A2 = 0;
                        newAxis.A3 = -1;
                        newAxis.A4 = 0;
                        newAxis.A5 = 0;
                        newAxis.A6 = 0;
                        KukaRobotControlObject.move_Axis(newAxis);
                        newAxis = null;
                    }
                    break;
                }
                case "A4":
                {
                    if (MoveType == "0")
                    {

                    }
                    else if (MoveType == "1")
                    {
                        newAxis = new Coordinate_Axis();
                        newAxis.A1 = 0;
                        newAxis.A2 = 0;
                        newAxis.A3 = 0;
                        newAxis.A4 = 1;
                        newAxis.A5 = 0;
                        newAxis.A6 = 0;
                        KukaRobotControlObject.move_Axis(newAxis);
                        newAxis = null;
                    }
                    else if (MoveType == "-1")
                    {
                        newAxis = new Coordinate_Axis();
                        newAxis.A1 = 0;
                        newAxis.A2 = 0;
                        newAxis.A3 = 0;
                        newAxis.A4 = -1;
                        newAxis.A5 = 0;
                        newAxis.A6 = 0;
                        KukaRobotControlObject.move_Axis(newAxis);
                        newAxis = null;
                    }
                    break;
                }
                case "A5":
                {
                    if (MoveType == "0")
                    {

                    }
                    else if (MoveType == "1")
                    {
                        newAxis = new Coordinate_Axis();
                        newAxis.A1 = 0;
                        newAxis.A2 = 0;
                        newAxis.A3 = 0;
                        newAxis.A4 = 0;
                        newAxis.A5 = 1;
                        newAxis.A6 = 0;
                        KukaRobotControlObject.move_Axis(newAxis);
                        newAxis = null;
                    }
                    else if (MoveType == "-1")
                    {
                        newAxis = new Coordinate_Axis();
                        newAxis.A1 = 0;
                        newAxis.A2 = 0;
                        newAxis.A3 = 0;
                        newAxis.A4 = 0;
                        newAxis.A5 = -1;
                        newAxis.A6 = 0;
                        KukaRobotControlObject.move_Axis(newAxis);
                        newAxis = null;
                    }
                    break;
                }
                case "A6":
                {
                    if (MoveType == "0")
                    {

                    }
                    else if (MoveType == "1")
                    {
                        newAxis = new Coordinate_Axis();
                        newAxis.A1 = 0;
                        newAxis.A2 = 0;
                        newAxis.A3 = 0;
                        newAxis.A4 = 0;
                        newAxis.A5 = 0;
                        newAxis.A6 = 1;
                        KukaRobotControlObject.move_Axis(newAxis);
                        newAxis = null;
                    }
                    else if (MoveType == "-1")
                    {
                        newAxis = new Coordinate_Axis();
                        newAxis.A1 = 0;
                        newAxis.A2 = 0;
                        newAxis.A3 = 0;
                        newAxis.A4 = 0;
                        newAxis.A5 = 0;
                        newAxis.A6 = -1;
                        KukaRobotControlObject.move_Axis(newAxis);
                        newAxis = null;
                    }
                    break;
                }
                case "Xyzabc":
                {
                    newXyzabc = new Coordinate_XYZABC();
                    oldXyzabc = new Coordinate_XYZABC();
                    newXyzabc.X = float.Parse(X_Command.Text);
                    newXyzabc.Y = float.Parse(Y_Command.Text);
                    newXyzabc.Z = float.Parse(Z_Command.Text);
                    newXyzabc.A = float.Parse(A_Value.Text);
                    newXyzabc.B = float.Parse(B_Value.Text);
                    newXyzabc.C = float.Parse(C_Value.Text);
                    oldXyzabc.X = float.Parse(X_Value.Text);
                    oldXyzabc.Y = float.Parse(Y_Value.Text);
                    oldXyzabc.Z = float.Parse(Z_Value.Text);
                    oldXyzabc.A = float.Parse(A_Value.Text);
                    oldXyzabc.B = float.Parse(B_Value.Text);
                    oldXyzabc.C = float.Parse(C_Value.Text);

                    //if (!KukaRobotControlObject.move_XYZABC_TogetherMode(newXyzabc, oldXyzabc))
                    if (!KukaRobotControlObject.move_XYZABC_TogetherMode(newXyzabc, oldXyzabc))
                        myListBox("Error : Xyzabc Out of limited!!", ListMsg);
                    oldXyzabc = null;
                    newXyzabc = null;
                    break;
                }
                case "Axis":
                {
                    if (MoveType == "0")
                    {
                        newAxis = new Coordinate_Axis();
                        oldAxis = new Coordinate_Axis();
                        newAxis.A1 = float.Parse(A1_Command.Text);
                        newAxis.A2 = float.Parse(A2_Command.Text);
                        newAxis.A3 = float.Parse(A3_Command.Text);
                        newAxis.A4 = float.Parse(A4_Command.Text);
                        newAxis.A5 = float.Parse(A5_Command.Text);
                        newAxis.A6 = float.Parse(A6_Command.Text);
                        oldAxis.A1 = float.Parse(A1_Value.Text);
                        oldAxis.A2 = float.Parse(A2_Value.Text);
                        oldAxis.A3 = float.Parse(A3_Value.Text);
                        oldAxis.A4 = float.Parse(A4_Value.Text);
                        oldAxis.A5 = float.Parse(A5_Value.Text);
                        oldAxis.A6 = float.Parse(A6_Value.Text);

                        //if (!KukaRobotControlObject.move_XYZABC_TogetherMode(newXyzabc, oldXyzabc))
                        if (!KukaRobotControlObject.move_SingleAxis(newAxis, oldAxis))
                            myListBox("Error : Axis Out of limited!!", ListMsg);
                        oldAxis = null;
                        newAxis = null;

                    }
                    else if (MoveType == "1")
                    {
                        newAxis = new Coordinate_Axis();
                        oldAxis = new Coordinate_Axis();
                        newAxis.A1 = float.Parse(A1_Command.Text);
                        newAxis.A2 = float.Parse(A2_Value.Text);
                        newAxis.A3 = float.Parse(A3_Value.Text);
                        newAxis.A4 = float.Parse(A4_Value.Text);
                        newAxis.A5 = float.Parse(A5_Value.Text);
                        newAxis.A6 = float.Parse(A6_Value.Text);
                        oldAxis.A1 = float.Parse(A1_Value.Text);
                        oldAxis.A2 = float.Parse(A2_Value.Text);
                        oldAxis.A3 = float.Parse(A3_Value.Text);
                        oldAxis.A4 = float.Parse(A4_Value.Text);
                        oldAxis.A5 = float.Parse(A5_Value.Text);
                        oldAxis.A6 = float.Parse(A6_Value.Text);

                        //if (!KukaRobotControlObject.move_XYZABC_TogetherMode(newXyzabc, oldXyzabc))
                        if (!KukaRobotControlObject.move_SingleAxis(newAxis, oldAxis))
                            myListBox("Error : Axis Out of limited!!", ListMsg);
                        oldAxis = null;
                        newAxis = null;
                    }
                    else if (MoveType == "2")
                    {
                        newAxis = new Coordinate_Axis();
                        oldAxis = new Coordinate_Axis();
                        newAxis.A1 = float.Parse(A1_Value.Text);
                        newAxis.A2 = float.Parse(A2_Command.Text);
                        newAxis.A3 = float.Parse(A3_Value.Text);
                        newAxis.A4 = float.Parse(A4_Value.Text);
                        newAxis.A5 = float.Parse(A5_Value.Text);
                        newAxis.A6 = float.Parse(A6_Value.Text);
                        oldAxis.A1 = float.Parse(A1_Value.Text);
                        oldAxis.A2 = float.Parse(A2_Value.Text);
                        oldAxis.A3 = float.Parse(A3_Value.Text);
                        oldAxis.A4 = float.Parse(A4_Value.Text);
                        oldAxis.A5 = float.Parse(A5_Value.Text);
                        oldAxis.A6 = float.Parse(A6_Value.Text);

                        //if (!KukaRobotControlObject.move_XYZABC_TogetherMode(newXyzabc, oldXyzabc))
                        if (!KukaRobotControlObject.move_SingleAxis(newAxis, oldAxis))
                            myListBox("Error : Axis Out of limited!!", ListMsg);
                        oldAxis = null;
                        newAxis = null;
                    }
                    else if (MoveType == "3")
                    {
                        newAxis = new Coordinate_Axis();
                        oldAxis = new Coordinate_Axis();
                        newAxis.A1 = float.Parse(A1_Value.Text);
                        newAxis.A2 = float.Parse(A2_Value.Text);
                        newAxis.A3 = float.Parse(A3_Command.Text);
                        newAxis.A4 = float.Parse(A4_Value.Text);
                        newAxis.A5 = float.Parse(A5_Value.Text);
                        newAxis.A6 = float.Parse(A6_Value.Text);
                        oldAxis.A1 = float.Parse(A1_Value.Text);
                        oldAxis.A2 = float.Parse(A2_Value.Text);
                        oldAxis.A3 = float.Parse(A3_Value.Text);
                        oldAxis.A4 = float.Parse(A4_Value.Text);
                        oldAxis.A5 = float.Parse(A5_Value.Text);
                        oldAxis.A6 = float.Parse(A6_Value.Text);

                        //if (!KukaRobotControlObject.move_XYZABC_TogetherMode(newXyzabc, oldXyzabc))
                        if (!KukaRobotControlObject.move_SingleAxis(newAxis, oldAxis))
                            myListBox("Error : Axis Out of limited!!", ListMsg);
                        oldAxis = null;
                        newAxis = null;
                    }
                    else if (MoveType == "4")
                    {
                        newAxis = new Coordinate_Axis();
                        oldAxis = new Coordinate_Axis();
                        newAxis.A1 = float.Parse(A1_Value.Text);
                        newAxis.A2 = float.Parse(A2_Value.Text);
                        newAxis.A3 = float.Parse(A3_Value.Text);
                        newAxis.A4 = float.Parse(A4_Command.Text);
                        newAxis.A5 = float.Parse(A5_Value.Text);
                        newAxis.A6 = float.Parse(A6_Value.Text);
                        oldAxis.A1 = float.Parse(A1_Value.Text);
                        oldAxis.A2 = float.Parse(A2_Value.Text);
                        oldAxis.A3 = float.Parse(A3_Value.Text);
                        oldAxis.A4 = float.Parse(A4_Value.Text);
                        oldAxis.A5 = float.Parse(A5_Value.Text);
                        oldAxis.A6 = float.Parse(A6_Value.Text);

                        //if (!KukaRobotControlObject.move_XYZABC_TogetherMode(newXyzabc, oldXyzabc))
                        if (!KukaRobotControlObject.move_SingleAxis(newAxis, oldAxis))
                            myListBox("Error : Axis Out of limited!!", ListMsg);
                        oldAxis = null;
                        newAxis = null;
                    }
                    else if (MoveType == "5")
                    {
                        newAxis = new Coordinate_Axis();
                        oldAxis = new Coordinate_Axis();
                        newAxis.A1 = float.Parse(A1_Value.Text);
                        newAxis.A2 = float.Parse(A2_Value.Text);
                        newAxis.A3 = float.Parse(A3_Value.Text);
                        newAxis.A4 = float.Parse(A4_Value.Text);
                        newAxis.A5 = float.Parse(A5_Command.Text);
                        newAxis.A6 = float.Parse(A6_Value.Text);
                        oldAxis.A1 = float.Parse(A1_Value.Text);
                        oldAxis.A2 = float.Parse(A2_Value.Text);
                        oldAxis.A3 = float.Parse(A3_Value.Text);
                        oldAxis.A4 = float.Parse(A4_Value.Text);
                        oldAxis.A5 = float.Parse(A5_Value.Text);
                        oldAxis.A6 = float.Parse(A6_Value.Text);

                        //if (!KukaRobotControlObject.move_XYZABC_TogetherMode(newXyzabc, oldXyzabc))
                        if (!KukaRobotControlObject.move_SingleAxis(newAxis, oldAxis))
                            myListBox("Error : Axis Out of limited!!", ListMsg);
                        oldAxis = null;
                        newAxis = null;
                    }
                    else if (MoveType == "6")
                    {
                        newAxis = new Coordinate_Axis();
                        oldAxis = new Coordinate_Axis();
                        newAxis.A1 = float.Parse(A1_Value.Text);
                        newAxis.A2 = float.Parse(A2_Value.Text);
                        newAxis.A3 = float.Parse(A3_Value.Text);
                        newAxis.A4 = float.Parse(A4_Value.Text);
                        newAxis.A5 = float.Parse(A5_Value.Text);
                        newAxis.A6 = float.Parse(A6_Command.Text);
                        oldAxis.A1 = float.Parse(A1_Value.Text);
                        oldAxis.A2 = float.Parse(A2_Value.Text);
                        oldAxis.A3 = float.Parse(A3_Value.Text);
                        oldAxis.A4 = float.Parse(A4_Value.Text);
                        oldAxis.A5 = float.Parse(A5_Value.Text);
                        oldAxis.A6 = float.Parse(A6_Value.Text);

                        //if (!KukaRobotControlObject.move_XYZABC_TogetherMode(newXyzabc, oldXyzabc))
                        if (!KukaRobotControlObject.move_SingleAxis(newAxis, oldAxis))
                            myListBox("Error : Axis Out of limited!!", ListMsg);
                        oldAxis = null;
                        newAxis = null;
                    }
                    else if (MoveType == "9")
                    {
                        newAxis = new Coordinate_Axis();
                        oldAxis = new Coordinate_Axis();
                        newAxis.A1 = float.Parse(Path[Path_count, 0].ToString());
                        newAxis.A2 = float.Parse(Path[Path_count, 1].ToString());
                        newAxis.A3 = float.Parse(Path[Path_count, 2].ToString());
                        newAxis.A4 = float.Parse(Path[Path_count, 3].ToString());
                        newAxis.A5 = float.Parse(Path[Path_count, 4].ToString());
                        newAxis.A6 = float.Parse(Path[Path_count, 5].ToString());
                        oldAxis.A1 = float.Parse(A1_Value.Text);
                        oldAxis.A2 = float.Parse(A2_Value.Text);
                        oldAxis.A3 = float.Parse(A3_Value.Text);
                        oldAxis.A4 = float.Parse(A4_Value.Text);
                        oldAxis.A5 = float.Parse(A5_Value.Text);
                        oldAxis.A6 = float.Parse(A6_Value.Text);

                        //if (!KukaRobotControlObject.move_XYZABC_TogetherMode(newXyzabc, oldXyzabc))
                        if (!KukaRobotControlObject.move_SingleAxis(newAxis, oldAxis))
                            myListBox("Error : Xyzabc Out of limited!!", ListMsg);
                        oldAxis = null;
                        newAxis = null;
                        Path_count++;
                        if (Path_count == 20)
                        {
                            Path_count = 0;
                        }
                    }
                    break;
                }
                case "XyzabcHome":
                {
                    newAxis = new Coordinate_Axis();
                    oldAxis = new Coordinate_Axis();
                    newAxis.A1 = 0;
                    newAxis.A2 = -90;
                    newAxis.A3 = 90;
                    newAxis.A4 = 0;
                    newAxis.A5 = -90;
                    newAxis.A6 = -180;
                    oldAxis.A1 = float.Parse(A1_Value.Text);
                    oldAxis.A2 = float.Parse(A2_Value.Text);
                    oldAxis.A3 = float.Parse(A3_Value.Text);
                    oldAxis.A4 = float.Parse(A4_Value.Text);
                    oldAxis.A5 = float.Parse(A5_Value.Text);
                    oldAxis.A6 = float.Parse(A6_Value.Text);

                    //if (!KukaRobotControlObject.move_XYZABC_TogetherMode(newXyzabc, oldXyzabc))
                    if (!KukaRobotControlObject.move_SingleAxis(newAxis, oldAxis))
                        myListBox("Error : Xyzabc Out of limited!!", ListMsg);
                    oldAxis = null;
                    newAxis = null;
                    break;

                }
                case "PoseEstimation":
                {
                    if (MoveType == "0")
                    {
                        newXyzabc = new Coordinate_XYZABC();
                        oldXyzabc = new Coordinate_XYZABC();
                        newXyzabc.X = KukaRobotControlObject.Serv.PoseRecognitionSystem_Data.CaptureImage_Position[0];
                        newXyzabc.Y = KukaRobotControlObject.Serv.PoseRecognitionSystem_Data.CaptureImage_Position[1];
                        newXyzabc.Z = KukaRobotControlObject.Serv.PoseRecognitionSystem_Data.GraspInitial_Position[2];
                        newXyzabc.A = float.Parse(A_Value.Text);
                        newXyzabc.B = float.Parse(B_Value.Text);
                        newXyzabc.C = float.Parse(C_Value.Text);
                        oldXyzabc.X = float.Parse(X_Value.Text);
                        oldXyzabc.Y = float.Parse(Y_Value.Text);
                        oldXyzabc.Z = float.Parse(Z_Value.Text);
                        oldXyzabc.A = float.Parse(A_Value.Text);
                        oldXyzabc.B = float.Parse(B_Value.Text);
                        oldXyzabc.C = float.Parse(C_Value.Text);
                        if (!KukaRobotControlObject.move_XYZABC_TogetherMode(newXyzabc, oldXyzabc))
                            myListBox("Error : Xyzabc Out of limited!!", ListMsg);                      
                        oldXyzabc = null;
                        newXyzabc = null;


                        newXyzabc = new Coordinate_XYZABC();
                        oldXyzabc = new Coordinate_XYZABC();
                        newXyzabc.X = float.Parse(X_Value.Text);
                        newXyzabc.Y = float.Parse(Y_Value.Text);
                        newXyzabc.Z = float.Parse(Z_Value.Text);
                        newXyzabc.A = float.Parse(A_Value.Text);
                        newXyzabc.B = KukaRobotControlObject.Serv.PoseRecognitionSystem_Data.CaptureImage_Position[4];
                        newXyzabc.C = float.Parse(C_Value.Text);
                        oldXyzabc.X = float.Parse(X_Value.Text);
                        oldXyzabc.Y = float.Parse(Y_Value.Text);
                        oldXyzabc.Z = float.Parse(Z_Value.Text);
                        oldXyzabc.A = float.Parse(A_Value.Text);
                        oldXyzabc.B = KukaRobotControlObject.Serv.PoseRecognitionSystem_Data.GraspInitial_Position[4];
                        oldXyzabc.C = float.Parse(C_Value.Text);
                        if (!KukaRobotControlObject.move_XYZABC_RotationMode(newXyzabc, oldXyzabc))
                            myListBox("Error : Xyzabc Out of limited!!", ListMsg);
                        oldXyzabc = null;
                        newXyzabc = null;

                        newXyzabc = new Coordinate_XYZABC();
                        oldXyzabc = new Coordinate_XYZABC();
                        newXyzabc.X = float.Parse(X_Value.Text);
                        newXyzabc.Y = float.Parse(Y_Value.Text);
                        newXyzabc.Z = KukaRobotControlObject.Serv.PoseRecognitionSystem_Data.CaptureImage_Position[2];
                        newXyzabc.A = float.Parse(A_Value.Text);
                        newXyzabc.B = float.Parse(B_Value.Text);
                        newXyzabc.C = float.Parse(C_Value.Text);
                        oldXyzabc.X = float.Parse(X_Value.Text);
                        oldXyzabc.Y = float.Parse(Y_Value.Text);
                        oldXyzabc.Z = float.Parse(Z_Value.Text);
                        oldXyzabc.A = float.Parse(A_Value.Text);
                        oldXyzabc.B = float.Parse(B_Value.Text);
                        oldXyzabc.C = float.Parse(C_Value.Text);
                        if (!KukaRobotControlObject.move_XYZABC_SingalMode(newXyzabc, oldXyzabc))
                            myListBox("Error : Xyzabc Out of limited!!", ListMsg);
                        oldXyzabc = null;
                        newXyzabc = null;
                     
                        IsArmCanMove = true;
                        KukaRobotControlObject.Serv.PoseRecognitionSystem_Data._State = 9;
                        
                    }
                    else if (MoveType == "1")
                    {
                        
                        newXyzabc = new Coordinate_XYZABC();
                        oldXyzabc = new Coordinate_XYZABC();
                        newXyzabc.X = float.Parse(X_Value.Text);
                        newXyzabc.Y = float.Parse(Y_Value.Text);
                        newXyzabc.Z = KukaRobotControlObject.Serv.PoseRecognitionSystem_Data.GraspInitial_Position[2];
                        newXyzabc.A = float.Parse(A_Value.Text);
                        newXyzabc.B = float.Parse(B_Value.Text);
                        newXyzabc.C = float.Parse(C_Value.Text);
                        oldXyzabc.X = float.Parse(X_Value.Text);
                        oldXyzabc.Y = float.Parse(Y_Value.Text);
                        oldXyzabc.Z = float.Parse(Z_Value.Text);
                        oldXyzabc.A = float.Parse(A_Value.Text);
                        oldXyzabc.B = float.Parse(B_Value.Text);
                        oldXyzabc.C = float.Parse(C_Value.Text);
                        if (!KukaRobotControlObject.move_XYZABC_SingalMode(newXyzabc, oldXyzabc))
                            myListBox("Error : Xyzabc Out of limited!!", ListMsg);
                        oldXyzabc = null;
                        newXyzabc = null;


                        newXyzabc = new Coordinate_XYZABC();
                        oldXyzabc = new Coordinate_XYZABC();
                        newXyzabc.X = float.Parse(X_Value.Text);
                        newXyzabc.Y = float.Parse(Y_Value.Text);
                        newXyzabc.Z = float.Parse(Z_Value.Text);
                        newXyzabc.A = float.Parse(A_Value.Text);
                        newXyzabc.B = KukaRobotControlObject.Serv.PoseRecognitionSystem_Data.GraspInitial_Position[4];
                        newXyzabc.C = float.Parse(C_Value.Text);
                        oldXyzabc.X = float.Parse(X_Value.Text);
                        oldXyzabc.Y = float.Parse(Y_Value.Text);
                        oldXyzabc.Z = float.Parse(Z_Value.Text);
                        oldXyzabc.A = float.Parse(A_Value.Text);
                        oldXyzabc.B = KukaRobotControlObject.Serv.PoseRecognitionSystem_Data.CaptureImage_Position[4];
                        oldXyzabc.C = float.Parse(C_Value.Text);
                        if (!KukaRobotControlObject.move_XYZABC_RotationMode(newXyzabc, oldXyzabc))
                            myListBox("Error : Xyzabc Out of limited!!", ListMsg);
                        oldXyzabc = null;
                        newXyzabc = null;


                        newXyzabc = new Coordinate_XYZABC();
                        oldXyzabc = new Coordinate_XYZABC();
                        newXyzabc.X = KukaRobotControlObject.Serv.PoseRecognitionSystem_Data.GraspInitial_Position[0];
                        newXyzabc.Y = KukaRobotControlObject.Serv.PoseRecognitionSystem_Data.GraspInitial_Position[1];
                        newXyzabc.Z = float.Parse(Z_Value.Text);
                        newXyzabc.A = float.Parse(A_Value.Text);
                        newXyzabc.B = float.Parse(B_Value.Text);
                        newXyzabc.C = float.Parse(C_Value.Text);
                        oldXyzabc.X = float.Parse(X_Value.Text);
                        oldXyzabc.Y = float.Parse(Y_Value.Text);
                        oldXyzabc.Z = float.Parse(Z_Value.Text);
                        oldXyzabc.A = float.Parse(A_Value.Text);
                        oldXyzabc.B = float.Parse(B_Value.Text);
                        oldXyzabc.C = float.Parse(C_Value.Text);
                        if (!KukaRobotControlObject.move_XYZABC_TogetherMode(newXyzabc, oldXyzabc))
                            myListBox("Error : Xyzabc Out of limited!!", ListMsg);
                        oldXyzabc = null;
                        newXyzabc = null;

                        IsArmCanMove = true;
                        KukaRobotControlObject.Serv.PoseRecognitionSystem_Data._State = 9;
                        
                    }
                    else if (MoveType == "2")
                    {
                        /*
                         *  抓取物件
                         */
                        GraspObjectType = KukaRobotControlObject.Serv.PoseRecognitionSystem_Data._ObjectType;
                        Start_A = float.Parse(A_Value.Text);

                        newXyzabc = new Coordinate_XYZABC();
                        oldXyzabc = new Coordinate_XYZABC();
                        newXyzabc.X = float.Parse(X_Value.Text);
                        newXyzabc.Y = float.Parse(Y_Value.Text);
                        newXyzabc.Z = float.Parse(Z_Value.Text);
                        newXyzabc.A = Start_A + KukaRobotControlObject.Serv.PoseRecognitionSystem_Data._A;
                        newXyzabc.B = float.Parse(B_Value.Text);
                        newXyzabc.C = float.Parse(C_Value.Text);
                        oldXyzabc.X = float.Parse(X_Value.Text);
                        oldXyzabc.Y = float.Parse(Y_Value.Text);
                        oldXyzabc.Z = float.Parse(Z_Value.Text);
                        oldXyzabc.A = Start_A;
                        oldXyzabc.B = float.Parse(B_Value.Text);
                        oldXyzabc.C = float.Parse(C_Value.Text);
                        if (!KukaRobotControlObject.move_XYZABC_RotationMode(newXyzabc, oldXyzabc))
                            myListBox("Error : Xyzabc Out of limited!!", ListMsg);
                        oldXyzabc = null;
                        newXyzabc = null;

                        newXyzabc = new Coordinate_XYZABC();
                        oldXyzabc = new Coordinate_XYZABC();
                        newXyzabc.X = KukaRobotControlObject.Serv.PoseRecognitionSystem_Data._X;
                        newXyzabc.Y = KukaRobotControlObject.Serv.PoseRecognitionSystem_Data._Y;
                        newXyzabc.Z = KukaRobotControlObject.Serv.PoseRecognitionSystem_Data._Z;
                        newXyzabc.A = float.Parse(A_Value.Text);
                        newXyzabc.B = float.Parse(B_Value.Text);
                        newXyzabc.C = float.Parse(C_Value.Text);
                        oldXyzabc.X = float.Parse(X_Value.Text);
                        oldXyzabc.Y = float.Parse(Y_Value.Text);
                        oldXyzabc.Z = float.Parse(Z_Value.Text);
                        oldXyzabc.A = float.Parse(A_Value.Text);
                        oldXyzabc.B = float.Parse(B_Value.Text);
                        oldXyzabc.C = float.Parse(C_Value.Text);
                        if (!KukaRobotControlObject.move_XYZABC_TogetherMode(newXyzabc, oldXyzabc))
                            myListBox("Error : Xyzabc Out of limited!!", ListMsg);
                        oldXyzabc = null;
                        newXyzabc = null;

                        /*
                         *  抓取物件
                         */
                        GraspState = 1;
                        Thread GraspControl = new Thread(new ThreadStart(GraspControlThread));
                        GraspControl.Start();
                        Thread.Sleep(200);

                        /*
                         *  往上移動至擷取圖像點
                         */

                        newXyzabc = new Coordinate_XYZABC();
                        oldXyzabc = new Coordinate_XYZABC();
                        newXyzabc.X = float.Parse(X_Value.Text);
                        newXyzabc.Y = float.Parse(Y_Value.Text);
                        newXyzabc.Z = KukaRobotControlObject.Serv.PoseRecognitionSystem_Data.GraspInitial_Position[2];
                        newXyzabc.A = float.Parse(A_Value.Text);
                        newXyzabc.B = float.Parse(B_Value.Text);
                        newXyzabc.C = float.Parse(C_Value.Text);
                        oldXyzabc.X = float.Parse(X_Value.Text);
                        oldXyzabc.Y = float.Parse(Y_Value.Text);
                        oldXyzabc.Z = float.Parse(Z_Value.Text);
                        oldXyzabc.A = float.Parse(A_Value.Text);
                        oldXyzabc.B = float.Parse(B_Value.Text);
                        oldXyzabc.C = float.Parse(C_Value.Text);
                        if (!KukaRobotControlObject.move_XYZABC_SingalMode(newXyzabc, oldXyzabc))
                            myListBox("Error : Xyzabc Out of limited!!", ListMsg);
                        oldXyzabc = null;
                        newXyzabc = null;

                        newXyzabc = new Coordinate_XYZABC();
                        oldXyzabc = new Coordinate_XYZABC();
                        newXyzabc.X = KukaRobotControlObject.Serv.PoseRecognitionSystem_Data.GraspInitial_Position[0];
                        newXyzabc.Y = KukaRobotControlObject.Serv.PoseRecognitionSystem_Data.GraspInitial_Position[1];
                        newXyzabc.Z = float.Parse(Z_Value.Text);
                        newXyzabc.A = float.Parse(A_Value.Text);
                        newXyzabc.B = float.Parse(B_Value.Text);
                        newXyzabc.C = float.Parse(C_Value.Text);
                        oldXyzabc.X = float.Parse(X_Value.Text);
                        oldXyzabc.Y = float.Parse(Y_Value.Text);
                        oldXyzabc.Z = float.Parse(Z_Value.Text);
                        oldXyzabc.A = float.Parse(A_Value.Text);
                        oldXyzabc.B = float.Parse(B_Value.Text);
                        oldXyzabc.C = float.Parse(C_Value.Text);
                        if (!KukaRobotControlObject.move_XYZABC_TogetherMode(newXyzabc, oldXyzabc))
                            myListBox("Error : Xyzabc Out of limited!!", ListMsg);
                        oldXyzabc = null;
                        newXyzabc = null;

                        newXyzabc = new Coordinate_XYZABC();
                        oldXyzabc = new Coordinate_XYZABC();
                        newXyzabc.X = float.Parse(X_Value.Text);
                        newXyzabc.Y = float.Parse(Y_Value.Text);
                        newXyzabc.Z = float.Parse(Z_Value.Text);
                        newXyzabc.A = Start_A;
                        newXyzabc.B = float.Parse(B_Value.Text);
                        newXyzabc.C = float.Parse(C_Value.Text);
                        oldXyzabc.X = float.Parse(X_Value.Text);
                        oldXyzabc.Y = float.Parse(Y_Value.Text);
                        oldXyzabc.Z = float.Parse(Z_Value.Text);
                        oldXyzabc.A = Start_A + KukaRobotControlObject.Serv.PoseRecognitionSystem_Data._A;
                        oldXyzabc.B = float.Parse(B_Value.Text);
                        oldXyzabc.C = float.Parse(C_Value.Text);
                        if (!KukaRobotControlObject.move_XYZABC_RotationMode(newXyzabc, oldXyzabc))
                            myListBox("Error : Xyzabc Out of limited!!", ListMsg);
                        oldXyzabc = null;
                        newXyzabc = null;

                       /* newXyzabc = new Coordinate_XYZABC();
                        oldXyzabc = new Coordinate_XYZABC();
                        newXyzabc.X = float.Parse(X_Value.Text);
                        newXyzabc.Y = float.Parse(Y_Value.Text);
                        newXyzabc.Z = float.Parse(Z_Value.Text);
                        newXyzabc.A = float.Parse(A_Value.Text);
                        newXyzabc.B = KukaRobotControlObject.Serv.PoseRecognitionSystem_Data.CaptureImage_Position[4];
                        newXyzabc.C = float.Parse(C_Value.Text);
                        oldXyzabc.X = float.Parse(X_Value.Text);
                        oldXyzabc.Y = float.Parse(Y_Value.Text);
                        oldXyzabc.Z = float.Parse(Z_Value.Text);
                        oldXyzabc.A = float.Parse(A_Value.Text);
                        oldXyzabc.B = KukaRobotControlObject.Serv.PoseRecognitionSystem_Data.GraspInitial_Position[4];
                        oldXyzabc.C = float.Parse(C_Value.Text);
                        if (!KukaRobotControlObject.move_XYZABC_RotationMode(newXyzabc, oldXyzabc))
                            myListBox("Error : Xyzabc Out of limited!!", ListMsg);
                        oldXyzabc = null;
                        newXyzabc = null;*/


                        /*newXyzabc = new Coordinate_XYZABC();
                        oldXyzabc = new Coordinate_XYZABC();
                        newXyzabc.X = float.Parse(X_Value.Text);
                        newXyzabc.Y = float.Parse(Y_Value.Text);
                        newXyzabc.Z = KukaRobotControlObject.Serv.PoseRecognitionSystem_Data.CaptureImage_Position[2];
                        newXyzabc.A = float.Parse(A_Value.Text);
                        newXyzabc.B = float.Parse(B_Value.Text);
                        newXyzabc.C = float.Parse(C_Value.Text);
                        oldXyzabc.X = float.Parse(X_Value.Text);
                        oldXyzabc.Y = float.Parse(Y_Value.Text);
                        oldXyzabc.Z = float.Parse(Z_Value.Text);
                        oldXyzabc.A = float.Parse(A_Value.Text);
                        oldXyzabc.B = float.Parse(B_Value.Text);
                        oldXyzabc.C = float.Parse(C_Value.Text);
                        if (!KukaRobotControlObject.move_XYZABC_SingalMode(newXyzabc, oldXyzabc))
                            myListBox("Error : Xyzabc Out of limited!!", ListMsg);
                        oldXyzabc = null;
                        newXyzabc = null;/*


                        /*
                         *    請求Server端擷新影像
                         */
                        KukaRobotControlObject.Serv.PoseRecognitionSystem_Data._State = 5;
                        /*while (KukaRobotControlObject.Serv.PoseRecognitionSystem_Data._State == 5)
                        {
                            //Thread.Sleep(50);
                        }*/

                        /*
                         *  放置物件
                         */
                       /* newXyzabc = new Coordinate_XYZABC();
                        oldXyzabc = new Coordinate_XYZABC();
                        newXyzabc.X = float.Parse(X_Value.Text);
                        newXyzabc.Y = float.Parse(Y_Value.Text);
                        newXyzabc.Z = KukaRobotControlObject.Serv.PoseRecognitionSystem_Data.GraspInitial_Position[2];
                        newXyzabc.A = float.Parse(A_Value.Text);
                        newXyzabc.B = float.Parse(B_Value.Text);
                        newXyzabc.C = float.Parse(C_Value.Text);
                        oldXyzabc.X = float.Parse(X_Value.Text);
                        oldXyzabc.Y = float.Parse(Y_Value.Text);
                        oldXyzabc.Z = float.Parse(Z_Value.Text);
                        oldXyzabc.A = float.Parse(A_Value.Text);
                        oldXyzabc.B = float.Parse(B_Value.Text);
                        oldXyzabc.C = float.Parse(C_Value.Text);
                        if (!KukaRobotControlObject.move_XYZABC_SingalMode(newXyzabc, oldXyzabc))
                            myListBox("Error : Xyzabc Out of limited!!", ListMsg);
                        oldXyzabc = null;
                        newXyzabc = null;*/

                        /*newXyzabc = new Coordinate_XYZABC();
                        oldXyzabc = new Coordinate_XYZABC();
                        newXyzabc.X = float.Parse(X_Value.Text);
                        newXyzabc.Y = float.Parse(Y_Value.Text);
                        newXyzabc.Z = float.Parse(Z_Value.Text);
                        newXyzabc.A = float.Parse(A_Value.Text);
                        newXyzabc.B = KukaRobotControlObject.Serv.PoseRecognitionSystem_Data.GraspInitial_Position[4];
                        newXyzabc.C = float.Parse(C_Value.Text);
                        oldXyzabc.X = float.Parse(X_Value.Text);
                        oldXyzabc.Y = float.Parse(Y_Value.Text);
                        oldXyzabc.Z = float.Parse(Z_Value.Text);
                        oldXyzabc.A = float.Parse(A_Value.Text);
                        oldXyzabc.B = KukaRobotControlObject.Serv.PoseRecognitionSystem_Data.CaptureImage_Position[4];
                        oldXyzabc.C = float.Parse(C_Value.Text);
                        if (!KukaRobotControlObject.move_XYZABC_RotationMode(newXyzabc, oldXyzabc))
                            myListBox("Error : Xyzabc Out of limited!!", ListMsg);
                        oldXyzabc = null;
                        newXyzabc = null;*/


                        //newXyzabc = new Coordinate_XYZABC();
                        //oldXyzabc = new Coordinate_XYZABC();
                        //newXyzabc.X = float.Parse(X_Value.Text);
                        //newXyzabc.Y = float.Parse(Y_Value.Text);
                        //newXyzabc.Z = KukaRobotControlObject.Serv.PoseRecognitionSystem_Data.GraspInitial_Position[2];
                        //newXyzabc.A = float.Parse(A_Value.Text);
                        //newXyzabc.B = float.Parse(B_Value.Text);
                        //newXyzabc.C = float.Parse(C_Value.Text);
                        //oldXyzabc.X = float.Parse(X_Value.Text);
                        //oldXyzabc.Y = float.Parse(Y_Value.Text);
                        //oldXyzabc.Z = float.Parse(Z_Value.Text);
                        //oldXyzabc.A = float.Parse(A_Value.Text);
                        //oldXyzabc.B = float.Parse(B_Value.Text);
                        //oldXyzabc.C = float.Parse(C_Value.Text);
                        //if (!KukaRobotControlObject.move_XYZABC_SingalMode(newXyzabc, oldXyzabc))
                        //    myListBox("Error : Xyzabc Out of limited!!", ListMsg);
                        //oldXyzabc = null;
                        //newXyzabc = null;

                        if (GraspObjectType == 0)
                        {
                            newXyzabc = new Coordinate_XYZABC();
                            oldXyzabc = new Coordinate_XYZABC();
                            newXyzabc.X = 600;
                            newXyzabc.Y = -200;
                            newXyzabc.Z = 90;
                            newXyzabc.A = float.Parse(A_Value.Text);
                            newXyzabc.B = float.Parse(B_Value.Text);
                            newXyzabc.C = float.Parse(C_Value.Text);
                            oldXyzabc.X = float.Parse(X_Value.Text);
                            oldXyzabc.Y = float.Parse(Y_Value.Text);
                            oldXyzabc.Z = float.Parse(Z_Value.Text);
                            oldXyzabc.A = float.Parse(A_Value.Text);
                            oldXyzabc.B = float.Parse(B_Value.Text);
                            oldXyzabc.C = float.Parse(C_Value.Text);
                            if (!KukaRobotControlObject.move_XYZABC_TogetherMode(newXyzabc, oldXyzabc))
                                myListBox("Error : Xyzabc Out of limited!!", ListMsg);
                            oldXyzabc = null;
                            newXyzabc = null;
                        }
                        else if (GraspObjectType == 1)
                        {
                            newXyzabc = new Coordinate_XYZABC();
                            oldXyzabc = new Coordinate_XYZABC();
                            newXyzabc.X = 300;
                            newXyzabc.Y = -200;
                            newXyzabc.Z = float.Parse(Z_Value.Text);
                            newXyzabc.A = float.Parse(A_Value.Text);
                            newXyzabc.B = float.Parse(B_Value.Text);
                            newXyzabc.C = float.Parse(C_Value.Text);
                            oldXyzabc.X = float.Parse(X_Value.Text);
                            oldXyzabc.Y = float.Parse(Y_Value.Text);
                            oldXyzabc.Z = float.Parse(Z_Value.Text);
                            oldXyzabc.A = float.Parse(A_Value.Text);
                            oldXyzabc.B = float.Parse(B_Value.Text);
                            oldXyzabc.C = float.Parse(C_Value.Text);
                            if (!KukaRobotControlObject.move_XYZABC_TogetherMode(newXyzabc, oldXyzabc))
                                myListBox("Error : Xyzabc Out of limited!!", ListMsg);
                            oldXyzabc = null;
                            newXyzabc = null;

                            newXyzabc = new Coordinate_XYZABC();
                            oldXyzabc = new Coordinate_XYZABC();
                            newXyzabc.X = float.Parse(X_Value.Text);
                            newXyzabc.Y = float.Parse(Y_Value.Text);
                            newXyzabc.Z = 90;
                            newXyzabc.A = float.Parse(A_Value.Text);
                            newXyzabc.B = float.Parse(B_Value.Text);
                            newXyzabc.C = float.Parse(C_Value.Text);
                            oldXyzabc.X = float.Parse(X_Value.Text);
                            oldXyzabc.Y = float.Parse(Y_Value.Text);
                            oldXyzabc.Z = float.Parse(Z_Value.Text);
                            oldXyzabc.A = float.Parse(A_Value.Text);
                            oldXyzabc.B = float.Parse(B_Value.Text);
                            oldXyzabc.C = float.Parse(C_Value.Text);
                            if (!KukaRobotControlObject.move_XYZABC_SingalMode(newXyzabc, oldXyzabc))
                                myListBox("Error : Xyzabc Out of limited!!", ListMsg);
                            oldXyzabc = null;
                            newXyzabc = null;
                        }
                        else if (GraspObjectType == 2)
                        {
                            newXyzabc = new Coordinate_XYZABC();
                            oldXyzabc = new Coordinate_XYZABC();
                            newXyzabc.X = 450;
                            newXyzabc.Y = -200;
                            newXyzabc.Z = 90;
                            newXyzabc.A = float.Parse(A_Value.Text);
                            newXyzabc.B = float.Parse(B_Value.Text);
                            newXyzabc.C = float.Parse(C_Value.Text);
                            oldXyzabc.X = float.Parse(X_Value.Text);
                            oldXyzabc.Y = float.Parse(Y_Value.Text);
                            oldXyzabc.Z = float.Parse(Z_Value.Text);
                            oldXyzabc.A = float.Parse(A_Value.Text);
                            oldXyzabc.B = float.Parse(B_Value.Text);
                            oldXyzabc.C = float.Parse(C_Value.Text);
                            if (!KukaRobotControlObject.move_XYZABC_TogetherMode(newXyzabc, oldXyzabc))
                                myListBox("Error : Xyzabc Out of limited!!", ListMsg);
                            oldXyzabc = null;
                            newXyzabc = null;
                        }

                       
                        /*newXyzabc = new Coordinate_XYZABC();
                        oldXyzabc = new Coordinate_XYZABC();
                        newXyzabc.X = float.Parse(X_Value.Text);
                        newXyzabc.Y = float.Parse(Y_Value.Text);
                        newXyzabc.Z = 90;
                        newXyzabc.A = float.Parse(A_Value.Text);
                        newXyzabc.B = float.Parse(B_Value.Text);
                        newXyzabc.C = float.Parse(C_Value.Text);
                        oldXyzabc.X = float.Parse(X_Value.Text);
                        oldXyzabc.Y = float.Parse(Y_Value.Text);
                        oldXyzabc.Z = float.Parse(Z_Value.Text);
                        oldXyzabc.A = float.Parse(A_Value.Text);
                        oldXyzabc.B = float.Parse(B_Value.Text);
             
                         * oldXyzabc.C = float.Parse(C_Value.Text);
                        if (!KukaRobotControlObject.move_XYZABC_SingalMode(newXyzabc, oldXyzabc))
                            myListBox("Error : Xyzabc Out of limited!!", ListMsg);
                        oldXyzabc = null;
                        newXyzabc = null;*/

                        Thread.Sleep(100);
                        GraspState = -1;
                        GraspControl = new Thread(new ThreadStart(GraspControlThread));
                        GraspControl.Start();

                        //newXyzabc = new Coordinate_XYZABC();
                        //oldXyzabc = new Coordinate_XYZABC();
                        //newXyzabc.X = float.Parse(X_Value.Text);
                        //newXyzabc.Y = float.Parse(Y_Value.Text);
                        //newXyzabc.Z = KukaRobotControlObject.Serv.PoseRecognitionSystem_Data.GraspInitial_Position[2];
                        //newXyzabc.A = float.Parse(A_Value.Text);
                        //newXyzabc.B = float.Parse(B_Value.Text);
                        //newXyzabc.C = float.Parse(C_Value.Text);
                        //oldXyzabc.X = float.Parse(X_Value.Text);
                        //oldXyzabc.Y = float.Parse(Y_Value.Text);
                        //oldXyzabc.Z = float.Parse(Z_Value.Text);
                        //oldXyzabc.A = float.Parse(A_Value.Text);
                        //oldXyzabc.B = float.Parse(B_Value.Text);
                        //oldXyzabc.C = float.Parse(C_Value.Text);
                        //if (!KukaRobotControlObject.move_XYZABC_SingalMode(newXyzabc, oldXyzabc))
                        //    myListBox("Error : Xyzabc Out of limited!!", ListMsg);
                        //oldXyzabc = null;
                        //newXyzabc = null;

                        newXyzabc = new Coordinate_XYZABC();
                        oldXyzabc = new Coordinate_XYZABC();
                        newXyzabc.X = KukaRobotControlObject.Serv.PoseRecognitionSystem_Data.GraspInitial_Position[0];
                        newXyzabc.Y = KukaRobotControlObject.Serv.PoseRecognitionSystem_Data.GraspInitial_Position[1];
                        newXyzabc.Z = KukaRobotControlObject.Serv.PoseRecognitionSystem_Data.GraspInitial_Position[2];
                        newXyzabc.A = float.Parse(A_Value.Text);
                        newXyzabc.B = float.Parse(B_Value.Text);
                        newXyzabc.C = float.Parse(C_Value.Text);
                        oldXyzabc.X = float.Parse(X_Value.Text);
                        oldXyzabc.Y = float.Parse(Y_Value.Text);
                        oldXyzabc.Z = float.Parse(Z_Value.Text);
                        oldXyzabc.A = float.Parse(A_Value.Text);
                        oldXyzabc.B = float.Parse(B_Value.Text);
                        oldXyzabc.C = float.Parse(C_Value.Text);
                        if (!KukaRobotControlObject.move_XYZABC_TogetherMode(newXyzabc, oldXyzabc))
                            myListBox("Error : Xyzabc Out of limited!!", ListMsg);
                        oldXyzabc = null;
                        newXyzabc = null;

                        IsArmCanMove = true;
                        KukaRobotControlObject.Serv.PoseRecognitionSystem_Data._State = 9;
                        
                    }
                    break;
                }
                default:
                {
                    break;
                }
            }
        }