void ReadInput(XmlElement xeRoot, RobotStdPoint robotStdPoint)
        {
            try
            {
                //真空
                robotStdPoint.P_Vaccum = ReadVaccum(xeRoot);

                //输入IO
                Point4D[] points_Input1 = ReadInputIO(xeRoot, "InputIO1");
                robotStdPoint.P_InputIO1 = points_Input1[0];
                robotStdPoint.P_JumpIOP1 = points_Input1[1];

                Point4D[] points_Input2 = ReadInputIO(xeRoot, "InputIO2");
                robotStdPoint.P_InputIO2 = points_Input2[0];
                robotStdPoint.P_JumpIOP2 = points_Input2[1];

                Point4D[] points_Input3 = ReadInputIO(xeRoot, "InputIO3");
                robotStdPoint.P_InputIO3 = points_Input3[0];
                robotStdPoint.P_JumpIOP3 = points_Input3[1];

                Point4D[] points_Input4 = ReadInputIO(xeRoot, "InputIO4");
                robotStdPoint.P_InputIO4 = points_Input4[0];
                robotStdPoint.P_JumpIOP4 = points_Input4[1];

                //PC
                ReadPC(xeRoot, robotStdPoint);
            }
            catch (Exception ex)
            {
            }
        }
        bool WriteInputIO(XmlElement xeRoot, RobotStdPoint robotStdPoint)
        {
            try
            {
                int numError = 0;
                if (!WriteInputIO(xeRoot, "InputIO1", robotStdPoint.P_InputIO1, robotStdPoint.P_JumpIOP1))
                {
                    numError++;
                }
                if (!WriteInputIO(xeRoot, "InputIO2", robotStdPoint.P_InputIO2, robotStdPoint.P_JumpIOP2))
                {
                    numError++;
                }
                if (!WriteInputIO(xeRoot, "InputIO3", robotStdPoint.P_InputIO2, robotStdPoint.P_JumpIOP3))
                {
                    numError++;
                }
                if (!WriteInputIO(xeRoot, "InputIO4", robotStdPoint.P_InputIO2, robotStdPoint.P_JumpIOP4))
                {
                    numError++;
                }

                if (numError > 0)
                {
                    return(false);
                }
                return(true);
            }
            catch (Exception ex)
            {
                return(false);
            }
        }
        void ReadVel(XmlElement xeRoot, RobotStdPoint robotStdPoint)
        {
            try
            {
                bool enable = ReadChildAttributeBl(xeRoot, "Vel", "Enable");
                robotStdPoint.P_Vel.DblValue1 = enable ? 1 : -1;

                string power = ReadChildAttributeStr(xeRoot, "Vel", "Power", "Low");

                int    vel        = ReadChildAttributeInt(xeRoot, "Vel", "Vel");
                int    acc        = ReadChildAttributeInt(xeRoot, "Vel", "Acc");
                string annotation = ReadChildAttributeStr(xeRoot, "Vel", "Annotation");

                robotStdPoint.P_Vel.NameClass = "Vel";

                if (power == PowerRobot_enum.High.ToString())
                {
                    robotStdPoint.P_Vel.DblValue2 = 2;//高功率
                }
                else
                {
                    robotStdPoint.P_Vel.DblValue2 = 1;//低功率
                }

                robotStdPoint.P_Vel.DblValue3 = vel; //速度
                robotStdPoint.P_Vel.DblValue4 = acc; //加速度
            }
            catch (Exception ex)
            {
            }
        }
        /// <summary>
        /// 写入PC
        /// </summary>
        bool WritePC(XmlElement xeRoot, RobotStdPoint robotStdPoint)
        {
            try
            {
                XmlElement xePC = CreateNewXe(xeRoot, "PC");
                xeRoot.AppendChild(xePC);

                bool enable = robotStdPoint.P_PC.DblValue1 == -1 ? false : true;

                WriteAttribute(xePC, "Enable", enable.ToString());
                WriteAttribute(xePC, "WaitTime", robotStdPoint.P_PC.DblValue2.ToString());
                WriteAttribute(xePC, "NGIO", robotStdPoint.P_PC.DblValue3.ToString());
                WriteAttribute(xePC, "NGPos", robotStdPoint.P_PC.DblValue4.ToString());
                WriteAttribute(xePC, "Annotation", robotStdPoint.P_PC.Annotation.ToString());

                XmlElement xePCCMD = CreateNewXe(xeRoot, "PCCMD");
                xeRoot.AppendChild(xePCCMD);
                WriteAttribute(xePCCMD, "XChange", robotStdPoint.P_PCCMD.DblValue1.ToString());
                WriteAttribute(xePCCMD, "YChange", robotStdPoint.P_PCCMD.DblValue2.ToString());
                WriteAttribute(xePCCMD, "ZChange", robotStdPoint.P_PCCMD.DblValue3.ToString());
                WriteAttribute(xePCCMD, "RChange", robotStdPoint.P_PCCMD.DblValue4.ToString());
                WriteAttribute(xePCCMD, "ArmChange", robotStdPoint.P_PCCMD.DblValue5.ToString());
                return(true);
            }
            catch (Exception ex)
            {
                return(false);
            }
        }
