internal void connectToDrone() { DroneControllerConfiguration droneControllerConfiguration = new DroneControllerConfiguration(); droneControllerConfiguration.EnableNavigationDataThread = false; droneControllerConfiguration.EnableVideoStreamThread = true; droneControllerConfiguration.EnableATCommandThread = true;; droneControllerConfiguration.EnableControlInfoThread = false; droneControllerConfiguration.EnableATCommandSimulation = false; droneControllerConfiguration.DroneIpAddress = "192.168.1.1"; droneController = null; // ensure null for creation (removed set = null in disconect) droneController = new DroneController.DroneController(droneControllerConfiguration); droneController.IsMoving = true; droneController.TraceNotificationLevel = TraceNotificationLevel.Verbose; droneController.OnNotifyTraceMessage += new EventHandler <TraceNotificationEventArgs>(droneController_OnNotifyTraceMessage); droneController.OnNotifyVideoMessage += new EventHandler <VideoNotificationEventArgs>(droneController_OnNotifyVideoMessage); droneController.OnNotifyDroneInfoMessage += new EventHandler <DroneInfoNotificationEventArgs>(droneController_OnNotifyDroneInfoMessage); droneController.OnConnectionStatusChanged += new EventHandler <ConnectionStatusChangedEventArgs>(droneController_OnConnectionStatusChanged); droneController.Connect(); while (droneController.ConnectionStatus != ConnectionStatus.Open) { Thread.Sleep(100); } droneController.SetConfiguration("control:euler_angle_max", MathHelper.ToRadians(10).ToString()); droneController.SetConfiguration("control:control_iphone_tilt", "1"); droneController.SetConfiguration("control:altitude_max", (App.Current as App).Config.MaxAltitude.ToString()); droneController.SetConfiguration("control:control_vz_max", (App.Current as App).Config.VerticalSpeed.ToString()); droneController.SetConfiguration("control:control_yaw", MathHelper.ToRadians(200).ToString()); }
internal void disconnectFromDrone() { droneController.Disconnect(); droneController = null; }
internal void disconnectFromDrone() { droneController.Disconnect(); droneController = null; }
internal void connectToDrone() { DroneControllerConfiguration droneControllerConfiguration = new DroneControllerConfiguration(); droneControllerConfiguration.EnableNavigationDataThread = false; droneControllerConfiguration.EnableVideoStreamThread = true; droneControllerConfiguration.EnableGPSStreamThread = false; droneControllerConfiguration.EnableATCommandThread = true; droneControllerConfiguration.EnableControlInfoThread = false; droneControllerConfiguration.EnableATCommandSimulation = false; droneControllerConfiguration.DroneIpAddress = IPBox.Text; droneController = null; // ensure null for creation (removed set = null in disconect) droneController = new DroneController.DroneController(droneControllerConfiguration); droneController.IsMoving = true; droneController.TraceNotificationLevel = TraceNotificationLevel.Verbose; droneController.OnNotifyTraceMessage += new EventHandler<TraceNotificationEventArgs>(droneController_OnNotifyTraceMessage); droneController.OnNotifyVideoMessage += new EventHandler<VideoNotificationEventArgs>(droneController_OnNotifyVideoMessage); droneController.OnNotifyGPSMessage += new EventHandler<GPSNotificationEventArgs>(droneController_OnNotifyGPSMessage); droneController.OnNotifyDroneInfoMessage += new EventHandler<DroneInfoNotificationEventArgs>(droneController_OnNotifyDroneInfoMessage); droneController.OnConnectionStatusChanged += new EventHandler<ConnectionStatusChangedEventArgs>(droneController_OnConnectionStatusChanged); droneController.Connect(); while (droneController.ConnectionStatus != ConnectionStatus.Open) Thread.Sleep(100); droneController.SetConfiguration("control:euler_angle_max", MathHelper.ToRadians((App.Current as App).Config.EulerAngleMax).ToString()); droneController.SetConfiguration("control:control_iphone_tilt", "1"); droneController.SetConfiguration("control:altitude_max", (App.Current as App).Config.MaxAltitude.ToString()); droneController.SetConfiguration("control:control_vz_max", (App.Current as App).Config.VerticalSpeed.ToString()); droneController.SetConfiguration("control:control_yaw", MathHelper.ToRadians(200).ToString()); verticalSpeed = 1.0f; yawSpeed = MathHelper.ToRadians((App.Current as App).Config.YawSpeed) / MathHelper.ToRadians(200); }
internal static void RegisterController(DroneController droneController) { Controller = droneController; DroneProxy = droneController.DroneProxy; }