示例#1
0
 private void btnDraw_Click(object sender, EventArgs e)
 {
     int[][] que = new int[5][];
     for (int i = 0; i < 5; i++)
     {
         Tranceiver.sendPacket(4, 0, 2, 0, 0, 0, 0, 2, 2, 2);
     }
 }
示例#2
0
        public void trackTargetSend(Point center)
        {
            PointF temp = environment.axis_Image2User(center);

            if (Math.Abs(temp.X - CtrledPlant.BlockCenter.X) > TargetDeadzone ||
                Math.Abs(temp.Y - CtrledPlant.BlockCenter.Y) > TargetDeadzone)
            {
                targetSendCount++;
                CtrledPlant.BlockCenter = temp;
                trackTarget.X           = CtrledPlant.BlockCenter.X / 2;
                trackTarget.Y           = CtrledPlant.BlockCenter.Y;
                PointF result = calculatePID(trackTarget);
                if (targetSendCount == sendInterval)
                {
                    targetSendCount = 0;
                    tranceiver.sendPacket(3, 0, dobot.origin_x, result.Y, CtrledPlant.Height + dobot.origin_z,
                                          0, 0, 1, 0, 0);
                }
            }
        }
示例#3
0
        private void pointSeriesCompare(object pup)
        {
            List <PickUpPoint> pointSeries = (List <PickUpPoint>)pup;

            for (int i = 0; i < pointSeries.Count; i++)
            {
                if (i == 0)
                {
                    if (pointSeries[i].isGrab == 1)
                    {
                        pointSeries[i].MovStyle = 0;
                    }
                }
                if (i > 0)
                {
                    if (Convert.ToBoolean(pointSeries[i].isGrab) ^
                        Convert.ToBoolean(pointSeries[i - 1].isGrab))
                    {
                        pointSeries[i].MovStyle = 0;
                    }

                    while (true)
                    {
                        if (Math.Abs(Tranceiver.retPacket.X - pointSeries[i - 1].X) < 0.1 &&
                            Math.Abs(Tranceiver.retPacket.Y - pointSeries[i - 1].Y) < 0.1)
                        {
                            break;
                        }
                    }
                }
                Tranceiver.sendPacket(3, 0, pointSeries[i].X, pointSeries[i].Y,
                                      Convert.ToSingle(txtHeight.Text) + dobot.origin_z,
                                      0, pointSeries[i].isGrab, pointSeries[i].MovStyle, 0, dobot.Target_PauseTime);
            }
            Tranceiver.sendPacket("3", "0", dobot.origin_x.ToString(), dobot.origin_y.ToString(),
                                  dobot.origin_z.ToString(), "0", "0", "0", "0", "0");
            pointCompare.Abort();
        }
示例#4
0
 private void btnOpenCamera_Click(object sender, EventArgs e)
 {
     #region if capture is not created, create it now
     if (capture == null)
     {
         try
         {
             capture = new Capture(1);
             capture.ImageGrabbed += ProcessFrame;
         }
         catch (NullReferenceException excpt)
         {
             MessageBox.Show(excpt.Message);
         }
     }
     #endregion
     if (capture != null)
     {
         if (captureInProgress)
         {
             Tranceiver.sendPacket(3, 0, dobot.origin_x, dobot.origin_y, dobot.origin_z, 0, 0, 1, 0, 0);
             btnOpenCamera.Text = "Open";
             capture.Pause();
             btnGrab.Enabled = false;
             //tabAlgorithm.Enabled = false;
         }
         else
         {
             //Tranceiver.sendPacket(2, 0, 0, 0, 0, 0, 0, 100, 0, 0);
             Tranceiver.sendPacket(9, 0, controler.JogMaxSpeed, controler.JogMaxAcc, 30, 50, 100, 200, 0, 30);
             btnOpenCamera.Text = "Stop";
             capture.Start();
             btnGrab.Enabled      = true;
             tabAlgorithm.Enabled = true;
         }
         captureInProgress = !captureInProgress;
     }
 }