Beispiel #5
0
        public void WriteConfigParStdRobot(object index)
        {
            try
            {
                RobotStdPoint item = RobotStdPoint.R_I.RobotStdPoint_L[(int)index];

                string pos = "Config " + item.NamePoint;
                //写入输入
                if (!WriteInput(pos, item))
                {
                    return;
                }
                //写入运动
                if (!WriteMove(pos, item))
                {
                    return;
                }
                //写入输出
                if (!WriteOut(pos, item))
                {
                    return;
                }
                //写入点位综合
                if (!WritePrint(pos, item))
                {
                    return;
                }
            }
            catch (Exception ex)
            {
                Log.L_I.WriteError("LogicRobot", ex);
            }
        }
        /// <summary>
        /// 写入速度
        /// </summary>
        /// <param name="xeRoot"></param>
        /// <param name="robotStdPoint"></param>
        bool WriteVel(XmlElement xeRoot, RobotStdPoint robotStdPoint)
        {
            try
            {
                Point4D point = robotStdPoint.P_Vel;

                XmlElement xeVel = CreateNewXe(xeRoot, "Vel");
                xeRoot.AppendChild(xeVel);

                bool            enable       = point.DblValue1 == -1 ? false : true;
                PowerRobot_enum powerRobot_e = (PowerRobot_enum)(point.DblValue2 - 1);

                WriteAttribute(xeVel, "Enable", enable.ToString());
                WriteAttribute(xeVel, "Power", powerRobot_e.ToString());

                WriteAttribute(xeVel, "Vel", point.DblValue3.ToString());
                WriteAttribute(xeVel, "Acc", point.DblValue4.ToString());
                WriteAttribute(xeVel, "Annotation", point.Annotation.ToString());
                return(true);
            }
            catch (Exception ex)
            {
                return(false);
            }
        }
        bool WriteMove(XmlElement xeRoot, RobotStdPoint robotStdPoint)
        {
            try
            {
                int numError = 0;
                if (!WriteVel(xeRoot, robotStdPoint))
                {
                    numError++;
                }

                if (!WriteMovePoint(xeRoot, robotStdPoint))
                {
                    numError++;
                }
                if (numError > 0)
                {
                    return(false);
                }
                return(true);
            }
            catch (Exception ex)
            {
                return(false);
            }
        }
        public bool WriteOut(XmlElement xeRoot, RobotStdPoint robotStdPoint)
        {
            try
            {
                int numError = 0;
                if (!WriteOutIO(xeRoot, robotStdPoint))
                {
                    numError++;
                }
                if (!WriteOutPC(xeRoot, robotStdPoint))
                {
                    numError++;
                }
                if (!WriteNextPos(xeRoot, robotStdPoint))
                {
                    numError++;
                }

                if (numError > 0)
                {
                    return(false);
                }
                return(true);
            }
            catch (Exception ex)
            {
                return(false);
            }
        }
        /// <summary>
        /// 输出IO
        /// </summary>
        /// <param name="xeRoot"></param>
        /// <param name="robotStdPoint"></param>
        bool WriteOutIO(XmlElement xeRoot, RobotStdPoint robotStdPoint)
        {
            try
            {
                Point4D p_OutIO = robotStdPoint.P_OutIO;

                XmlElement xeOutIO = CreateNewXe(xeRoot, "OutIO");
                xeRoot.AppendChild(xeOutIO);

                bool enable = p_OutIO.DblValue1 == -1 ? false : true;
                WriteAttribute(xeOutIO, "Enable", enable.ToString());
                WriteAttribute(xeOutIO, "IO", p_OutIO.DblValue2.ToString());
                WriteAttribute(xeOutIO, "WaitTime", p_OutIO.DblValue3.ToString());
                WriteAttribute(xeOutIO, "Annotation", p_OutIO.Annotation.ToString());

                Point4D p_OutVaccum = robotStdPoint.P_OutVaccum;

                XmlElement xOutVaccum = CreateNewXe(xeRoot, "OutVaccum");
                xeRoot.AppendChild(xOutVaccum);

                TypeVaccumRobot_enum typeVaccumRobot_e = (TypeVaccumRobot_enum)(p_OutVaccum.DblValue1 - 1);
                WriteAttribute(xOutVaccum, "Vaccum", typeVaccumRobot_e.ToString());

                TypeBlowRobot_enum typeBlowRobot_e = (TypeBlowRobot_enum)(p_OutVaccum.DblValue2 - 1);
                WriteAttribute(xOutVaccum, "Blow", typeBlowRobot_e.ToString());
                WriteAttribute(xOutVaccum, "WaitTime", p_OutVaccum.DblValue3.ToString());
                WriteAttribute(xOutVaccum, "Annotation", p_OutVaccum.Annotation.ToString());
                return(true);
            }
            catch (Exception ex)
            {
                return(false);
            }
        }
        /// <summary>
        /// 输出PC
        /// </summary>
        /// <param name="xeRoot"></param>
        /// <param name="robotStdPoint"></param>
        bool WriteOutPC(XmlElement xeRoot, RobotStdPoint robotStdPoint)
        {
            try
            {
                Point4D p_OutPC = robotStdPoint.P_OutPC;

                XmlElement xeOutPC = CreateNewXe(xeRoot, "OutPC");
                xeRoot.AppendChild(xeOutPC);

                bool enable = p_OutPC.DblValue1 == 1 ? true : false;
                WriteAttribute(xeOutPC, "Enable", enable.ToString());

                TypeOutPCRobot_enum typeOutPCRobot_e = (TypeOutPCRobot_enum)(p_OutPC.DblValue2 - 1);

                WriteAttribute(xeOutPC, "Type", typeOutPCRobot_e.ToString());
                WriteAttribute(xeOutPC, "CMD", p_OutPC.DblValue3.ToString());
                WriteAttribute(xeOutPC, "NGIO", p_OutPC.DblValue4.ToString());
                WriteAttribute(xeOutPC, "Annotation", p_OutPC.Annotation.ToString());
                return(true);
            }
            catch (Exception ex)
            {
                return(false);
            }
        }
        bool WriteInput(XmlElement xeRoot, RobotStdPoint robotStdPoint)
        {
            try
            {
                int numError = 0;
                if (!WriteVaccum(xeRoot, robotStdPoint))
                {
                    numError++;
                }

                if (!WriteInputIO(xeRoot, robotStdPoint))
                {
                    numError++;
                }
                if (!WritePC(xeRoot, robotStdPoint))
                {
                    numError++;
                }
                if (numError > 0)
                {
                    return(false);
                }
                return(true);
            }
            catch (Exception ex)
            {
                return(false);
            }
        }
        void ReadMove(XmlElement xeRoot, RobotStdPoint robotStdPoint)
        {
            try
            {
                ReadVel(xeRoot, robotStdPoint);

                ReadMovePos(xeRoot, robotStdPoint);
            }
            catch (Exception ex)
            {
            }
        }
 //点位注释
 bool WriteAnnotation(XmlElement xeRoot, RobotStdPoint robotStdPoint)
 {
     try
     {
         WriteAttribute(xeRoot, "Annotation", robotStdPoint.Annotation);
         return(true);
     }
     catch (Exception ex)
     {
         return(false);
     }
 }
 //点位注释
 bool ReadAnnotation(XmlElement xeRoot, RobotStdPoint robotStdPoint)
 {
     try
     {
         robotStdPoint.Annotation = ReadAttributeStr(xeRoot, "Annotation");
         return(true);
     }
     catch (Exception ex)
     {
         return(false);
     }
 }
        bool ReadNextPos(XmlElement xeRoot, RobotStdPoint robotStdPoint)
        {
            try
            {
                robotStdPoint.P_NextPoint.DblValue1 = ReadChildAttributeInt(xeRoot, "NextPos", "No");
                robotStdPoint.P_NextPoint.NameClass = "NextPos";

                return(true);
            }
            catch (Exception ex)
            {
                return(false);
            }
        }
Beispiel #16
0
 /// <summary>
 /// 插入点位
 /// </summary>
 public void AddPoint(int index)
 {
     try
     {
         RobotStdPoint robotStdPoint = (RobotStdPoint)RobotStdPoint_L[index].Clone();
         robotStdPoint.NamePoint = "pos" + index.ToString();
         RobotStdPoint_L.Add(robotStdPoint);
         NumPoint = Count - 1;
         ReSortPoint();
     }
     catch (Exception ex)
     {
     }
 }
        void ReadOut(XmlElement xeRoot, RobotStdPoint robotStdPoint)
        {
            try
            {
                XmlElement xeOut = ReadNode(xeRoot, "Out");

                robotStdPoint.P_OutIO     = ReadOutIO(xeRoot);
                robotStdPoint.P_OutVaccum = ReadOutVaccum(xeRoot);
                robotStdPoint.P_OutPC     = ReadOutPC(xeRoot);
            }
            catch (Exception ex)
            {
            }
        }
        public void ReadXml()
        {
            try
            {
                XmlDocument xDoc   = LoadXml(PathRobotStd);
                XmlElement  xeRoot = null;
                if (xDoc != null)
                {
                    xeRoot = ReadNode(xDoc, "StdPoints");
                }

                RobotStdPoint robotStdPointHome = new RobotStdPoint();
                robotStdPointHome.NamePoint = "home";
                RobotStdPoint_L.Add(robotStdPointHome);
                if (xeRoot == null)
                {
                    return;
                }

                XmlElement xeHome = ReadNode(xeRoot, "home");
                ReadInput(xeHome, robotStdPointHome);
                ReadMove(xeHome, robotStdPointHome);
                ReadOut(xeHome, robotStdPointHome);


                NumPoint = ReadAttributeInt(xeRoot, "Num", 0);
                for (int i = 0; i < NumPoint; i++)
                {
                    RobotStdPoint robotStdPoint = new RobotStdPoint();

                    robotStdPoint.No        = i + 1;
                    robotStdPoint.NamePoint = "pos" + i.ToString();

                    XmlElement xePos = ReadNode(xeRoot, "pos" + i.ToString());

                    ReadInput(xePos, robotStdPoint);   //读取输入
                    ReadMove(xePos, robotStdPoint);    //读取运动
                    ReadOut(xePos, robotStdPoint);     //读取输出
                    ReadNextPos(xePos, robotStdPoint); //下一个带点
                    ReadAnnotation(xePos, robotStdPoint);
                    RobotStdPoint_L.Add(robotStdPoint);
                }
                //打印输出
                ReadPrint(xeRoot);
            }
            catch (Exception ex)
            {
            }
        }
        /// <summary>
        /// NextPos
        /// </summary>
        /// <param name="xeRoot"></param>
        /// <param name="robotStdPoint"></param>
        bool WriteNextPos(XmlElement xeRoot, RobotStdPoint robotStdPoint)
        {
            try
            {
                XmlElement xeNextPos = CreateNewXe(xeRoot, "NextPos");
                xeRoot.AppendChild(xeNextPos);

                WriteAttribute(xeNextPos, "No", robotStdPoint.P_NextPoint.DblValue1.ToString());
                return(true);
            }
            catch (Exception ex)
            {
                return(false);
            }
        }
