Ejemplo n.º 1
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();
        }
Ejemplo n.º 2
0
        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();
        }
        private void btn_link_Click(object sender, RoutedEventArgs e)
        {
            string host = tb_ip.Text;

            if (host.Equals(""))
            {
                DroneClient drone = new DroneClient();
                MainForm    form  = new MainForm(drone);
                drone.Start();
                _drones.Add(drone);

                WindowInteropHelper helper = new WindowInteropHelper(this);

                form.Show(new WindowWrapper(helper.Handle));
            }
            else
            {
                DroneClient drone = new DroneClient(host);
                MainForm    form  = new MainForm(drone);
                drone.Start();
                _drones.Add(drone);

                WindowInteropHelper helper = new WindowInteropHelper(this);

                form.Show(new WindowWrapper(helper.Handle));
            }
        }
Ejemplo n.º 4
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();
    }
Ejemplo n.º 5
0
 private void StreamButton_Click(object sender, RoutedEventArgs e)
 {
     if (droneClient == null)
     {
         configDrone();
     }
     droneClient.Start();
 }
Ejemplo n.º 6
0
        void CommandConnect()
        {
            Debug("Connecting ...");

            _droneClient.Start();
            tmrVideoUpdate.Start();
            tmrStatusUpdate.Start();

            InitConfig();
        }
Ejemplo n.º 7
0
 /// <summary>
 /// Activates the drone
 /// </summary>
 /// <returns>Boolean Value whether the command works properly</returns>
 public bool Start()
 {
     try
     {
         _client.Start();
         return(true);
     }
     catch (Exception)
     {
         return(false);
     }
 }
Ejemplo n.º 8
0
        static void Main(string[] args)
        {
            DroneClient drone = new DroneClient();

            drone.NavigationDataAcquired += HandleNavigationDataAcquired;

            JoystickFlightController controller = new JoystickFlightController();

            controller.Client = drone;
            drone.Start();
            drone.FlatTrim();
            controller.Start();
        }
Ejemplo n.º 9
0
        public MainForm()
        {
            InitializeComponent();

            // innitialize video packet decoder.
            videoDecoder = new VideoPacketDecoderWorker(PixelFormat.BGR24, true, OnFrameDecoded);
            videoDecoder.UnhandledException += VideoDecoder_UnhandledException;
            videoDecoder.Start();

            // Initalize drone.
            drone = new DroneClient();
            drone.VideoPacketAcquired += OnVideoPacketAqcuired;
            drone.Start();
            drone.ResetEmergency();
            drone.FlatTrim();


            JoystickFlightController controller = new JoystickFlightController();

            controller.Client = drone;
            controller.Start();

            /*
             * // Initialize joystick.
             * joystick = new JoystickDevice();
             * joystick.InputReceived += Joystick_InputReceived;
             * joystick.Initialize("/dev/input/js0");
             *
             * // Initialize height maintainer.
             * heightMaintainer = new HeightMaintainer();
             *          heightMaintainer.TargetHeight = 0.25f; //meter
             *
             * // Initialize velocity maintainer.
             * velocityMaintainer = new VelocityMaintainer();
             *          velocityMaintainer.TargetVelocity.Forward = -1.0f;
             * velocityMaintainer.TargetVelocity.Left = 0.0f;
             * velocityMaintainer.TargetVelocity.TurnLeft = 0.0f;
             *
             * // Initialize flight controller.
             * controller = new CompositeFlightController();
             * controller.Drone = drone;
             * controller.FlightBehaviors.Add(velocityMaintainer);
             * controller.FlightBehaviors.Add(heightMaintainer);
             *          controller.FlightBehaviors.Add(new JoystickBehavior(joystick));
             * controller.ControlCycleStarting += () => joystick.ProcessEvents();
             *
             * controller.Start();
             */

            videoTimer.Enabled = true;
        }
Ejemplo n.º 10
0
        private string execute(string command)
        {
            string actions = "";

            switch (command)
            {
            case "Start":
                _droneClient.Start();
                actions += command + " ";
                break;
            }

            return("Failed");
        }
Ejemplo n.º 11
0
        static void ConnectDrone()
        {
            Console.WriteLine("Connecting to drone... ");
            drone = new DroneClient();
            drone.Start();
            Thread.Sleep(2000);
            Console.WriteLine("Done connecting to drone...");
            drone.ResetEmergency();
            drone.FlatTrim();

            if (args.Contains("--enable-video"))
            {
                StartVideo(drone);
            }
        }
Ejemplo n.º 12
0
 public void Start()
 {
     _client.Start();
     // _client.FlatTrim();
     if (_client.IsActive == true)
     {
         Console.WriteLine("actived");
     }
     if (_client.IsAlive == true)
     {
         Console.WriteLine("alived");
     }
     if (_client.IsConnected == true)
     {
         Console.WriteLine("connected");
     }
 }
Ejemplo n.º 13
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();
    }
Ejemplo n.º 14
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;
        }
Ejemplo n.º 15
0
 /// <summary>
 /// This method will start the drone
 /// </summary>
 /// <param name="time"></param>
 public void Start(int time = 1000)
 {
     Console.WriteLine("Start");
     _droneClient.Start();
     System.Threading.Thread.Sleep(time);
 }
 void btnActivate_Click(object sender, RoutedEventArgs e)
 {
     _droneClient.Start();
 }
Ejemplo n.º 17
0
 public void Start()
 {
     _client.Start();
     _client.FlatTrim();
 }
Ejemplo n.º 18
0
 private void btnStart_Click(object sender, EventArgs e)
 {
     _droneClient.Start();
 }
Ejemplo n.º 19
0
 public void Start()
 {
     _client.Start();
     _commandReceiver.Start();
 }
Ejemplo n.º 20
0
 public void Start()
 {
     droneClient.Start();
     droneClient.Takeoff();
 }
Ejemplo n.º 21
0
 private void Activate_Click(object sender, RoutedEventArgs e)
 {
     droneClient.Start();
 }