コード例 #1
0
ファイル: Robot.cs プロジェクト: ForGitHub00/Voronezh_v1
        private string GetData(string strRecive, string strSend)
        {
            Singleton s = Singleton.GetInstance();

            double x = ParserXML.GetValues(strRecive, "Rob\\RIst\\X");
            double y = ParserXML.GetValues(strRecive, "Rob\\RIst\\Y");
            double z = ParserXML.GetValues(strRecive, "Rob\\RIst\\Z");
            double a = ParserXML.GetValues(strRecive, "Rob\\RIst\\A");
            double b = ParserXML.GetValues(strRecive, "Rob\\RIst\\B");
            double c = ParserXML.GetValues(strRecive, "Rob\\RIst\\C");

            s.Position = new RPoint(x, y, z, a, b, c);

            x = ParserXML.GetValues(strRecive, "Rob\\PX");
            y = ParserXML.GetValues(strRecive, "Rob\\PY");
            z = ParserXML.GetValues(strRecive, "Rob\\PZ");
            a = ParserXML.GetValues(strRecive, "Rob\\PA");
            b = ParserXML.GetValues(strRecive, "Rob\\PB");
            c = ParserXML.GetValues(strRecive, "Rob\\PC");

            s.recive_p = new RPoint(x, y, z, a, b, c);

            int work = (int)ParserXML.GetValues(strRecive, "Rob\\Work");

            s.work = work;
            // s.rec = work;
            // s.work = Convert.ToBoolean(work == 1);
            //// Console.WriteLine($"s.work = {s.work}  |||   work = {work}");
            // if (work == 1) {
            //    // Console.WriteLine("WORK BITCH!");
            // }
            if (exit)
            {
                ParserXML.SetValue(ref strSend, "Sen\\Exit", 1);
            }
            s.StrRecive = strRecive;

            return(strSend);
        }
コード例 #2
0
ファイル: Robot.cs プロジェクト: ForGitHub00/Voronezh_v1
        private string _defaultDelegate(string strRecive, string strSend)
        {
            Stopwatch sw = new Stopwatch();

            sw.Start();

            if (first)
            {
                RX    = ParserXML.GetValues(strRecive, new string[] { "Rob", "RIst", "X" });
                RY    = ParserXML.GetValues(strRecive, new string[] { "Rob", "RIst", "Y" });
                RZ    = ParserXML.GetValues(strRecive, new string[] { "Rob", "RIst", "Z" });
                RA    = ParserXML.GetValues(strRecive, new string[] { "Rob", "RIst", "A" });
                RB    = ParserXML.GetValues(strRecive, new string[] { "Rob", "RIst", "B" });
                RC    = ParserXML.GetValues(strRecive, new string[] { "Rob", "RIst", "C" });
                first = false;
            }


            single.Position = new RPoint(RX, RY, RZ, RA, RB, RC);


            if (single._MAP.Count != 0)
            {
                //if (RX >= 9.5245) {
                //    first = false;
                //}
                int index = prevIndex;
                while (index < single._MAP.Count && RX > single._MAP[index].X)
                {
                    index++;
                }
                prevIndex = index;
                if (index < single._MAP.Count)
                {
                    double sum   = Math.Abs(single._MAP[index].X - RX) + Math.Abs(single._MAP[index].Y - RY) + Math.Abs(single._MAP[index].Z - RZ);
                    double xProc = (single._MAP[index].X - RX) / sum;
                    double yProc = (single._MAP[index].Y - RY) / sum;
                    double zProc = (single._MAP[index].Z - RZ) / sum;


                    //Console.WriteLine(xProc);


                    ParserXML.SetValue(ref strSend, "Sen\\RKorr\\X", xProc * _oneCor);
                    ParserXML.SetValue(ref strSend, "Sen\\RKorr\\Y", yProc * _oneCor);
                    ParserXML.SetValue(ref strSend, "Sen\\RKorr\\Z", zProc * _oneCor);
                    RX += xProc * _oneCor;
                    RY += yProc * _oneCor;
                    RZ += zProc * _oneCor;
                }
                else
                {
                    //ParserXML.SetValue(ref strSend, "Sen\\RKorr\\X", _oneCor);
                    //RX +=  _oneCor;e
                    exit = true;
                }
            }
            int work = (int)ParserXML.GetValues(strRecive, "Rob\\Work");

            single.work = work;
            if (exit)
            {
                ParserXML.SetValue(ref strSend, "Sen\\Exit", 1);
            }
            sw.Stop();
            // Console.WriteLine(sw.ElapsedMilliseconds);
            return(strSend);
        }