Beispiel #20
0
        /// <summary>
        /// 在点位最后增加一个点位
        /// </summary>
        public void AddPoint()
        {
            try
            {
                RobotStdPoint robotStdPoint = (RobotStdPoint)RobotStdPoint_L[Count - 1].Clone();
                robotStdPoint.NamePoint = "pos" + (Count - 1).ToString();
                robotStdPoint.No        = Count;
                RobotStdPoint_L.Add(robotStdPoint);
                NumPoint = Count - 1;

                ReSortPoint();
            }
            catch (Exception ex)
            {
            }
        }
        /// <summary>
        /// 读取PC
        /// </summary>
        /// <param name="xeRoot"></param>
        /// <param name="robotStdPoint"></param>
        void ReadPC(XmlElement xeRoot, RobotStdPoint robotStdPoint)
        {
            try
            {
                //PC
                XmlElement xePC = ReadNode(xeRoot, "PC");

                bool enable_PC   = ReadAttributeBl(xePC, "Enable");
                int  waitTime_PC = ReadAttributeInt(xePC, "WaitTime");
                int  nGIO_PC     = ReadAttributeInt(xePC, "NGIO");

                int    nGPos_PC      = ReadAttributeInt(xePC, "NGPos");
                string annotation_PC = ReadAttributeStr(xePC, "Annotation");

                if (enable_PC)
                {
                    robotStdPoint.P_PC.DblValue1 = 1;
                }
                else
                {
                    robotStdPoint.P_PC.DblValue1 = -1;
                }
                robotStdPoint.P_PC.DblValue2 = waitTime_PC;
                robotStdPoint.P_PC.DblValue3 = nGIO_PC;
                robotStdPoint.P_PC.DblValue4 = nGPos_PC;

                robotStdPoint.P_PC.Annotation = annotation_PC;

                //PCCMD
                XmlElement xePCCMD = ReadNode(xeRoot, "PCCMD");

                robotStdPoint.P_PCCMD.DblValue1 = ReadAttributeInt(xePCCMD, "XChange");
                robotStdPoint.P_PCCMD.DblValue2 = ReadAttributeInt(xePCCMD, "YChange");
                robotStdPoint.P_PCCMD.DblValue3 = ReadAttributeInt(xePCCMD, "ZChange");
                robotStdPoint.P_PCCMD.DblValue4 = ReadAttributeInt(xePCCMD, "RChange");
                robotStdPoint.P_PCCMD.DblValue5 = ReadAttributeInt(xePCCMD, "ArmChange");
                string annotation_PCCMD = ReadAttributeStr(xePCCMD, "Annotation");


                robotStdPoint.P_PCCMD.Annotation = annotation_PCCMD;
            }
            catch (Exception ex)
            {
            }
        }
        /// <summary>
        /// 写入点位
        /// </summary>
        /// <param name="xeRoot"></param>
        /// <param name="robotStdPoint"></param>
        bool WriteMovePoint(XmlElement xeRoot, RobotStdPoint robotStdPoint)
        {
            try
            {
                Point4D p_Move = robotStdPoint.P_Move;

                //vel
                XmlElement xeMove = CreateNewXe(xeRoot, "Move");
                xeRoot.AppendChild(xeMove);

                MoveRobot_enum moveRobot_e = MoveRobot_enum.Stay;
                moveRobot_e = (MoveRobot_enum)p_Move.DblValue1 - 1;
                WriteAttribute(xeMove, "Type", moveRobot_e.ToString());

                //passCMD
                Point4D p_passCMD = robotStdPoint.P_PassCMD;

                XmlElement xePassCMD = CreateNewXe(xeRoot, "PassCMD");
                xeRoot.AppendChild(xePassCMD);

                WriteAttribute(xePassCMD, "Num", p_passCMD.DblValue1.ToString());

                TypePosRobot_enum typeZ_e = (TypePosRobot_enum)p_passCMD.DblValue2 - 1;
                WriteAttribute(xePassCMD, "Z", typeZ_e.ToString());
                TypePosRobot_enum typeR_e = (TypePosRobot_enum)p_passCMD.DblValue3 - 1;
                WriteAttribute(xePassCMD, "R", typeR_e.ToString());

                WriteMovePoint(xeRoot, "Here", robotStdPoint.P_Here);
                WriteMovePoint(xeRoot, "Pass1", robotStdPoint.P_Pass1);
                WriteMovePoint(xeRoot, "Pass2", robotStdPoint.P_Pass2);
                WriteMovePoint(xeRoot, "Pass3", robotStdPoint.P_Pass3);

                //des
                WriteMovePoint(xeRoot, "Des", robotStdPoint.P_Des);

                return(true);
            }
            catch (Exception ex)
            {
                return(false);
            }
        }
        void ReadMovePos(XmlElement xeRoot, RobotStdPoint robotStdPoint)
        {
            try
            {
                string         typeMove    = ReadChildAttributeStr(xeRoot, "Move", "Type", "Stay");
                MoveRobot_enum moveRobot_e = (MoveRobot_enum)Enum.Parse(typeof(MoveRobot_enum), typeMove);
                robotStdPoint.P_Move.DblValue1 = (int)moveRobot_e + 1;

                robotStdPoint.P_PassCMD.DblValue1 = ReadChildAttributeInt(xeRoot, "PassCMD", "Num", 0);
                string typeZ = ReadChildAttributeStr(xeRoot, "PassCMD", "Z", "Relative");
                if (typeZ == TypePosRobot_enum.Relative.ToString())
                {
                    robotStdPoint.P_PassCMD.DblValue2 = 1;
                }
                else
                {
                    robotStdPoint.P_PassCMD.DblValue2 = 2;
                }

                string typeR = ReadChildAttributeStr(xeRoot, "PassCMD", "R", "Relative");
                if (typeR == TypePosRobot_enum.Relative.ToString())
                {
                    robotStdPoint.P_PassCMD.DblValue3 = 1;
                }
                else
                {
                    robotStdPoint.P_PassCMD.DblValue3 = 2;
                }

                robotStdPoint.P_Des  = ReadMovePos(xeRoot, "Des");
                robotStdPoint.P_Here = ReadMovePos(xeRoot, "Here");

                robotStdPoint.P_Pass1 = ReadMovePos(xeRoot, "Pass1");
                robotStdPoint.P_Pass2 = ReadMovePos(xeRoot, "Pass2");
                robotStdPoint.P_Pass3 = ReadMovePos(xeRoot, "Pass3");
            }
            catch (Exception ex)
            {
            }
        }
