/// <summary> /// Form load /// </summary> /// <param name="sender"></param> /// <param name="e"></param> void frmMain_Load(object sender, EventArgs e) { cts = new CancellationTokenSource(); sendQueue = new ConcurrentQueue <List <char[]> >(); robotManager.Open("cifX0", 0); Thread.Sleep(1000); UpdateLogList("리셋"); robotManager.Reset(); Thread.Sleep(1000); UpdateLogList("프로그램 넣기"); robotManager.SetProgram(); // 실행시 파일에 저장한 마지막 실행 스탭을 가져온다. lastStep = GetLastStepFromFile(); LoopCount = GetLoopCount(); cboWorkCount.SelectedIndex = LoopCount; StartService(); StartRobot(); Restart(); }
private void Window_Loaded(object sender, RoutedEventArgs e) { try { cts = new CancellationTokenSource(); robotManager = new RobotManager(); uint ret = robotManager.Open("cifX0", 0); assembly = new Assembly(); settings = new Settings(this); RobotStatus(cts.Token); DisplayAssembly(cts.Token); GetStep(cts.Token); } catch (Exception ex) { AutoClosingMessageBox.Show("프로그램 실행 중 에러가 발생하였습니다.", "Error", 2000); logger.Error(ex); } }
static void Main(string[] args) { robotManager = new RobotManager(); robotManager.Open("cifX0", 0); Thread.Sleep(1000); robotManager.Reset(); Debug.WriteLine("All robot reset"); //while (true) //{ // // 모든 로봇이 모터 온이 되었다면 // if (robotManager.IsMotorOn(Robots.R1) // && robotManager.IsMotorOn(Robots.R2) // && robotManager.IsMotorOn(Robots.R3)) // { // Debug.WriteLine("All robot's motor is on"); // break; // } // if (!robotManager.IsMotorOn(Robots.R1)) // { // robotManager.MotorOn(Robots.R1); // Thread.Sleep(500); // robotManager.Reset(Robots.R1); // Debug.WriteLine("R1 motor on send"); // } // if (!robotManager.IsMotorOn(Robots.R2)) // { // robotManager.MotorOn(Robots.R2); // Thread.Sleep(500); // robotManager.Reset(Robots.R2); // Debug.WriteLine("R2 motor on send"); // } // if (!robotManager.IsMotorOn(Robots.R3)) // { // robotManager.MotorOn(Robots.R3); // Thread.Sleep(500); // robotManager.Reset(Robots.R3); // Debug.WriteLine("R3 motor on send"); // } // Thread.Sleep(1000); //} //StepType stepType = StepType.Full; //// 프로그램 밀어넣기 //if (robotManager.SetProgram()) //{ // Thread.Sleep(500); // // 오더 밀어넣기 // robotManager.SendOrder(Robots.R1, stepType); // Thread.Sleep(500); // robotManager.SendOrder(Robots.R2, stepType); // Thread.Sleep(500); // robotManager.SendOrder(Robots.R3, stepType); //} //Thread.Sleep(1000); //robotManager.RobotRun(); //if (robotManager.RestartOn(Robots.R1)) robotManager.RobotRunReset(Robots.R1); //if (robotManager.RestartOn(Robots.R2)) robotManager.RobotRunReset(Robots.R2); //if (robotManager.RestartOn(Robots.R3)) robotManager.RobotRunReset(Robots.R3); cts = new CancellationTokenSource(); CheckError(cts.Token); ReadTrigger(cts.Token); Console.ReadLine(); }