Пример #1
0
        public MainForm()
        {
            InitializeComponent();

            _videoPacketDecoderWorker = new VideoPacketDecoderWorker(PixelFormat.BGR24, true, OnVideoPacketDecoded);
            _videoPacketDecoderWorker.Start();

            _droneClient = new DroneClient("192.168.1.1");
            _droneClient.NavigationPacketAcquired += OnNavigationPacketAcquired;
            _droneClient.VideoPacketAcquired += OnVideoPacketAcquired;
            _droneClient.NavigationDataAcquired += data => _navigationData = data;

            tmrStateUpdate.Enabled = true;
            tmrVideoUpdate.Enabled = true;

            _playerForms = new List<PlayerForm>();

            _videoPacketDecoderWorker.UnhandledException += UnhandledException;

            controls = new GamepadState(0);

            DirectInput dinput = new DirectInput();
            myList = dinput.GetDevices(DeviceClass.GameController, DeviceEnumerationFlags.AttachedOnly);

            DeviceInstance myJoyInput = (DeviceInstance)myList[0];

            Guid myGuid = myJoyInput.InstanceGuid;
            myJoy = new Joystick(dinput, myGuid);

            myJoy.Acquire();

            yawMultiplier = (float)yawMultSetBox.Value;
        }
Пример #2
0
        public MainForm()
        {
            InitializeComponent();

            face = new HaarCascade("haarcascade_frontalface_default.xml");
             //   grabber = new Capture();
              //  grabber.QueryFrame();
              //  Application.Idle += new EventHandler(FrameGrabber);

            this.WindowState = FormWindowState.Maximized;

            _videoPacketDecoderWorker = new VideoPacketDecoderWorker(PixelFormat.BGR24, true, OnVideoPacketDecoded);
            _videoPacketDecoderWorker.Start();

            _droneClient = new DroneClient("192.168.1.1");
            _droneClient.NavigationPacketAcquired += OnNavigationPacketAcquired;
            _droneClient.VideoPacketAcquired += OnVideoPacketAcquired;
            _droneClient.NavigationDataAcquired += data => _navigationData = data;

            tmrStateUpdate.Enabled = true;
            tmrVideoUpdate.Enabled = true;

            _playerForms = new List<PlayerForm>();

            _videoPacketDecoderWorker.UnhandledException += UnhandledException;

            _droneClient.Start();
        }
Пример #3
0
	// Use this for initialization
	void Start () {
		Debug.Log("Start");
		// initialize data array
		data = new byte[width*height*3];

		// set textures
		MainRenderer.material.mainTexture = cameraTexture;
		SecondaryRenderer.material.mainTexture = blackTexture;
		cameraTexture = new Texture2D (width, height);
		blackTexture = new Texture2D (1, 1);
		blackTexture.SetPixel (0, 0, Color.black);
		blackTexture.Apply ();

		// Initialize drone
		videoPacketDecoderWorker = new VideoPacketDecoderWorker(PixelFormat.BGR24, true, OnVideoPacketDecoded);
		videoPacketDecoderWorker.Start();
		droneClient = new DroneClient("192.168.1.1");
		droneClient.UnhandledException += HandleUnhandledException;
		droneClient.VideoPacketAcquired += OnVideoPacketAcquired;
		droneClient.NavigationDataAcquired += navData => navigationData = navData;
		videoPacketDecoderWorker.UnhandledException += HandleUnhandledException;
		droneClient.Start ();

		// activate main drone camera
		switchDroneCamera (AR.Drone.Client.Configuration.VideoChannelType.Vertical);

		// determine connection
		client = new WlanClient();
	}
Пример #4
0
        public PlayerForm()
        {
            InitializeComponent();

            _videoPacketDecoderWorker = new VideoPacketDecoderWorker(PixelFormat.BGR24, true, OnVideoPacketDecoded);
            _videoPacketDecoderWorker.Start();

            tmrVideoUpdate.Enabled = true;

            _videoPacketDecoderWorker.UnhandledException += UnhandledException;
        }
Пример #5
0
        public static void InitializeDrone()
        {
            _videoPacketDecoderWorker = new VideoPacketDecoderWorker(PixelFormat.BGR24, true, OnVideoPacketDecoded);
            _videoPacketDecoderWorker.Start();

            _droneClient = new DroneClient("192.168.1.1");
            _droneClient.NavigationPacketAcquired += OnNavigationPacketAcquired;
            _droneClient.VideoPacketAcquired += OnVideoPacketAcquired;
            _droneClient.NavigationDataAcquired += data => _navigationData = data;

            _videoPacketDecoderWorker.UnhandledException += UnhandledException;

            _droneClient.Start();
            _droneClient.ResetEmergency();
            _droneClient.FlatTrim();

            _droneUnity = new ReceiveUdpModel();
        }
