示例#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
	// 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();
	}
示例#3
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();
        }
示例#4
0
        public SettingsForm(DroneClient droneClient)
        {
            this.droneClient = droneClient;

            InitializeComponent();

            ReadDroneConfig();

            keyboardSettingsBindingSource.Add(KeyboardSettings.Default);
            myoSettingsBindingSource.Add(MyoSettings.Default);
        }
示例#5
0
文件: Input.cs 项目: Rutoka/AR.Drone
 /// <summary>
 /// Sends the command with its parameters to a provided DroneClient
 /// </summary>
 /// <param name="aDroneClient">Drone client to the the command to</param>
 public void Send(DroneClient aDroneClient)
 {
     switch (Command)
     {
         case Type.Progress: aDroneClient.Progress(ProgressMode, roll: Roll, pitch: Pitch, yaw: Yaw, gaz: Gaz); break;
         case Type.Takeoff: aDroneClient.Takeoff(); break;
         case Type.Hover: aDroneClient.Hover(); break;
         case Type.Land: aDroneClient.Land(); break;
         case Type.Emergency: aDroneClient.Emergency(); break;
         case Type.ResetEmergency: aDroneClient.ResetEmergency(); break;
         case Type.FlatTrim: aDroneClient.FlatTrim(); break;
     }
 }
示例#6
0
        public Model()
        {
            PointPer = -1;
            ControlFlag = false;
            Polygons = new MyDefPoint[4];
            PolygonCenter = new MyDefPoint();
            Quadcopter = null;
            QuadcopterCenter = new MyDefPoint();
            QuadcopterTailCenter = new MyDefPoint();
            _droneClient = new DroneClient("192.168.1.1");
            _droneClient.Start();

            ThreadStart start3 = new ThreadStart(PlaneMotion);
            _planeMotionThread = new Thread(start3);
            _planeMotionThread.Start();
        }
示例#7
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();
        }
示例#8
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;
        }
示例#9
0
        public MainForm()
        {
            InitializeComponent();

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

            string path = string.Format("flight_{0:yyyy-MM-dd-HH-mm}.ardrone", DateTime.Now);
            _packetRecorderWorker = new PacketRecorderWorker(path);
            _packetRecorderWorker.Start();

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

            tmrStateUpdate.Enabled = true;
            tmrVideoUpdate.Enabled = true;
        }
示例#10
0
        public MainForm()
        {
            InitializeComponent();

            uISettingsBindingSource.Add(UISettings.Default);

            droneClient = new DroneClient();
            droneClient.NavigationDataAcquired += data => navigationData = data;
            droneClient.VideoPacketAcquired += OnVideoPacketAcquired;
            droneClient.Start();

            InitializeVideo();

            LoadFontAwesome();
            InitInput();

            timerInput.Enabled = true;
            timerStatusUpdate.Enabled = true;
        }
        public MainWindow()
        {
            InitializeComponent();
            DataContext = this;
            _selectedController = XboxController.RetrieveController(0);
            _selectedController.StateChanged += _selectedController_StateChanged;

            _droneClient = new DroneClient("192.168.1.1");

            _droneClient.Start();

            _droneClient.NavigationPacketAcquired += OnNavigationPacketAcquired;
            _droneClient.NavigationDataAcquired += ProcessNavigationData;

            _droneClient.FlatTrim();

            _timer = new System.Timers.Timer(50);
            _timer.Elapsed += _timer_Elapsed;
            _timer.Start();

            XboxController.StartPolling();
        }
示例#12
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;
        }
示例#13
0
        private void OnButtonActivateClicked(object sender, EventArgs e)
        {
            if (IsIpAddress(textBoxHost.Text))
                hostname = textBoxHost.Text;

            droneClient = new DroneClient(hostname);

            droneClient.NavigationPacketAcquired += OnNavigationPacketAcquired;
            droneClient.VideoPacketAcquired += OnVideoPacketAcquired;
            droneClient.NavigationDataAcquired += data => navigationData = data;

            droneClient.Start();
            videoPacketDecoderWorker.Start();

            buttonActivate.Enabled = false;
            textBoxHost.Enabled = false;
            buttonDeactivate.Enabled = true;
            groupBoxControlPanel.Enabled = true;
            pictureBoxVideo.Enabled = true;
            buttonSwitchCamera.Enabled = true;
        }