Beispiel #24
0
 public bool WritePrint(string name, RobotStdPoint robotStdPoint)
 {
     try
     {
         string print = name + " print" + " "
                        + robotStdPoint.P_Print.DblValue1.ToString().PadLeft(7, ' ') + " "
                        + robotStdPoint.P_Print.DblValue2.ToString().PadLeft(7, ' ') + " "
                        + robotStdPoint.P_Print.DblValue3.ToString().PadLeft(7, ' ') + " "
                        + robotStdPoint.P_Print.DblValue4.ToString().PadLeft(7, ' ');
         WriteRobot(print);
         if (!WaitForOK())
         {
             ConfigRobot_event(string.Format("PC向机器人发送参数{0}失败!", print), false);
             return(false);
         }
         ConfigRobot_event(string.Format("PC向机器人发送参数{0}成功!", print), true);
         return(true);
     }
     catch (Exception ex)
     {
         return(false);
     }
 }
        /// <summary>
        /// 真空
        /// </summary>
        /// <param name="xeRoot"></param>
        /// <param name="point"></param>
        bool WriteVaccum(XmlElement xeRoot, RobotStdPoint robotStdPoint)
        {
            try
            {
                XmlElement xeVaccum = CreateNewXe(xeRoot, "Vaccum");
                xeRoot.AppendChild(xeVaccum);

                Point4D point  = robotStdPoint.P_Vaccum;
                bool    enable = point.DblValue1 == -1 ? false : true;

                WriteAttribute(xeVaccum, "Enable", enable.ToString());
                WriteAttribute(xeVaccum, "NoIO", point.DblValue1.ToString());
                WriteAttribute(xeVaccum, "WaitTime", point.DblValue2.ToString());
                WriteAttribute(xeVaccum, "NGIO", point.DblValue3.ToString());
                WriteAttribute(xeVaccum, "NGPos", point.DblValue4.ToString());
                WriteAttribute(xeVaccum, "Annotation", point.Annotation.ToString());
                return(true);
            }
            catch (Exception ex)
            {
                return(false);
            }
        }
        void Init_Pos()
        {
            try
            {
                AllRobotPointValue.A_I.AllRobotPointValue_L.Clear();
                for (int i = 0; i < RobotStdPoint.R_I.Count; i++)
                {
                    RobotStdPoint robotStdPoint = RobotStdPoint.R_I[i];

                    #region 输入
                    //vaccum
                    AllRobotPointValue.A_I.AllRobotPointValue_L.Add(new AllRobotPointValue()
                    {
                        No        = i,
                        NamePoint = robotStdPoint.NamePoint,
                        NameValue = robotStdPoint.P_Vaccum.NameClass,
                        X         = robotStdPoint.P_Vaccum.DblValue1,
                        Y         = robotStdPoint.P_Vaccum.DblValue2,
                        Z         = robotStdPoint.P_Vaccum.DblValue3,
                        R         = robotStdPoint.P_Vaccum.DblValue4,

                        XInfo = "使能|真空IO序号",
                        YInfo = "等待时间",
                        ZInfo = "NG报警IO",
                        RInfo = "NG跳转点位",
                    });

                    //P_InputIO1
                    AllRobotPointValue.A_I.AllRobotPointValue_L.Add(new AllRobotPointValue()
                    {
                        No        = i,
                        NamePoint = robotStdPoint.NamePoint,
                        NameValue = robotStdPoint.P_InputIO1.NameClass,
                        X         = robotStdPoint.P_InputIO1.DblValue1,
                        Y         = robotStdPoint.P_InputIO1.DblValue2,
                        Z         = robotStdPoint.P_InputIO1.DblValue3,
                        R         = robotStdPoint.P_InputIO1.DblValue4,

                        XInfo = "使能",
                        YInfo = "IO序号",
                        ZInfo = "等待时间",
                        RInfo = "NG报警IO",
                    });

                    //P_JumpInputIO1
                    AllRobotPointValue.A_I.AllRobotPointValue_L.Add(new AllRobotPointValue()
                    {
                        No        = i,
                        NamePoint = robotStdPoint.NamePoint,
                        NameValue = robotStdPoint.P_JumpIOP1.NameClass,
                        X         = robotStdPoint.P_JumpIOP1.DblValue1,
                        Y         = robotStdPoint.P_JumpIOP1.DblValue2,
                        Z         = robotStdPoint.P_JumpIOP1.DblValue3,
                        R         = robotStdPoint.P_JumpIOP1.DblValue4,

                        XInfo = "OK跳转点位",
                        YInfo = "NG跳转点位",
                    });

                    //P_InputIO2
                    AllRobotPointValue.A_I.AllRobotPointValue_L.Add(new AllRobotPointValue()
                    {
                        No        = i,
                        NamePoint = robotStdPoint.NamePoint,
                        NameValue = robotStdPoint.P_InputIO2.NameClass,
                        X         = robotStdPoint.P_InputIO2.DblValue1,
                        Y         = robotStdPoint.P_InputIO2.DblValue2,
                        Z         = robotStdPoint.P_InputIO2.DblValue3,
                        R         = robotStdPoint.P_InputIO2.DblValue4,

                        XInfo = "使能",
                        YInfo = "IO序号",
                        ZInfo = "等待时间",
                        RInfo = "NG报警IO",
                    });

                    //P_JumpInputIO2
                    AllRobotPointValue.A_I.AllRobotPointValue_L.Add(new AllRobotPointValue()
                    {
                        No        = i,
                        NamePoint = robotStdPoint.NamePoint,
                        NameValue = robotStdPoint.P_JumpIOP2.NameClass,
                        X         = robotStdPoint.P_JumpIOP2.DblValue1,
                        Y         = robotStdPoint.P_JumpIOP2.DblValue2,
                        Z         = robotStdPoint.P_JumpIOP2.DblValue3,
                        R         = robotStdPoint.P_JumpIOP2.DblValue4,

                        XInfo = "OK跳转点位",
                        YInfo = "NG跳转点位",
                    });


                    //P_InputIO3
                    AllRobotPointValue.A_I.AllRobotPointValue_L.Add(new AllRobotPointValue()
                    {
                        No        = i,
                        NamePoint = robotStdPoint.NamePoint,
                        NameValue = robotStdPoint.P_InputIO3.NameClass,
                        X         = robotStdPoint.P_InputIO3.DblValue1,
                        Y         = robotStdPoint.P_InputIO3.DblValue2,
                        Z         = robotStdPoint.P_InputIO3.DblValue3,
                        R         = robotStdPoint.P_InputIO3.DblValue4,

                        XInfo = "使能",
                        YInfo = "IO序号",
                        ZInfo = "等待时间",
                        RInfo = "NG报警IO",
                    });
                    //P_JumpInputIO3
                    AllRobotPointValue.A_I.AllRobotPointValue_L.Add(new AllRobotPointValue()
                    {
                        No        = i,
                        NamePoint = robotStdPoint.NamePoint,
                        NameValue = robotStdPoint.P_JumpIOP3.NameClass,
                        X         = robotStdPoint.P_JumpIOP3.DblValue1,
                        Y         = robotStdPoint.P_JumpIOP3.DblValue2,
                        Z         = robotStdPoint.P_JumpIOP3.DblValue3,
                        R         = robotStdPoint.P_JumpIOP3.DblValue4,

                        XInfo = "OK跳转点位",
                        YInfo = "NG跳转点位",
                    });
                    //P_InputIO4
                    AllRobotPointValue.A_I.AllRobotPointValue_L.Add(new AllRobotPointValue()
                    {
                        No        = i,
                        NamePoint = robotStdPoint.NamePoint,
                        NameValue = robotStdPoint.P_InputIO4.NameClass,
                        X         = robotStdPoint.P_InputIO4.DblValue1,
                        Y         = robotStdPoint.P_InputIO4.DblValue2,
                        Z         = robotStdPoint.P_InputIO4.DblValue3,
                        R         = robotStdPoint.P_InputIO4.DblValue4,

                        XInfo = "使能",
                        YInfo = "IO序号",
                        ZInfo = "等待时间",
                        RInfo = "NG报警IO",
                    });
                    //P_JumpInputIO4
                    AllRobotPointValue.A_I.AllRobotPointValue_L.Add(new AllRobotPointValue()
                    {
                        No        = i,
                        NamePoint = robotStdPoint.NamePoint,
                        NameValue = robotStdPoint.P_JumpIOP4.NameClass,
                        X         = robotStdPoint.P_JumpIOP4.DblValue1,
                        Y         = robotStdPoint.P_JumpIOP4.DblValue2,
                        Z         = robotStdPoint.P_JumpIOP4.DblValue3,
                        R         = robotStdPoint.P_JumpIOP4.DblValue4,

                        XInfo = "OK跳转点位",
                        YInfo = "NG跳转点位",
                    });

                    //P_PC
                    AllRobotPointValue.A_I.AllRobotPointValue_L.Add(new AllRobotPointValue()
                    {
                        No        = i,
                        NamePoint = robotStdPoint.NamePoint,
                        NameValue = robotStdPoint.P_PC.NameClass,
                        X         = robotStdPoint.P_PC.DblValue1,
                        Y         = robotStdPoint.P_PC.DblValue2,
                        Z         = robotStdPoint.P_PC.DblValue3,
                        R         = robotStdPoint.P_PC.DblValue4,

                        XInfo = "使能",
                        YInfo = "等待时间",
                        ZInfo = "NG报警IO",
                        RInfo = "NG跳转点位",
                    });

                    //P_PCCMD
                    AllRobotPointValue.A_I.AllRobotPointValue_L.Add(new AllRobotPointValue()
                    {
                        No        = i,
                        NamePoint = robotStdPoint.NamePoint,
                        NameValue = robotStdPoint.P_PCCMD.NameClass,
                        X         = robotStdPoint.P_PCCMD.DblValue1,
                        Y         = robotStdPoint.P_PCCMD.DblValue2,
                        Z         = robotStdPoint.P_PCCMD.DblValue3,
                        R         = robotStdPoint.P_PCCMD.DblValue4,

                        XInfo = "更改X坐标",
                        YInfo = "更改Y坐标",
                        ZInfo = "更改Z坐标",
                        RInfo = "更改R坐标",
                    });
                    #endregion 输入

                    #region 运动
                    //P_Vel
                    AllRobotPointValue.A_I.AllRobotPointValue_L.Add(new AllRobotPointValue()
                    {
                        No        = i,
                        NamePoint = robotStdPoint.NamePoint,
                        NameValue = robotStdPoint.P_Vel.NameClass,
                        X         = robotStdPoint.P_Vel.DblValue1,
                        Y         = robotStdPoint.P_Vel.DblValue2,
                        Z         = robotStdPoint.P_Vel.DblValue3,
                        R         = robotStdPoint.P_Vel.DblValue4,

                        XInfo = "使能",
                        YInfo = "功率",
                        ZInfo = "速度",
                        RInfo = "加减速",
                    });

                    //P_Move
                    AllRobotPointValue.A_I.AllRobotPointValue_L.Add(new AllRobotPointValue()
                    {
                        No        = i,
                        NamePoint = robotStdPoint.NamePoint,
                        NameValue = robotStdPoint.P_Move.NameClass,
                        X         = robotStdPoint.P_Move.DblValue1,
                        Y         = robotStdPoint.P_Move.DblValue2,
                        Z         = robotStdPoint.P_Move.DblValue3,
                        R         = robotStdPoint.P_Move.DblValue4,

                        XInfo = "运动指令",
                    });

                    //P_Des
                    AllRobotPointValue.A_I.AllRobotPointValue_L.Add(new AllRobotPointValue()
                    {
                        No        = i,
                        NamePoint = robotStdPoint.NamePoint,
                        NameValue = robotStdPoint.P_Des.NameClass,
                        X         = robotStdPoint.P_Des.DblValue1,
                        Y         = robotStdPoint.P_Des.DblValue2,
                        Z         = robotStdPoint.P_Des.DblValue3,
                        R         = robotStdPoint.P_Des.DblValue4,

                        XInfo   = "X坐标",
                        YInfo   = "Y坐标",
                        ZInfo   = "Z坐标",
                        RInfo   = "R坐标",
                        ArmInfo = "手系(1Left,2Right)",
                    });

                    //P_Here
                    AllRobotPointValue.A_I.AllRobotPointValue_L.Add(new AllRobotPointValue()
                    {
                        No        = i,
                        NamePoint = robotStdPoint.NamePoint,
                        NameValue = robotStdPoint.P_Here.NameClass,
                        X         = robotStdPoint.P_Here.DblValue1,
                        Y         = robotStdPoint.P_Here.DblValue2,
                        Z         = robotStdPoint.P_Here.DblValue3,
                        R         = robotStdPoint.P_Here.DblValue4,

                        XInfo = "X坐标(相对)",
                        YInfo = "Y坐标(相对)",
                        ZInfo = "Z坐标",
                        RInfo = "R坐标",
                    });

                    //P_PassCMD
                    AllRobotPointValue.A_I.AllRobotPointValue_L.Add(new AllRobotPointValue()
                    {
                        No        = i,
                        NamePoint = robotStdPoint.NamePoint,
                        NameValue = robotStdPoint.P_PassCMD.NameClass,
                        X         = robotStdPoint.P_PassCMD.DblValue1,
                        Y         = robotStdPoint.P_PassCMD.DblValue2,
                        Z         = robotStdPoint.P_PassCMD.DblValue3,
                        R         = robotStdPoint.P_PassCMD.DblValue4,

                        XInfo = "Pass点个数",
                        YInfo = "HereZ坐标相对或者绝对",
                        ZInfo = "HereR坐标相对或者绝对",
                    });


                    //P_Pass1
                    AllRobotPointValue.A_I.AllRobotPointValue_L.Add(new AllRobotPointValue()
                    {
                        No        = i,
                        NamePoint = robotStdPoint.NamePoint,
                        NameValue = robotStdPoint.P_Pass1.NameClass,
                        X         = robotStdPoint.P_Pass1.DblValue1,
                        Y         = robotStdPoint.P_Pass1.DblValue2,
                        Z         = robotStdPoint.P_Pass1.DblValue3,
                        R         = robotStdPoint.P_Pass1.DblValue4,

                        XInfo   = "X坐标",
                        YInfo   = "Y坐标",
                        ZInfo   = "Z坐标",
                        RInfo   = "R坐标",
                        ArmInfo = "手系(1Left,2Right)",
                    });
                    //P_Pass2
                    AllRobotPointValue.A_I.AllRobotPointValue_L.Add(new AllRobotPointValue()
                    {
                        No        = i,
                        NamePoint = robotStdPoint.NamePoint,
                        NameValue = robotStdPoint.P_Pass2.NameClass,
                        X         = robotStdPoint.P_Pass2.DblValue1,
                        Y         = robotStdPoint.P_Pass2.DblValue2,
                        Z         = robotStdPoint.P_Pass2.DblValue3,
                        R         = robotStdPoint.P_Pass2.DblValue4,

                        XInfo   = "X坐标",
                        YInfo   = "Y坐标",
                        ZInfo   = "Z坐标",
                        RInfo   = "R坐标",
                        ArmInfo = "手系(1Left,2Right)",
                    });
                    //P_Pass3
                    AllRobotPointValue.A_I.AllRobotPointValue_L.Add(new AllRobotPointValue()
                    {
                        No        = i,
                        NamePoint = robotStdPoint.NamePoint,
                        NameValue = robotStdPoint.P_Pass3.NameClass,
                        X         = robotStdPoint.P_Pass3.DblValue1,
                        Y         = robotStdPoint.P_Pass3.DblValue2,
                        Z         = robotStdPoint.P_Pass3.DblValue3,
                        R         = robotStdPoint.P_Pass3.DblValue4,

                        XInfo   = "X坐标",
                        YInfo   = "Y坐标",
                        ZInfo   = "Z坐标",
                        RInfo   = "R坐标",
                        ArmInfo = "手系(1Left,2Right)",
                    });

                    #endregion 运动

                    #region 输出
                    //P_OutIO
                    AllRobotPointValue.A_I.AllRobotPointValue_L.Add(new AllRobotPointValue()
                    {
                        No        = i,
                        NamePoint = robotStdPoint.NamePoint,
                        NameValue = robotStdPoint.P_OutIO.NameClass,
                        X         = robotStdPoint.P_OutIO.DblValue1,
                        Y         = robotStdPoint.P_OutIO.DblValue2,
                        Z         = robotStdPoint.P_OutIO.DblValue3,
                        R         = robotStdPoint.P_OutIO.DblValue4,

                        XInfo = "使能|序号",
                    });

                    //P_OutVaccum
                    AllRobotPointValue.A_I.AllRobotPointValue_L.Add(new AllRobotPointValue()
                    {
                        No        = i,
                        NamePoint = robotStdPoint.NamePoint,
                        NameValue = robotStdPoint.P_OutVaccum.NameClass,
                        X         = robotStdPoint.P_OutVaccum.DblValue1,
                        Y         = robotStdPoint.P_OutVaccum.DblValue2,
                        Z         = robotStdPoint.P_OutVaccum.DblValue3,
                        R         = robotStdPoint.P_OutVaccum.DblValue4,

                        XInfo = "真空IO(不操作,关闭,打开)",
                        YInfo = "吹气IO(不操作,关闭,吹气并关闭,吹气)",
                        ZInfo = "吹气延迟",
                    });

                    //P_OutPC
                    AllRobotPointValue.A_I.AllRobotPointValue_L.Add(new AllRobotPointValue()
                    {
                        No        = i,
                        NamePoint = robotStdPoint.NamePoint,
                        NameValue = robotStdPoint.P_OutPC.NameClass,
                        X         = robotStdPoint.P_OutPC.DblValue1,
                        Y         = robotStdPoint.P_OutPC.DblValue2,
                        Z         = robotStdPoint.P_OutPC.DblValue3,
                        R         = robotStdPoint.P_OutPC.DblValue4,

                        XInfo = "使能",
                        YInfo = "指令类型",
                        ZInfo = "指令值",
                    });

                    //P_NextPoint
                    AllRobotPointValue.A_I.AllRobotPointValue_L.Add(new AllRobotPointValue()
                    {
                        No        = i,
                        NamePoint = robotStdPoint.NamePoint,
                        NameValue = robotStdPoint.P_NextPoint.NameClass,
                        X         = robotStdPoint.P_NextPoint.DblValue1,
                        Y         = robotStdPoint.P_NextPoint.DblValue2,
                        Z         = robotStdPoint.P_NextPoint.DblValue3,
                        R         = robotStdPoint.P_NextPoint.DblValue4,

                        XInfo = "跳转点位",
                    });

                    #endregion 输出
                }
            }
            catch (Exception ex)
            {
            }
        }
