private readonly cVision vision; //接收视觉结果 public void ConectToVision() { string notes; vision.initRcv(); RcvThread = new Thread(new ThreadStart(delegate { while (true) { vision.ReciveData(); notes = " X = " + vision.hitPar[1].ToString() + "\n Y = " + vision.hitPar[2].ToString() + "\n Z = " + vision.hitPar[3].ToString() + "\n Vx = " + vision.hitPar[4].ToString() + "\n Vy = " + vision.hitPar[5].ToString() + "\n Vz = " + vision.hitPar[6].ToString() + "\n tg = " + vision.hitPar[12].ToString(); if (vision.hitPar[0] == 1) { double[] padPar; SlovePadPram(vision.hitPar, out padPar); notes += "\n PadV = " + padPar[3].ToString() + "\n PadS = " + padPar[4].ToString(); SetNotes(notes); Control_Arm.Recv4Vision(vision.hitPar); ZSPCt.SetZSP((int)vision.hitPar[3], (int)(padPar[4]), 127); } Thread.Sleep(50); } } )); RcvThread.Start(); }
private readonly cVision vision; //接收视觉结果 public bool ConectToVision() { string notes; if (vision.initRcv()) { RcvThread = new Thread(new ThreadStart(delegate { while (true) { vision.ReciveData(); notes = " X = " + vision.hitPar[1].ToString("#0.0") + " Vx = " + vision.hitPar[4].ToString("#0.0") + "\n Y = " + vision.hitPar[2].ToString("#0.0") + " Vy = " + vision.hitPar[5].ToString("#0.0") + "\n Z = " + vision.hitPar[3].ToString("#0.0") + " Vz = " + vision.hitPar[6].ToString("#0.0") + "\n tg = " + vision.hitPar[12].ToString("#0.0"); // if (vision.hitPar[0] == 1) // { double[] padPar; SlovePadPram(vision.hitPar, out padPar); notes += "\n PadV = " + padPar[4].ToString("#0.0") + "\n PadS = " + padPar[5].ToString("#0.0"); SetNotes(notes); //if (vision.hitPar[12] >0.01) Control_Arm.Recv4Vision(padPar); // } //Thread.Sleep(10); } } )); RcvThread.Start(); //ZspThread = new Thread(new ThreadStart(delegate // { // while(true) // { // if (!Control_Arm.flag_isMoving) // { // Control_Arm.HomeZsp(); // } // Thread.Sleep(10); // } // } // )); //ZspThread.Start(); return(true); } return(false); }