Esempio n. 1
0
        public NetworkSanityChecker(VideoDataRetriever videoDataRetriever,
                                    NavigationDataRetriever navigationDataRetriever,
                                    CommandSender commandSender,
                                    SupportedFirmwareVersion firmwareVersion)
        {
            this.videoDataRetriever      = videoDataRetriever;
            this.navigationDataRetriever = navigationDataRetriever;
            this.commandSender           = commandSender;

            this.firmwareVersion = firmwareVersion;
        }
        public NetworkSanityChecker(VideoDataRetriever videoDataRetriever,
                                    NavigationDataRetriever navigationDataRetriever,
                                    CommandSender commandSender,
                                    SupportedFirmwareVersion firmwareVersion)
        {
            this.videoDataRetriever = videoDataRetriever;
            this.navigationDataRetriever = navigationDataRetriever;
            this.commandSender = commandSender;

            this.firmwareVersion = firmwareVersion;
        }
Esempio n. 3
0
        private void CreateDroneWorkers()
        {
            networkConnector = new NetworkConnector(droneConfig.DroneNetworkIdentifierStart, droneConfig.StandardOwnIpAddress, droneConfig.DroneIpAddress);
            networkConnector.ConnectionStateChanged += networkConnector_ConnectionStateChanged;
            networkConnector.Error += networkWorker_Error;

            videoDataRetriever = new VideoDataRetriever(networkConnector, droneConfig.DroneIpAddress, droneConfig.VideoPort, droneConfig.TimeoutValue);
            videoDataRetriever.ConnectionStateChanged += networkWorker_ConnectionStateChanged;
            videoDataRetriever.Error += networkWorker_Error;

            navigationDataRetriever = new NavigationDataRetriever(networkConnector, droneConfig.DroneIpAddress, droneConfig.NavigationPort, droneConfig.TimeoutValue);
            navigationDataRetriever.ConnectionStateChanged += networkWorker_ConnectionStateChanged;
            navigationDataRetriever.Error += networkWorker_Error;

            commandSender = new CommandSender(networkConnector, droneConfig.DroneIpAddress, droneConfig.CommandPort, droneConfig.TimeoutValue, droneConfig.DefaultCameraMode);
            commandSender.ConnectionStateChanged += networkWorker_ConnectionStateChanged;
            commandSender.Error += networkWorker_Error;

            controlInfoRetriever = new ControlInfoRetriever(droneConfig.DroneIpAddress);

            // Interop between the different threads
            commandSender.DataRetriever = navigationDataRetriever;

            networkSanityChecker = new NetworkSanityChecker(videoDataRetriever, navigationDataRetriever, commandSender, droneConfig.FirmwareVersion);
            networkSanityChecker.SanityCheckComplete += networkSanityChecker_SanityChecked;
        }
Esempio n. 4
0
        private void CreateDroneWorkers()
        {
            if (MessageBox.Show("Please turn on your AR Drone. Make sure the LED's are green.\n\nMake sure your wireless adapter is turned on.\nYou do not have to be connected to the drone yet.\n\nAre you using an Parrot AR Drone 2.0?", "AR Drone 2.0?", MessageBoxButtons.YesNo) == DialogResult.Yes)
            {
                this.setDroneVersion(2);
            }
            else
            {
                this.setDroneVersion(1);
            }

            networkConnector = new NetworkConnector(droneConfig.DroneNetworkIdentifierStart, droneConfig.StandardOwnIpAddress, droneConfig.DroneIpAddress);
            networkConnector.ConnectionStateChanged += networkConnector_ConnectionStateChanged;
            networkConnector.Error += networkWorker_Error;

            videoDataRetriever = new VideoDataRetriever(networkConnector, droneConfig.DroneIpAddress, droneConfig.VideoPort, droneConfig.TimeoutValue);
            videoDataRetriever.ConnectionStateChanged += networkWorker_ConnectionStateChanged;
            videoDataRetriever.Error += networkWorker_Error;

            //ADDED THIS CODE!
            //gpsDataRetriever = new GPSDataRetriever(networkConnector, droneConfig.DroneIpAddress, droneConfig.GPSPort, droneConfig.TimeoutValue);
            //gpsDataRetriever.ConnectionStateChanged += networkWorker_ConnectionStateChanged;
            //gpsDataRetriever.Error += networkWorker_Error;

            navigationDataRetriever = new NavigationDataRetriever(networkConnector, droneConfig.DroneIpAddress, droneConfig.NavigationPort, droneConfig.TimeoutValue);
            navigationDataRetriever.ConnectionStateChanged += networkWorker_ConnectionStateChanged;
            navigationDataRetriever.Error += networkWorker_Error;

            commandSender = new CommandSender(networkConnector, droneConfig.DroneIpAddress, droneConfig.CommandPort, droneConfig.TimeoutValue, droneConfig.DefaultCameraMode);
            commandSender.ConnectionStateChanged += networkWorker_ConnectionStateChanged;
            commandSender.Error += networkWorker_Error;

            controlInfoRetriever = new ControlInfoRetriever(droneConfig.DroneIpAddress);

            // Interop between the different threads
            commandSender.DataRetriever = navigationDataRetriever;

            networkSanityChecker = new NetworkSanityChecker(videoDataRetriever, navigationDataRetriever, commandSender, droneConfig.FirmwareVersion);
            networkSanityChecker.SanityCheckComplete += networkSanityChecker_SanityChecked;
        }