Beispiel #27
0
        public bool WriteInput(string name, RobotStdPoint robotStdPoint)
        {
            try
            {
                int waitV = (int)robotStdPoint.P_Vaccum.DblValue2;
                if (waitV == -1)
                {
                    waitV = int.MaxValue;
                }

                string vaccum = name + " vaccum" + " "
                                + robotStdPoint.P_Vaccum.DblValue1.ToString().PadLeft(7, ' ') + " "
                                + waitV.ToString().PadLeft(7, ' ') + " "
                                + robotStdPoint.P_Vaccum.DblValue3.ToString().PadLeft(7, ' ') + " "
                                + robotStdPoint.P_Vaccum.DblValue4.ToString().PadLeft(7, ' ');
                WriteRobot(vaccum);

                if (!WaitForOK())
                {
                    ConfigRobot_event(string.Format("PC向机器人发送参数{0}失败!", vaccum), false);
                    return(false);
                }
                ConfigRobot_event(string.Format("PC向机器人发送参数{0}成功!", vaccum), true);


                #region InputIO
                int waitIO1 = (int)robotStdPoint.P_InputIO1.DblValue3;
                if (waitIO1 == -1)
                {
                    waitIO1 = int.MaxValue;
                }
                string inputIO1 = name + " inputIO1" + " "
                                  + robotStdPoint.P_InputIO1.DblValue1.ToString().PadLeft(7, ' ') + " "
                                  + robotStdPoint.P_InputIO1.DblValue2.ToString().PadLeft(7, ' ') + " "
                                  + waitIO1.ToString().PadLeft(7, ' ') + " "
                                  + robotStdPoint.P_InputIO1.DblValue4.ToString().PadLeft(7, ' ');
                WriteRobot(inputIO1);

                if (!WaitForOK())
                {
                    ConfigRobot_event(string.Format("PC向机器人发送参数{0}失败!", inputIO1), false);
                    return(false);
                }
                ConfigRobot_event(string.Format("PC向机器人发送参数{0}成功!", inputIO1), true);


                string jumpInputIO1 = name + " jumpIOP1" + " "
                                      + robotStdPoint.P_JumpIOP1.DblValue1.ToString().PadLeft(7, ' ') + " "
                                      + robotStdPoint.P_JumpIOP1.DblValue2.ToString().PadLeft(7, ' ') + " "
                                      + robotStdPoint.P_JumpIOP1.DblValue3.ToString().PadLeft(7, ' ') + " "
                                      + robotStdPoint.P_JumpIOP1.DblValue4.ToString().PadLeft(7, ' ');
                WriteRobot(jumpInputIO1);

                if (!WaitForOK())
                {
                    ConfigRobot_event(string.Format("PC向机器人发送参数{0}失败!", jumpInputIO1), false);
                    return(false);
                }
                ConfigRobot_event(string.Format("PC向机器人发送参数{0}成功!", jumpInputIO1), true);


                int waitIO2 = (int)robotStdPoint.P_InputIO2.DblValue3;
                if (waitIO2 == -1)
                {
                    waitIO2 = int.MaxValue;
                }
                string inputIO2 = name + " inputIO2" + " "
                                  + robotStdPoint.P_InputIO2.DblValue1.ToString().PadLeft(7, ' ') + " "
                                  + robotStdPoint.P_InputIO2.DblValue2.ToString().PadLeft(7, ' ') + " "
                                  + waitIO2.ToString().PadLeft(7, ' ') + " "
                                  + robotStdPoint.P_InputIO2.DblValue4.ToString().PadLeft(7, ' ');
                WriteRobot(inputIO2);

                if (!WaitForOK())
                {
                    ConfigRobot_event(string.Format("PC向机器人发送参数{0}失败!", inputIO2), false);
                    return(false);
                }
                ConfigRobot_event(string.Format("PC向机器人发送参数{0}成功!", inputIO2), true);

                string jumpInputIO2 = name + " jumpIOP2" + " "
                                      + robotStdPoint.P_JumpIOP2.DblValue1.ToString().PadLeft(7, ' ') + " "
                                      + robotStdPoint.P_JumpIOP2.DblValue2.ToString().PadLeft(7, ' ') + " "
                                      + robotStdPoint.P_JumpIOP2.DblValue3.ToString().PadLeft(7, ' ') + " "
                                      + robotStdPoint.P_JumpIOP2.DblValue4.ToString().PadLeft(7, ' ');
                WriteRobot(jumpInputIO2);

                if (!WaitForOK())
                {
                    ConfigRobot_event(string.Format("PC向机器人发送参数{0}失败!", jumpInputIO2), false);
                    return(false);
                }
                ConfigRobot_event(string.Format("PC向机器人发送参数{0}成功!", jumpInputIO2), true);


                int waitIO3 = (int)robotStdPoint.P_InputIO3.DblValue3;
                if (waitIO3 == -1)
                {
                    waitIO3 = int.MaxValue;
                }
                string inputIO3 = name + " inputIO3" + " "
                                  + robotStdPoint.P_InputIO3.DblValue1.ToString().PadLeft(7, ' ') + " "
                                  + robotStdPoint.P_InputIO3.DblValue2.ToString().PadLeft(7, ' ') + " "
                                  + waitIO3.ToString().PadLeft(7, ' ') + " "
                                  + robotStdPoint.P_InputIO3.DblValue4.ToString().PadLeft(7, ' ');
                WriteRobot(inputIO3);

                if (!WaitForOK())
                {
                    ConfigRobot_event(string.Format("PC向机器人发送参数{0}失败!", inputIO3), false);
                    return(false);
                }
                ConfigRobot_event(string.Format("PC向机器人发送参数{0}成功!", inputIO3), true);

                string jumpInputIO3 = name + " jumpIOP3" + " "
                                      + robotStdPoint.P_JumpIOP3.DblValue1.ToString().PadLeft(7, ' ') + " "
                                      + robotStdPoint.P_JumpIOP3.DblValue2.ToString().PadLeft(7, ' ') + " "
                                      + robotStdPoint.P_JumpIOP3.DblValue3.ToString().PadLeft(7, ' ') + " "
                                      + robotStdPoint.P_JumpIOP3.DblValue4.ToString().PadLeft(7, ' ');
                WriteRobot(jumpInputIO3);
                if (!WaitForOK())
                {
                    ConfigRobot_event(string.Format("PC向机器人发送参数{0}失败!", jumpInputIO3), false);
                    return(false);
                }
                ConfigRobot_event(string.Format("PC向机器人发送参数{0}成功!", jumpInputIO3), true);


                int waitIO4 = (int)robotStdPoint.P_InputIO4.DblValue3;
                if (waitIO4 == -1)
                {
                    waitIO4 = int.MaxValue;
                }
                string inputIO4 = name + " inputIO4" + " "
                                  + robotStdPoint.P_InputIO4.DblValue1.ToString().PadLeft(7, ' ') + " "
                                  + robotStdPoint.P_InputIO4.DblValue2.ToString().PadLeft(7, ' ') + " "
                                  + waitIO4.ToString().PadLeft(7, ' ') + " "
                                  + robotStdPoint.P_InputIO4.DblValue4.ToString().PadLeft(7, ' ');
                WriteRobot(inputIO4);
                if (!WaitForOK())
                {
                    ConfigRobot_event(string.Format("PC向机器人发送参数{0}失败!", vaccum), false);
                    return(false);
                }
                ConfigRobot_event(string.Format("PC向机器人发送参数{0}成功!", vaccum), true);

                string jumpInputIO4 = name + " jumpIOP4" + " "
                                      + robotStdPoint.P_JumpIOP4.DblValue1.ToString().PadLeft(7, ' ') + " "
                                      + robotStdPoint.P_JumpIOP4.DblValue2.ToString().PadLeft(7, ' ') + " "
                                      + robotStdPoint.P_JumpIOP4.DblValue3.ToString().PadLeft(7, ' ') + " "
                                      + robotStdPoint.P_JumpIOP4.DblValue4.ToString().PadLeft(7, ' ');
                WriteRobot(jumpInputIO4);

                if (!WaitForOK())
                {
                    ConfigRobot_event(string.Format("PC向机器人发送参数{0}失败!", jumpInputIO4), false);
                    return(false);
                }
                ConfigRobot_event(string.Format("PC向机器人发送参数{0}成功!", jumpInputIO4), true);
                #endregion InputIO

                #region PC

                string pc = name + " pc" + " "
                            + robotStdPoint.P_PC.DblValue1.ToString().PadLeft(7, ' ') + " "
                            + robotStdPoint.P_PC.DblValue2.ToString().PadLeft(7, ' ') + " "
                            + robotStdPoint.P_PC.DblValue3.ToString().PadLeft(7, ' ') + " "
                            + robotStdPoint.P_PC.DblValue4.ToString().PadLeft(7, ' ') + " "
                            + robotStdPoint.P_PC.DblValue5.ToString().PadLeft(7, ' ');
                WriteRobot(pc);
                if (!WaitForOK())
                {
                    ConfigRobot_event(string.Format("PC向机器人发送参数{0}失败!", pc), false);
                    return(false);
                }
                ConfigRobot_event(string.Format("PC向机器人发送参数{0}成功!", pc), true);


                int waitPC = (int)robotStdPoint.P_PCCMD.DblValue2;
                if (waitPC == -1)
                {
                    waitPC = int.MaxValue;
                }
                string pcCMD = name + " pcCMD" + " "
                               + robotStdPoint.P_PCCMD.DblValue1.ToString().PadLeft(7, ' ') + " "
                               + waitPC.ToString().PadLeft(7, ' ') + " "
                               + robotStdPoint.P_PCCMD.DblValue3.ToString().PadLeft(7, ' ') + " "
                               + robotStdPoint.P_PCCMD.DblValue4.ToString().PadLeft(7, ' ');
                WriteRobot(pcCMD);

                if (!WaitForOK())
                {
                    ConfigRobot_event(string.Format("PC向机器人发送参数{0}失败!", pcCMD), false);
                    return(false);
                }
                ConfigRobot_event(string.Format("PC向机器人发送参数{0}成功!", pcCMD), true);
                #endregion PC
                return(true);
            }
            catch (Exception ex)
            {
                return(false);
            }
        }
