Пример #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="MainViewModel"/> class.
        /// </summary>
        public MainViewModel()
        {
            var handsAnalyzer        = new HandsAnalyzer();
            var skiColorHandDetector = new SkinColorHandsDetector();

            var drone = new Tello();
            var droneControllerKeyInputEvaluator   = new TelloKeyInputEvaluator();
            var droneControllerHandsInputEvaluator = new DroneControllerHandsInputEvaluator();

            this.app = new CaduhdApp(handsAnalyzer,
                                     skiColorHandDetector,
                                     drone,
                                     droneControllerKeyInputEvaluator,
                                     droneControllerHandsInputEvaluator);

            this.app.Bind(this.UserInterfaceConnector);

            this.webCamera           = new WebCamera(320, 180);
            this.webCamera.NewFrame += this.ProcessWebCameraFrame;
            this.webCamera.On();
            this.keyEventProcessor = new KeyEventProcessor();
        }
Пример #2
0
        public void Tello_TelloKeyInputEvaluator_Compatibility()
        {
            var keyInputEvaluator   = new TelloKeyInputEvaluator();
            var handsInputEvaluator = new DroneControllerHandsInputEvaluator();

            this.caduhdApp = new CaduhdApp(null, null, this.tello, keyInputEvaluator, handsInputEvaluator);
            string response = string.Empty;

            this.caduhdApp.Input(new KeyInfo(Key.D0, KeyState.Down));

            try
            {
                response = this.udpClient.Receive(ref this.anyEndPoint).AsString();
            }
            catch (SocketException)
            {
            }

            // it needs to be disposed of here
            this.tello.Dispose();

            Assert.Equal("command", response);
        }