예제 #1
0
        public void Connect(SerialPortAddress port, string configurationPath)
        {
            ArmConfiguration config = ArmConfiguration.LoadArmConfig(configurationPath);

            Arm = new Arm(port, config);
            Arm.SetServoSpeed(20);
        }
예제 #2
0
        private async void SelectorBox_OnSelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            SerialPortAddress address = e.AddedItems[0] as SerialPortAddress;

            _roverConnector?.Close();
            //_roverConnector = await Task.Run(() => new RoverConnector(address));
            _roverConnector = await Task.Run(() => new NewRoverConnector(address, _configJson));
        }
예제 #3
0
 public RoverConnector(SerialPortAddress address)
 {
     _port          = new SerialPort(address.Name);
     _port.Encoding = Encoding.ASCII;
     _port.Open();
     readerThread = new Thread(() =>
     {
         while (_keepreading)
         {
             try
             {
                 System.Diagnostics.Debug.WriteLine(_port.ReadLine());
             }
             catch
             {
             }
         }
     });
     readerThread.Start();
 }
예제 #4
0
 public NewRoverConnector(SerialPortAddress address, string json)
 {
     _rover             = Controller.Rover.FromJson(json);
     _rover.NewMessage += _rover_NewMessage;
     _port              = new SerialPort(address.Name);
     _port.Encoding     = Encoding.ASCII;
     _port.Open();
     readerThread = new Thread(() =>
     {
         while (_keepreading)
         {
             try
             {
                 System.Diagnostics.Debug.WriteLine(_port.ReadLine());
             }
             catch
             {
             }
         }
     });
     readerThread.Start();
 }
예제 #5
0
 public Arm(SerialPortAddress portAddress, ArmConfiguration configuration) : this(portAddress.Name, configuration)
 {
 }
예제 #6
0
 public Arm(SerialPortAddress portAddress, string configurationFilePath) : this(portAddress.Name, ArmConfiguration.LoadArmConfig(configurationFilePath))
 {
 }