Beispiel #28
0
        public bool WriteMove(string name, RobotStdPoint robotStdPoint)
        {
            try
            {
                string vel = name + " vel" + " "
                             + robotStdPoint.P_Vel.DblValue1.ToString().PadLeft(7, ' ') + " "
                             + robotStdPoint.P_Vel.DblValue2.ToString().PadLeft(7, ' ') + " "
                             + robotStdPoint.P_Vel.DblValue3.ToString().PadLeft(7, ' ') + " "
                             + robotStdPoint.P_Vel.DblValue4.ToString().PadLeft(7, ' ');
                WriteRobot(vel);
                if (!WaitForOK())
                {
                    ConfigRobot_event(string.Format("PC向机器人发送参数{0}失败!", vel), false);
                    return(false);
                }
                ConfigRobot_event(string.Format("PC向机器人发送参数{0}成功!", vel), true);

                string move = name + " move" + " "
                              + robotStdPoint.P_Move.DblValue1.ToString().PadLeft(7, ' ') + " "
                              + robotStdPoint.P_Move.DblValue2.ToString().PadLeft(7, ' ') + " "
                              + robotStdPoint.P_Move.DblValue3.ToString().PadLeft(7, ' ') + " "
                              + robotStdPoint.P_Move.DblValue4.ToString().PadLeft(7, ' ');
                WriteRobot(move);
                if (!WaitForOK())
                {
                    ConfigRobot_event(string.Format("PC向机器人发送参数{0}失败!", move), false);
                    return(false);
                }
                ConfigRobot_event(string.Format("PC向机器人发送参数{0}成功!", move), true);

                string des = name + " des" + " "
                             + robotStdPoint.P_Des.DblValue1.ToString().PadLeft(7, ' ') + " "
                             + robotStdPoint.P_Des.DblValue2.ToString().PadLeft(7, ' ') + " "
                             + robotStdPoint.P_Des.DblValue3.ToString().PadLeft(7, ' ') + " "
                             + robotStdPoint.P_Des.DblValue4.ToString().PadLeft(7, ' ') + " "
                             + robotStdPoint.P_Des.DblValue5.ToString().PadLeft(7, ' ');
                WriteRobot(des);
                if (!WaitForOK())
                {
                    ConfigRobot_event(string.Format("PC向机器人发送参数{0}失败!", des), false);
                    return(false);
                }
                ConfigRobot_event(string.Format("PC向机器人发送参数{0}成功!", des), true);

                string here = name + " here" + " "
                              + robotStdPoint.P_Here.DblValue1.ToString().PadLeft(7, ' ') + " "
                              + robotStdPoint.P_Here.DblValue2.ToString().PadLeft(7, ' ') + " "
                              + robotStdPoint.P_Here.DblValue3.ToString().PadLeft(7, ' ') + " "
                              + robotStdPoint.P_Here.DblValue4.ToString().PadLeft(7, ' ');
                WriteRobot(here);
                if (!WaitForOK())
                {
                    ConfigRobot_event(string.Format("PC向机器人发送参数{0}失败!", here), false);
                    return(false);
                }
                ConfigRobot_event(string.Format("PC向机器人发送参数{0}成功!", here), true);

                string passCMD = name + " passCMD" + " "
                                 + robotStdPoint.P_PassCMD.DblValue1.ToString().PadLeft(7, ' ') + " "
                                 + robotStdPoint.P_PassCMD.DblValue2.ToString().PadLeft(7, ' ') + " "
                                 + robotStdPoint.P_PassCMD.DblValue3.ToString().PadLeft(7, ' ') + " "
                                 + robotStdPoint.P_PassCMD.DblValue4.ToString().PadLeft(7, ' ');
                WriteRobot(passCMD);
                if (!WaitForOK())
                {
                    ConfigRobot_event(string.Format("PC向机器人发送参数{0}失败!", passCMD), false);
                    return(false);
                }
                ConfigRobot_event(string.Format("PC向机器人发送参数{0}成功!", passCMD), true);

                string pass1 = name + " pass1" + " "
                               + robotStdPoint.P_Pass1.DblValue1.ToString().PadLeft(7, ' ') + " "
                               + robotStdPoint.P_Pass1.DblValue2.ToString().PadLeft(7, ' ') + " "
                               + robotStdPoint.P_Pass1.DblValue3.ToString().PadLeft(7, ' ') + " "
                               + robotStdPoint.P_Pass1.DblValue4.ToString().PadLeft(7, ' ') + " "
                               + robotStdPoint.P_Pass1.DblValue5.ToString().PadLeft(7, ' ');
                WriteRobot(pass1);
                if (!WaitForOK())
                {
                    ConfigRobot_event(string.Format("PC向机器人发送参数{0}失败!", pass1), false);
                    return(false);
                }
                ConfigRobot_event(string.Format("PC向机器人发送参数{0}成功!", pass1), true);

                string pass2 = name + " pass2" + " "
                               + robotStdPoint.P_Pass2.DblValue1.ToString().PadLeft(7, ' ') + " "
                               + robotStdPoint.P_Pass2.DblValue2.ToString().PadLeft(7, ' ') + " "
                               + robotStdPoint.P_Pass2.DblValue3.ToString().PadLeft(7, ' ') + " "
                               + robotStdPoint.P_Pass2.DblValue4.ToString().PadLeft(7, ' ') + " "
                               + robotStdPoint.P_Pass2.DblValue5.ToString().PadLeft(7, ' ');
                WriteRobot(pass2);
                if (!WaitForOK())
                {
                    ConfigRobot_event(string.Format("PC向机器人发送参数{0}失败!", pass2), false);
                    return(false);
                }
                ConfigRobot_event(string.Format("PC向机器人发送参数{0}成功!", pass2), true);

                string pass3 = name + " pass3" + " "
                               + robotStdPoint.P_Pass3.DblValue1.ToString().PadLeft(7, ' ') + " "
                               + robotStdPoint.P_Pass3.DblValue2.ToString().PadLeft(7, ' ') + " "
                               + robotStdPoint.P_Pass3.DblValue3.ToString().PadLeft(7, ' ') + " "
                               + robotStdPoint.P_Pass3.DblValue4.ToString().PadLeft(7, ' ') + " "
                               + robotStdPoint.P_Pass3.DblValue5.ToString().PadLeft(7, ' ');
                WriteRobot(pass3);
                if (!WaitForOK())
                {
                    ConfigRobot_event(string.Format("PC向机器人发送参数{0}失败!", pass3), false);
                    return(false);
                }
                ConfigRobot_event(string.Format("PC向机器人发送参数{0}成功!", pass3), true);
                return(true);
            }
            catch (Exception ex)
            {
                return(false);
            }
        }
