コード例 #1
0
ファイル: Program.cs プロジェクト: elpikel/HCDrone
        static void Main(string[] args)
        {
            var droneClient = new DroneClient("192.168.1.1");

            SleepAndPaint(droneClient);

            droneClient.Start();

            SleepAndPaint(droneClient);

            droneClient.Takeoff();

            SleepAndPaint(droneClient);


            droneClient.Progress(FlightMode.Progressive, yaw: -0.05f);

            System.Console.WriteLine("Yaw -0.05");
            SleepAndPaint(droneClient);

            droneClient.Hover();
            SleepAndPaint(droneClient);

            droneClient.Land();

            SleepAndPaint(droneClient);

            droneClient.Stop();

            SleepAndPaint(droneClient);

            System.Console.ReadLine();

            droneClient.Dispose();
        }
コード例 #2
0
        /// <summary>
        /// 重写关闭代码
        /// 将开启的资源关闭
        /// </summary>
        /// <param name="e"></param>
        /// <returns></returns>
        protected override void OnClosed(EventArgs e)
        {
            if (_autopilot != null)
            {
                _autopilot.UnbindFromClient();
                _autopilot.Stop();
            }

            StopRecording();

            _droneClient.Dispose();
            if (_videoPacketDecoderWorker != null)
            {
                _videoPacketDecoderWorker.Dispose();
            }

            _viconPositionGet.Dispose();

            if (_pwrite != null)
            {
                _pwrite.Stop();
                _pwrite.Join();
                _pwrite.Dispose();
            }
            if (_viconPositionGet != null)
            {
                _viconPositionGet.Dispose();
            }


            base.OnClosed(e);
        }
コード例 #3
0
 // Called if the gameobject is destroyed
 void OnDestroy()
 {
     droneClient.Land();
     droneClient.Stop();
     droneClient.Dispose();
     videoPacketDecoderWorker.Stop();
     videoPacketDecoderWorker.Dispose();
 }
コード例 #4
0
ファイル: MainForm.cs プロジェクト: SBejga/MyoPilot
        protected override void OnClosed(EventArgs e)
        {
            droneClient.Stop();
            droneClient.Dispose();
            videoPacketDecoderWorker.Dispose();

            base.OnClosed(e);
        }
コード例 #5
0
        protected override void OnClosed(EventArgs e)
        {
            _droneClient.Dispose();
            _videoPacketDecoderWorker.Dispose();
            _packetRecorderWorker.Dispose();

            base.OnClosed(e);
        }
コード例 #6
0
 protected override void UnloadContent()
 {
     droneClient.Dispose();
     videoPacketDecoderWorker.Dispose();
     if (kinect != null)
     {
         kinect.Dispose();
     }
 }
コード例 #7
0
        public override void Cleanup()
        {
            base.Cleanup();

            _droneClient.Stop();
            _droneClient.Dispose();
            _videoPacketDecoderWorker.Dispose();
            _autopilot.Stop();
        }
コード例 #8
0
ファイル: MainForm.cs プロジェクト: elpikel/HCDrone
        protected override void OnClosed(EventArgs e)
        {
            if (_autopilot != null)
            {
                _autopilot.UnbindFromClient();
                _autopilot.Stop();
            }

            StopRecording();

            _droneClient.Dispose();
            _videoPacketDecoderWorker.Dispose();

            base.OnClosed(e);
        }
コード例 #9
0
ファイル: MainWindow.xaml.cs プロジェクト: jmservera/IoTDrone
 private async void MainWindow_Closed(object sender, EventArgs e)
 {
     if (frameTimer != null)
     {
         frameTimer.Stop();
     }
     if (droneClient != null)
     {
         droneClient.Stop();
         droneClient.Dispose();
     }
     if (videoPacketDecoderWorker != null)
     {
         videoPacketDecoderWorker.Stop();
         videoPacketDecoderWorker.Dispose();
     }
     await closeSource();
 }
コード例 #10
0
ファイル: MainWindow.xaml.cs プロジェクト: jmservera/IoTDrone
        void configDrone()
        {
            if (droneClient != null)
            {
                droneClient.VideoPacketAcquired -= OnVideoPacketAcquired;
            }
            droneClient?.Stop();
            droneClient?.Dispose();
            iotController = null;
            autoPilot?.Stop();
            autoPilot = null;
            videoPacketDecoderWorker?.Stop();
            videoPacketDecoderWorker?.Dispose();

            Logger.LogInfo($"Configuring Drone at {config.DroneIP}");
            droneClient = new DroneClient(config.DroneIP);
            droneClient.VideoPacketAcquired += OnVideoPacketAcquired;
            videoPacketDecoderWorker         = new VideoPacketDecoderWorker(AR.Drone.Video.PixelFormat.BGR24, true, OnVideoPacketDecoded);
            videoPacketDecoderWorker.Start();

            iotController = new IoTHubController(droneClient, analyzerOutput, bitmaps);
            autoPilot     = new Pilot.Controller(droneClient, analyzerOutput, config, iotController);
        }
コード例 #11
0
 void MainWindow_Closing(object sender, System.ComponentModel.CancelEventArgs e)
 {
     _droneClient.Dispose();
     _videoPacketDecoderWorker.Dispose();
 }