public void TestOfControl() { RangerControlRobot rangerControlRobot = new RangerControlRobot("COM13"); rangerControlRobot.connect(); rangerControlRobot.setCommand(ControlStates.TRACKS_FORWARD); Thread.Sleep(1000); rangerControlRobot.setCommand(ControlStates.TRACK_TURN_LEFT); Thread.Sleep(3000); rangerControlRobot.setCommand(ControlStates.TRACK_TURN_RIGHT); Thread.Sleep(3000); rangerControlRobot.setCommand(ControlStates.TRACKS_STOP); Thread.Sleep(1000); rangerControlRobot.setCommand(ControlStates.TRACKS_BACKWARD); Thread.Sleep(1000); rangerControlRobot.setCommand(ControlStates.TRACKS_STOP); Thread.Sleep(1000); rangerControlRobot.setCommand(ControlStates.ARM_UP); Thread.Sleep(5000); rangerControlRobot.setCommand(ControlStates.ARM_STOP); Thread.Sleep(1000); rangerControlRobot.setCommand(ControlStates.ARM_DOWN); Thread.Sleep(2000); rangerControlRobot.setCommand(ControlStates.ARM_STOP); Thread.Sleep(1000); rangerControlRobot.setCommand(ControlStates.GRIPPER_CLOSE); Thread.Sleep(2000); rangerControlRobot.setCommand(ControlStates.GRIPPER_OPEN); Thread.Sleep(2000); rangerControlRobot.setCommand(ControlStates.ALL_STOP); rangerControlRobot.disconnect(); }
private void Window_Loaded(object sender, RoutedEventArgs e) { try { this.config.getConfig(); this.cameraBoundary = new CameraBoundary(this, this.config.IpCamera); this.rangerControlRobot = new RangerControlRobot(this.config.RangerControlPortName); this.cameraBoundary.start(); this.rangerControlRobot.connect(); this.worker.DoWork += worker_DoWork; this.worker.RunWorkerCompleted += worker_RunWorkerCompleted; this.worker.RunWorkerAsync(); } catch (Exception exc) { MessageBox.Show(exc.Message); this.Close(); } }