示例#14
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;

        }
示例#15
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();
    }
示例#16
0
 public DroneCommunicator()
 {
     _client = new DroneClient("192.168.1.248");
     _commandReceiver = new CommandReceiver();
     _commandReceiver.CommandReceived += CommandReceiverOnCommandReceived;
 }
示例#17
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            InitializeLocationManager();

            SetContentView(Resource.Layout.Main);

            FindViewById<Button>(Resource.Id.MyButtonLand).Click += LandButtonClick;
            FindViewById<Button>(Resource.Id.ButtonEmergency).Click += EmergencyButtonClicked;
            FindViewById<Button>(Resource.Id.buttonReset).Click += (sender, args) => _client.ResetEmergency();
            _checkBox = FindViewById<CheckBox>(Resource.Id.executeCommandsCheckBox);
            _checkBox.CheckedChange += CheckBoxOnCheckedChange;

            _logTextView = FindViewById<TextView>(Resource.Id.logTextView);
            _dronStateTextView = FindViewById<TextView>(Resource.Id.droneStateTextView);
            _websocketTextView = FindViewById<TextView>(Resource.Id.serviceStateTextView);

            _client = new DroneClient("192.168.1.248");
            _client.Start();

            //_client.NavigationDataAcquired += ClientOnNavigationDataAcquired;

            _receiver = new CommandReceiver();
            _receiver.CommandReceived += ReceiverOnCommandReceived;
            _receiver.WebSocketStateChanged += ReceiverOnWebSocketStateChanged;
            _receiver.Start();

            var droneConnectionChecker = new Thread(ConnectionCheckRunner) {Name = "Drone Checker"};
            droneConnectionChecker.Start();
        }
示例#18
0
 /// <summary>
 /// Initializes the Autopilot object and associates it with provided DroneClient
 /// </summary>
 /// <param name="aDroneClient">DroneClient object which Autopilot will be controlling</param>
 /// <remarks>Using this constructor will force DeafultObjective to be 'Hover'</remarks>
 public Autopilot(DroneClient aDroneClient)
     : this(aDroneClient, new AR.Drone.Avionics.Objectives.Hover(Expiration.Never))
 {
     /* Do Nothing */
 }
示例#19
0
 public DroneController(DroneClient client)
 {
     _client = client;
 }
示例#20
0
 public DroneController()
 {
     _client = new DroneClient("192.168.1.1");
 }
示例#21
0
 /// <summary>
 /// Initializes the Autopilot object and associates it with provided DroneClient
 /// </summary>
 /// <param name="aDroneClient">DroneClient object which Autopilot will be controlling</param>
 /// <remarks>Using this constructor will force DeafultObjective to be 'Hover'</remarks>
 public Autopilot(DroneClient aDroneClient) : this(aDroneClient, new Hover(Expiration.Never))
 {
     /* Do Nothing */
 }
示例#22
0
        /// <summary>
        /// Initializes the Autopilot object and associates it with provided DroneClient and sets DeafultObjective
        /// </summary>
        /// <param name="aDroneClient">DroneClient object which Autopilot will be controlling</param>
        /// <param name="aDefaultObjective">DefaultObjective to execute when ObjectiveQeueue is depleted</param>
        /// <remarks>Using this constructor will force DeafultObjective to be 'Hover'</remarks>
        public Autopilot(DroneClient aDroneClient, Objective aDefaultObjective)
        {
            DroneClient = aDroneClient;
            DefaultObjective = aDefaultObjective;

            ObjectiveQueue = new ConcurrentQueue<Objective>();
            ApparatusOutputQueue = new ConcurrentQueue<Apparatus.Output>();

            BoundToClient = false;
        }