Beispiel #29
0
        public bool WriteOut(string name, RobotStdPoint robotStdPoint)
        {
            try
            {
                string outIO = name + " outIO" + " "
                               + robotStdPoint.P_OutIO.DblValue1.ToString().PadLeft(7, ' ') + " "
                               + robotStdPoint.P_OutIO.DblValue2.ToString().PadLeft(7, ' ') + " "
                               + robotStdPoint.P_OutIO.DblValue3.ToString().PadLeft(7, ' ') + " "
                               + robotStdPoint.P_OutIO.DblValue4.ToString().PadLeft(7, ' ');
                WriteRobot(outIO);

                if (!WaitForOK())
                {
                    ConfigRobot_event(string.Format("PC向机器人发送参数{0}失败!", outIO), false);
                    return(false);
                }
                ConfigRobot_event(string.Format("PC向机器人发送参数{0}成功!", outIO), true);

                string outVaccum = name + " outVaccum" + " "
                                   + robotStdPoint.P_OutVaccum.DblValue1.ToString().PadLeft(7, ' ') + " "
                                   + robotStdPoint.P_OutVaccum.DblValue2.ToString().PadLeft(7, ' ') + " "
                                   + robotStdPoint.P_OutVaccum.DblValue3.ToString().PadLeft(7, ' ') + " "
                                   + robotStdPoint.P_OutVaccum.DblValue4.ToString().PadLeft(7, ' ');
                WriteRobot(outVaccum);
                if (!WaitForOK())
                {
                    ConfigRobot_event(string.Format("PC向机器人发送参数{0}失败!", outVaccum), false);
                    return(false);
                }
                ConfigRobot_event(string.Format("PC向机器人发送参数{0}成功!", outVaccum), true);

                string outPC = name + " outPC" + " "
                               + robotStdPoint.P_OutPC.DblValue1.ToString().PadLeft(7, ' ') + " "
                               + robotStdPoint.P_OutPC.DblValue2.ToString().PadLeft(7, ' ') + " "
                               + robotStdPoint.P_OutPC.DblValue3.ToString().PadLeft(7, ' ') + " "
                               + robotStdPoint.P_OutPC.DblValue4.ToString().PadLeft(7, ' ');
                WriteRobot(outPC);

                if (!WaitForOK())
                {
                    ConfigRobot_event(string.Format("PC向机器人发送参数{0}失败!", outPC), false);
                    return(false);
                }
                ConfigRobot_event(string.Format("PC向机器人发送参数{0}成功!", outPC), true);

                string nextPos = name + " nextPos" + " "
                                 + robotStdPoint.P_NextPoint.DblValue1.ToString().PadLeft(7, ' ') + " "
                                 + robotStdPoint.P_NextPoint.DblValue2.ToString().PadLeft(7, ' ') + " "
                                 + robotStdPoint.P_NextPoint.DblValue3.ToString().PadLeft(7, ' ') + " "
                                 + robotStdPoint.P_NextPoint.DblValue4.ToString().PadLeft(7, ' ');
                WriteRobot(nextPos);

                if (!WaitForOK())
                {
                    ConfigRobot_event(string.Format("PC向机器人发送参数{0}失败!", nextPos), false);
                    return(false);
                }
                ConfigRobot_event(string.Format("PC向机器人发送参数{0}成功!", nextPos), true);
                return(true);
            }
            catch (Exception ex)
            {
                return(false);
            }
        }