static async Task Main(string[] args) { System.Console.WriteLine("Hello World!"); var config = new VectorControllerPlusConfig() { ReconnectDelay_ms = 2000 }; await using (IVectorControllerPlus controller = new VectorControllerPlus()) { controller.OnConnectionChanged += async(previously, state) => System.Console.WriteLine("! Connection: " + state); //await controller.AddBehaviourAsync(new MonitoringEventsBehaviour(false)); await controller.AddBehaviourAsync(new OfferTeaSometimesBehaviour(0)); await controller.AddBehaviourAsync(new ExterminateCubeOnSightBehaviour(1)); controller.OnBehaviourReport += async(report) => { System.Console.WriteLine(report.Description); await File.AppendAllLinesAsync(LOG_FILE, new[] { report.Description }); }; await controller.ConnectAsync(config); cancelSource = new CancellationTokenSource(); await controller.StartMainLoopAsync(cancelSource.Token); } }
public async Task TestControllerCanConnectToRobotAsync() { var config = new VectorControllerPlusConfig() { ReconnectDelay_ms = 2000 }; var connected = await controller.ConnectAsync(config); Assert.True(connected); }
public async Task TestStubVisionBehaviourPlusReceivesFrames() { await controller.AddBehaviourAsync(new StubVisionBehaviour(0)); var config = new VectorControllerPlusConfig() { ReconnectDelay_ms = 2000 }; var connected = await controller.ConnectAsync(config); Assert.True(connected); var processor = controller.FrameProcessors.First(); Assert.True(processor is YoloCameraFrameProcessor); Thread.Sleep(500); Assert.True(processor.FramesProcessed >= 2); }