Пример #1
0
 public override void run()
 {
     new Task(() => {
         while (isRun)
         {
             if (bcount < count)
             {
                 double[] value;
                 destangle[bcount] = value = Axis6.PosToAngle(LastStruct.angle, poslist[0][bcount], poslist[1][bcount], poslist[2][bcount], N, O, A);
                 if (value == null)
                 {
                     destangle[bcount] = destangle[bcount - 1];
                 }
                 bcount++;
             }
             else
             {
                 break;
             }
         }
     }).Start();
     while (isRun)
     {
         if (Motor.IsReady || !Motor.Enable)
         {
             if (docount < bcount)
             {
                 Motor.MotorRun(destangle[docount]);
                 Axis6.MoveToAngle(destangle[docount]);
                 docount++;
             }
         }
         Thread.Sleep(1);
     }
     LastStruct.angle = destangle[count - 1];
     //Axis6.AxisStruct last = new Axis6.AxisStruct();
 }
Пример #2
0
            public override void run()
            {
                int f, s, d;

                if (rg != r)
                {
                    r      = rg;
                    bcount = 0;
                }
                f = Motor.Frequency;
                s = Motor.StartSpeed;
                d = Motor.SpeedTime;
                Motor.Frequency = (Motor.Frequency > 5000) ? 5000 : Motor.Frequency;
                Motor.SetInfo(Motor.Frequency, Motor.Frequency, 1);
                sumdata(false);
                if (sumlot)
                {
                    if (First)
                    {
                        linehandl = Axis6.DrawLine(sour, dest, 'b', 2);
                    }
                }
                LastStruct = dest;
                if (bcount < count)
                {
                    while (isRun)
                    {
                        if (Motor.IsReady || !Motor.Enable)
                        {
                            if (docount < count)
                            {
                                if (AngleList[docount] == null)
                                {
                                    continue;
                                }
                                if (AngleList[docount] == LastStruct.angle)
                                {
                                    docount++;
                                    if (docount >= count)
                                    {
                                        if (inoutcount != 0)
                                        {
                                            StartInOut();
                                        }
                                    }
                                    continue;
                                }
                                Axis6.MoveToAngle(AngleList[docount]);
                                //Motor.MotorRun(AngleList[docount]);
                                docount++;
                                if (docount >= count)
                                {
                                    if (inoutcount != 0)
                                    {
                                        StartInOut();
                                    }
                                }
                            }
                            else
                            {
                                break;
                            }
                        }
                        Thread.Sleep(1);
                    }
                }
                else
                {
                    Axis6.PointToPointMove(AngleList);
                }
                if (!isRun)
                {
                    return;
                }
                Motor.MotorRunList(AngleList);
                while (isRun && !Motor.IsReady)
                {
                    Thread.Sleep(1);
                }
                if (!isRun)
                {
                    return;
                }
                Motor.SetInfo(s, f, d);
                while (isRun && !Motor.IsReady)
                {
                    Thread.Sleep(1);
                }
                //Axis6.AxisStruct last = new Axis6.AxisStruct();

                //if(AngleList==null)
                //{
                //    AngleList = Axis6.PointToPointLineAngle(sour, dest, rg);
                //    lineObj = Axis6.AngleListToObject(AngleList);
                //}
                //Motor.MotorRunList(AngleList);

                //Thread.Sleep(DefDelay);
            }