Пример #6
0
        public MainForm()
        {
            InitializeComponent();

            _videoPacketDecoderWorker = new VideoPacketDecoderWorker(PixelFormat.BGR24, true, OnVideoPacketDecoded);
            _videoPacketDecoderWorker.Start();

            _droneClient = new DroneClient("192.168.1.1");
            _droneClient.NavigationPacketAcquired += OnNavigationPacketAcquired;
            _droneClient.VideoPacketAcquired += OnVideoPacketAcquired;
            _droneClient.NavigationDataAcquired += data => _navigationData = data;

            tmrStateUpdate.Enabled = true;
            tmrVideoUpdate.Enabled = true;

            _playerForms = new List<PlayerForm>();

            _videoPacketDecoderWorker.UnhandledException += UnhandledException;
        }
Пример #7
0
        public MainForm()
        {
            InitializeComponent();

            Text += Environment.Is64BitProcess ? " [64-bit]" : " [32-bit]";

            _videoPacketDecoderWorker = new VideoPacketDecoderWorker(PixelFormat.BGR24, true, OnVideoPacketDecoded);
            _videoPacketDecoderWorker.Start();

            string path = string.Format("flight_{0:yyyy-MM-dd-HH-mm}.ardrone", DateTime.Now);
            var stream = new FileStream(path, FileMode.OpenOrCreate);
            _packetRecorderWorker = new PacketRecorder(stream);
            _packetRecorderWorker.Start();

            _droneClient = new DroneClient();
            _droneClient.NavigationPacketAcquired += OnNavigationPacketAcquired;
            _droneClient.VideoPacketAcquired += OnVideoPacketAcquired;
            _droneClient.ConfigurationUpdated += OnConfigurationUpdated;
            _droneClient.Active = true;

            tmrStateUpdate.Enabled = true;
            tmrVideoUpdate.Enabled = true;
        }
Пример #8
0
        /// <summary>
        /// Initializes a new instance of the MainWindow class.
        /// </summary>
        public MainWindow()
        {
            InitializeComponent();

            // Speech synth Initialization
            //TODO: Check synth initialize result
            InitializeSynth();

            // AR Drone Initialization
            _videoPacketDecoderWorker = new VideoPacketDecoderWorker(AR.Drone.Video.PixelFormat.BGR24, true, OnVideoPacketDecoded);
            _videoPacketDecoderWorker.Start();

            string path = string.Format("flight_{0:yyyy-MM-dd-HH-mm}.ardrone", DateTime.Now);
            var stream = new FileStream(path, FileMode.OpenOrCreate);
            _packetRecorderWorker = new PacketRecorder(stream);
            _packetRecorderWorker.Start();

            _droneClient = new DroneClient();
            _droneClient.NavigationPacketAcquired += OnNavigationPacketAcquired;
            _droneClient.VideoPacketAcquired += OnVideoPacketAcquired;
            _droneClient.ConfigurationUpdated += OnConfigurationUpdated;
            _droneClient.Active = true;

            //tmrStateUpdate.Enabled = true;
            //tmrVideoUpdate.Enabled = true;

        }
Пример #9
0
        /// <summary>
        /// Initialize video processing
        /// </summary>
        private void InitializeVideo()
        {
            videoPacketDecoderWorker = new VideoPacketDecoderWorker(PixelFormat.BGR24, true, OnVideoPacketDecoded);
            videoPacketDecoderWorker.Start();
            videoPacketDecoderWorker.UnhandledException += UnhandledException;

            timerVideoUpdate.Enabled = true;
        }
Пример #10
0
    /// <summary>
    /// Use this for initialization
    /// </summary>
    void Start()
    {
        Debug.Log("Start DroneObserver");
        // initialize data array
        data = new byte[width*height*3];
        cameraTexture = new Texture2D (width, height);
        // Initialize drone
        videoPacketDecoderWorker = new VideoPacketDecoderWorker(PixelFormat.RGB24, true, OnVideoPacketDecoded);
        videoPacketDecoderWorker.Start();

        droneClient = new DroneClient ("192.168.1.1");
        //droneClient = new DroneClient ("127.0.0.1");
        droneClient.UnhandledException += HandleUnhandledException;
        droneClient.VideoPacketAcquired += OnVideoPacketAcquired;
        droneClient.NavigationDataAcquired += navData => navigationData = navData;

        droneClient.FlatTrim ();

        videoPacketDecoderWorker.UnhandledException += HandleUnhandledException;
        droneClient.Start ();

        Settings settings = new Settings ();
        settings.Video.Codec = VideoCodecType.H264_720P;
        droneClient.Send (settings);
        droneClient.AckControlAndWaitForConfirmation ();

        switchDroneCamera (AR.Drone.Client.Configuration.VideoChannelType.Horizontal);

        isDroneConnected = droneClient.IsConnected;

        if(!isDroneConnected){
            Debug.LogError("Drone not Connected. Retry!!!");
        }
        if(isDroneConnected){
            Debug.LogWarning("Drone Connected!!!");
        }

        // determine connection
        wlanClient = new WlanClient();
    }
Пример #11
0
        public MainForm()
        {
            InitializeComponent();
            InitComboBoxFlightType();

            videoPacketDecoderWorker = new VideoPacketDecoderWorker(PixelFormat.BGR24, true, OnVideoPacketDecoded);

            timerStateUpdate.Enabled = true;
            timerVideoUpdate.Enabled = true;

            videoPacketDecoderWorker.UnhandledException += UnhandledException;
        }