Пример #1
0
        public override void ProcessResults(UAVBase core)
        {
            base.ProcessResults(core);
            try
            {
                foreach (UAVSingleParameter param in this.uavData)
                {
                    if (param.Value == null) param.Value = "";
                    UAVSingleParameter newparam = core.uavData.SilentUpdate(param.Name, param.Value, true);
                    if (newparam != null)
                    {
                       if (newparam.Parent is UAVStructure) ((UAVStructure)newparam.Parent).ValueChanged+=new UAVStructure.ValueChangedHandler(core.uavData.Value_ValueChanged);
                        newparam.Min = param.Min;
                        newparam.Max = param.Max;
                        newparam.updateRate = param.updateRate;
                        newparam.Parent = core.uavData.GetFromPath(param.Name.Substring(0,param.Name.LastIndexOf("\\")));
                        if (newparam.Parent == null) newparam.Parent = core;
                        if (newparam.Parent.Name == newparam.Name) newparam.Parent = core;
                    }
                    else
                    {
                        core.uavData.Add(param.Name, (UAVParameter)param.Clone());
                    }
                }
            }
            catch (Exception ex)
            {

            }
            core.initialised = true;
        }
Пример #2
0
 public virtual void ProcessResults(UAVBase core)
 {
     if (CommandCompleted != null)
     {
         CommandCompleted();
     }
 }
Пример #3
0
 public override void RemoteExecute(UAVBase core)
 {
     base.RemoteExecute(core);
     //   remoteuavData = core.uavData;
     uavData = HierachyItem.NormaliseUavData(core);
     Console.WriteLine("Anzahl der Punkte die gesendet werden:" + uavData.Count);
 }
Пример #4
0
 public static void AutoSave(object state)
 {
     Console.WriteLine("Autosaving UAV State to " + filename);
     if (uav != null)
     {
         Console.WriteLine("Events Per Second: Recieved " + uav.RecEventsPerSeond + " Sent " + uav.SendEventsPerSeond);
         if (uav != null)
         {
             try
             {
                 if (File.Exists(filename))
                 {
                     File.Delete(filename);
                 }
                 using (FileStream stream = File.OpenWrite(filename))
                 {
                     UAVBase.SaveValues(stream, uav);
                 }
             }
             catch (Exception ex) {
                 Console.WriteLine("Cannot save UAV State: " + ex.Message + ex.StackTrace.ToString());
             }
         }
     }
     else
     {
         Console.WriteLine("Cannot save UAV");
     }
 }
Пример #5
0
 public override void RemoteExecute(UAVBase core)
 {
     base.RemoteExecute(core);
     //   remoteuavData = core.uavData;
     uavData = HierachyItem.NormaliseUavData(core);
     Console.WriteLine("Anzahl der Punkte die gesendet werden:"+uavData.Count);
 }
Пример #6
0
        public override void RemoteExecute(UAVBase core)
        {
            base.RemoteExecute(core);

            core.uavData[parameter.Name].Min = parameter.Min;
            core.uavData[parameter.Name].Max = parameter.Max;
            core.uavData[parameter.Name].updateRate = parameter.updateRate;
        }
Пример #7
0
 public override void RemoteExecute(UAVBase core)
 {
     base.RemoteExecute(core);
     using (FileStream stream = File.OpenRead(Filename))
     {
         UAVBase.LoadValues(stream, core);
     }
 }
Пример #8
0
        public override void RemoteExecute(UAVBase core)
        {
            base.RemoteExecute(core);

            core.uavData[parameter.Name].Min        = parameter.Min;
            core.uavData[parameter.Name].Max        = parameter.Max;
            core.uavData[parameter.Name].updateRate = parameter.updateRate;
        }
Пример #9
0
 public override void RemoteExecute(UAVBase core)
 {
     base.RemoteExecute(core);
     using (FileStream stream = File.OpenRead(Filename))
     {
         UAVBase.LoadValues(stream, core);
     }
 }
Пример #10
0
        public virtual void Send(UAVBase core)
        {
            /// Wird vom Kommandogeber (sender) aufgerufen
               ///
               ///

               SendDate = DateTime.UtcNow;
               guid = Guid.NewGuid().ToString();
        }
Пример #11
0
        public virtual void Send(UAVBase core)
        {
            /// Wird vom Kommandogeber (sender) aufgerufen
            ///
            ///

            SendDate = DateTime.UtcNow;
            guid     = Guid.NewGuid().ToString();
        }
Пример #12
0
 public override void RemoteExecute(UAVBase core)
 {
     base.RemoteExecute(core);
     Process p = Process.Start("/bin/kill ");
     p.StartInfo.Arguments = Convert.ToString(pid);
     p.StartInfo.UseShellExecute = false;
     p.StartInfo.RedirectStandardOutput = true;
     p.Start();
     pid = p.Id;
 }
Пример #13
0
 public override void ProcessResults(UAVBase core)
 {
     base.ProcessResults(core);
     local = core;
     Process p = Process.Start("\\FFMpeg\\ffplay"," -i udp://"+targetip+"?localport="+targetPort);
     p.StartInfo.UseShellExecute = false;
     p.StartInfo.WindowStyle = ProcessWindowStyle.Normal;
     p.Exited += new EventHandler(Playerexited);
     p.Start();
 }
Пример #14
0
        public override void RemoteExecute(UAVBase core)
        {
            base.RemoteExecute(core);
            Process p = Process.Start("/bin/kill ");

            p.StartInfo.Arguments              = Convert.ToString(pid);
            p.StartInfo.UseShellExecute        = false;
            p.StartInfo.RedirectStandardOutput = true;
            p.Start();
            pid = p.Id;
        }
Пример #15
0
        public override void ProcessResults(UAVBase core)
        {
            base.ProcessResults(core);
            local = core;
            Process p = Process.Start("\\FFMpeg\\ffplay", " -i udp://" + targetip + "?localport=" + targetPort);

            p.StartInfo.UseShellExecute = false;
            p.StartInfo.WindowStyle     = ProcessWindowStyle.Normal;
            p.Exited += new EventHandler(Playerexited);
            p.Start();
        }
Пример #16
0
        public override void RemoteExecute(UAVBase core)
        {
            base.RemoteExecute(core);
               ///Start Encoder
            Console.WriteLine("Execute ffmpeg ");
               /// ffmpeg -an -f video4linux2 -s 640x480 -r 15 -i /dev/video0 -vcodec libx264 -preset ultrafast -tune zerolatency -x264opts "vbv-maxrate=2000:vbv-bufsize=200:slice-max-size=1500" -f h264 udp://localhost:1234
            Process p = Process.Start("/usr/bin/ffmpeg"," -an -f video4linux2 -s "+width+"x"+height+" -r "+fps+" -i /dev/video0 -vcodec libx264 -preset ultrafast -tune zerolatency -x264opts \"vbv-maxrate=2000:vbv-bufsize=200:slice-max-size=1500\" -f h264 udp://"+targetip+":"+targetPort);
            p.StartInfo.UseShellExecute = false;
            p.StartInfo.RedirectStandardOutput = true;
            p.Exited += new EventHandler(p_Exited);
            p.Start();

               			pid = p.Id;
            Console.WriteLine("Video Stream Started");
        }
Пример #17
0
 public override void RemoteExecute(UAVBase core)
 {
     base.RemoteExecute(core);
     if (filename == null)
     {
         filename = "rcuav.uav";
     }
     if (File.Exists(filename))
     {
         File.Delete(filename);
     }
     using (FileStream stream = File.OpenWrite(filename)){
         UAVBase.SaveValues(stream, core);
         Console.WriteLine("Save Command Recieved and Done");
     }
 }
Пример #18
0
        public override void RemoteExecute(UAVBase core)
        {
            base.RemoteExecute(core);
            ///Start Encoder
            Console.WriteLine("Execute ffmpeg ");
            /// ffmpeg -an -f video4linux2 -s 640x480 -r 15 -i /dev/video0 -vcodec libx264 -preset ultrafast -tune zerolatency -x264opts "vbv-maxrate=2000:vbv-bufsize=200:slice-max-size=1500" -f h264 udp://localhost:1234
            Process p = Process.Start("/usr/bin/ffmpeg", " -an -f video4linux2 -s " + width + "x" + height + " -r " + fps + " -i /dev/video0 -vcodec libx264 -preset ultrafast -tune zerolatency -x264opts \"vbv-maxrate=2000:vbv-bufsize=200:slice-max-size=1500\" -f h264 udp://" + targetip + ":" + targetPort);

            p.StartInfo.UseShellExecute        = false;
            p.StartInfo.RedirectStandardOutput = true;
            p.Exited += new EventHandler(p_Exited);
            p.Start();


            pid = p.Id;
            Console.WriteLine("Video Stream Started");
        }
Пример #19
0
 public override void ProcessResults(UAVBase core)
 {
     base.ProcessResults(core);
     try
     {
         foreach (UAVSingleParameter param in this.uavData)
         {
             if (param.Value == null)
             {
                 param.Value = "";
             }
             UAVSingleParameter newparam = core.uavData.SilentUpdate(param.Name, param.Value, true);
             if (newparam != null)
             {
                 if (newparam.Parent is UAVStructure)
                 {
                     ((UAVStructure)newparam.Parent).ValueChanged += new UAVStructure.ValueChangedHandler(core.uavData.Value_ValueChanged);
                 }
                 newparam.Min        = param.Min;
                 newparam.Max        = param.Max;
                 newparam.updateRate = param.updateRate;
                 newparam.Parent     = core.uavData.GetFromPath(param.Name.Substring(0, param.Name.LastIndexOf("\\")));
                 if (newparam.Parent == null)
                 {
                     newparam.Parent = core;
                 }
                 if (newparam.Parent.Name == newparam.Name)
                 {
                     newparam.Parent = core;
                 }
             }
             else
             {
                 core.uavData.Add(param.Name, (UAVParameter)param.Clone());
             }
         }
     }
     catch (Exception ex)
     {
     }
     core.initialised = true;
 }
Пример #20
0
 public override void RemoteExecute(UAVBase core)
 {
     base.RemoteExecute(core);
     files = Directory.GetFiles(Path, Pattern);
 }
Пример #21
0
 /// <summary>
 /// Endpunkt Abbild einpacken
 /// </summary>
 /// <param name="core"></param>
 public override void ProcessResults(UAVBase core)
 {
     base.ProcessResults(core);
 }
Пример #22
0
 public override void ProcessResults(UAVBase core)
 {
     base.ProcessResults(core);
 }
Пример #23
0
 public override void Send(UAVBase core)
 {
     base.Send(core);
 }
Пример #24
0
 public override void RemoteExecute(UAVBase core)
 {
     base.RemoteExecute(core);
     core.WriteToLog(sourceName, "FlightLog", logLine);
 }
Пример #25
0
 /// <summary>
 /// Endpunkte Abbild einpacken
 /// </summary>
 /// <param name="core"></param>
 public override void RemoteExecute(UAVBase core)
 {
     base.RemoteExecute(core);
      knownEndpoints = core.knownEndpoints;
 }
Пример #26
0
 /// <summary>
 /// EndpunktImage einpacken
 /// </summary>
 /// <param name="core"></param>
 public override void Send(UAVBase core)
 {
     base.Send(core);
 }
Пример #27
0
 public override void Send(UAVBase core)
 {
     base.Send(core);
     sourceName = "UAV";
 }
Пример #28
0
 /// <summary>
 /// Endpunktimage anwenden
 /// </summary>
 /// <param name="core"></param>
 public override void RemoteExecute(UAVBase core)
 {
     base.RemoteExecute(core);
 }
Пример #29
0
 /// <summary>
 /// Endpunktimage anwenden
 /// </summary>
 /// <param name="core"></param>
 public override void RemoteExecute(UAVBase core)
 {
     base.RemoteExecute(core);
 }
Пример #30
0
 // Wird automatisch vom Kommandoempfänger aufgerufen
 public virtual void RemoteExecute(UAVBase core)
 {
     SendDate = DateTime.UtcNow;
 }
Пример #31
0
 public override void RemoteExecute(UAVBase core)
 {
     base.RemoteExecute(core);
     // ((FlightControlCommons.components.WaypointMissionControl)core.uavData[MissionControlName]).Waypoints = waypoints;
 }
Пример #32
0
        static void Main(string[] args)
        {
            if (System.Threading.Thread.CurrentThread.CurrentCulture.Name != "en-US")
            {
                System.Threading.Thread.CurrentThread.CurrentCulture = new
                                                                       System.Globalization.CultureInfo("en-US");
            }
            Double i    = -49;
            object test = i;

            Console.Write("Running on " + Convert.ToDouble(test));
            if (FlightControlCommons.UsbHelper.IsLinux)
            {
                Console.WriteLine("Linux");
            }
            else
            {
                Console.WriteLine("Windows");
            }

            Console.WriteLine("Flight Control Service");
            Console.WriteLine("Controls the UAV");
            Console.WriteLine("");

            string autosavetimestr = ConfigurationSettings.AppSettings ["AutoSaveTime"];

            if (Int32.TryParse(autosavetimestr, out autoSaveTime))
            {
                autoSaveTimer = new Timer(new TimerCallback(Program.AutoSave), null, 10000, autoSaveTime);
                Console.WriteLine("AutoSaveTimer Set from Config File!");
            }

            filename = ConfigurationSettings.AppSettings ["UAVFilename"];
            bool loadFromFile = false;

            try {
                loadFromFile = Convert.ToBoolean(ConfigurationSettings.AppSettings ["LoadSettingsFromFile"]);
            } catch (Exception ex) {
                Console.WriteLine("Can not parse LoadSettingsFromFile in Config File");
            }


            uav = new VTOLUAV();



            Console.WriteLine("Connecting to GroundControl..");
            if (Convert.ToBoolean(ConfigurationSettings.AppSettings ["WLAN"]))
            {
                // Baue Kommunikationskanal für Befehle in beide Richtungen auf
                TCPCommunicationEndPoint controlconnection = new TCPCommunicationEndPoint();
                controlconnection.commType       = CommunicationEndpoint.Communicationtype.Command;
                controlconnection.endpointAdress = ConfigurationSettings.AppSettings ["GroundIP"];                 // IP Addresse der Gegenstelle (Groundkontroll)
                controlconnection.endpointPort   = Convert.ToInt32(ConfigurationSettings.AppSettings ["GroundCommandPort"]);
                /// Kommunikationskanal muss auf beiden seiten gleich sein
                controlconnection.endpointSpeedType = CommunicationEndpoint.SpeedType.Wifi; // Geschwindigkeit
                controlconnection.listen            = false;                                // einer muss verbindungen annehmen (Server) der andere hinverbinden (Connect)
                controlconnection.cmdHandler        = uav;
                uav.knownEndpoints.Add(controlconnection);                                  // Aktiviere Kommunikationskanal
            }
            if (Convert.ToBoolean(ConfigurationSettings.AppSettings ["VPN"]))
            {
                // Baue Kommunikationskanal für Empfang von Werten von der Bodenstation
                TCPCommunicationEndPoint recieveConnection1 = new TCPCommunicationEndPoint();
                recieveConnection1.commType          = CommunicationEndpoint.Communicationtype.Send;
                recieveConnection1.endpointAdress    = ConfigurationSettings.AppSettings ["VPNGroundIP"];
                recieveConnection1.endpointPort      = Convert.ToInt32(ConfigurationSettings.AppSettings ["VPNSendPort"]);
                recieveConnection1.endpointSpeedType = CommunicationEndpoint.SpeedType.Gprs3G;
                recieveConnection1.listen            = false;
                uav.knownEndpoints.Add(recieveConnection1);

                // Baue Kommunikationskanal für das Senden von Werten zur Bodenstation auf
                TCPCommunicationEndPoint sendConnection1 = new TCPCommunicationEndPoint();
                sendConnection1.commType          = CommunicationEndpoint.Communicationtype.Recieve;
                sendConnection1.endpointAdress    = ConfigurationSettings.AppSettings ["VPNGroundIP"];
                sendConnection1.endpointPort      = Convert.ToInt32(ConfigurationSettings.AppSettings ["VPNRecievePort"]);
                sendConnection1.endpointSpeedType = CommunicationEndpoint.SpeedType.Gprs3G;
                sendConnection1.listen            = false;
                uav.knownEndpoints.Add(sendConnection1);
            }
            if (Convert.ToBoolean(ConfigurationSettings.AppSettings ["WLAN"]))
            {
                TCPCommunicationEndPoint recieveConnection = new TCPCommunicationEndPoint();
                recieveConnection.commType          = CommunicationEndpoint.Communicationtype.Send;
                recieveConnection.endpointAdress    = ConfigurationSettings.AppSettings ["GroundIP"];
                recieveConnection.endpointPort      = Convert.ToInt32(ConfigurationSettings.AppSettings ["SendPort"]);
                recieveConnection.endpointSpeedType = CommunicationEndpoint.SpeedType.Wifi;
                recieveConnection.listen            = false;
                uav.knownEndpoints.Add(recieveConnection);

                // Baue Kommunikationskanal für das Senden von Werten zur Bodenstation auf
                TCPCommunicationEndPoint sendConnection = new TCPCommunicationEndPoint();
                sendConnection.commType          = CommunicationEndpoint.Communicationtype.Recieve;
                sendConnection.endpointAdress    = ConfigurationSettings.AppSettings ["GroundIP"];
                sendConnection.endpointPort      = Convert.ToInt32(ConfigurationSettings.AppSettings ["RecievePort"]);
                sendConnection.endpointSpeedType = CommunicationEndpoint.SpeedType.Wifi;
                sendConnection.listen            = false;
                uav.knownEndpoints.Add(sendConnection);
            }



            if (loadFromFile)
            {
                if (File.Exists(filename))
                {
                    try
                    {
                        Console.WriteLine("Load Values from File");
                        using (FileStream stream = File.OpenRead(filename))
                        {
                            UAVBase.LoadValues(stream, uav);
                        }
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine("Fehler beim Einlesen der Config Datei " + filename);
                        File.Delete(filename);
                        throw ex;
                    }
                }
            }

            uav.OnLoad(); //Load all non serialised objects from uav and connect to hardware


            uav.run();
        }
Пример #33
0
 public virtual void RemoteExecute(UAVBase core) // Wird automatisch vom Kommandoempfänger aufgerufen
 {
     SendDate = DateTime.UtcNow;
 }
Пример #34
0
 public override void RemoteExecute(UAVBase core)
 {
     base.RemoteExecute(core);
     files = Directory.GetFiles(Path, Pattern);
 }
Пример #35
0
 public virtual void ProcessResults(UAVBase core)
 {
     if (CommandCompleted != null) CommandCompleted();
 }
Пример #36
0
 /// <summary>
 /// Endpunkte Abbild einpacken
 /// </summary>
 /// <param name="core"></param>
 public override void RemoteExecute(UAVBase core)
 {
     base.RemoteExecute(core);
     knownEndpoints = core.knownEndpoints;
 }
Пример #37
0
 public _3DViewer(UAVCommons.UAVBase uAVBase)
 {
     this.mycore = uAVBase;
     InitializeComponent();
 }
Пример #38
0
        static void Main(string[] args)
        {
            //	PWM test = new PWM("",0,"",0);

            //	return;
            Console.Write("Running on ");
            if (FlightControlCommons.UsbHelper.IsLinux)
            {
                Console.WriteLine("Linux");
            }
            else
            {
                Console.WriteLine("Windows");
            }


            Console.WriteLine("Flight Control Service");
            Console.WriteLine("Controls the UAV");
            Console.WriteLine("");

            string autosavetimestr = ConfigurationSettings.AppSettings ["AutoSaveTime"];

            if (Int32.TryParse(autosavetimestr, out autoSaveTime))
            {
                autoSaveTimer = new Timer(new TimerCallback(Program.AutoSave), null, 10000, autoSaveTime);
                Console.WriteLine("AutoSaveTimer Set from Config File!");
            }

            filename = ConfigurationSettings.AppSettings ["UAVFilename"];
            bool loadFromFile = false;

            try {
                loadFromFile = Convert.ToBoolean(ConfigurationSettings.AppSettings ["LoadSettingsFromFile"]);
            } catch (Exception ex) {
                Console.WriteLine("Can not parse LoadSettingsFromFile in Config File");
            }


            uav = new VTOLUAV();



            Console.WriteLine("Connecting to GroundControl..");
            if (Convert.ToBoolean(ConfigurationSettings.AppSettings ["WLAN"]))
            {
                // Baue Kommunikationskanal für Befehle in beide Richtungen auf
                TCPCommunicationEndPoint controlconnection = new TCPCommunicationEndPoint();
                controlconnection.commType       = CommunicationEndpoint.Communicationtype.Command;
                controlconnection.endpointAdress = ConfigurationSettings.AppSettings ["GroundIP"];                 // IP Addresse der Gegenstelle (Groundkontroll)
                controlconnection.endpointPort   = Convert.ToInt32(ConfigurationSettings.AppSettings ["GroundCommandPort"]);
                /// Kommunikationskanal muss auf beiden seiten gleich sein
                controlconnection.endpointSpeedType = CommunicationEndpoint.SpeedType.Wifi; // Geschwindigkeit
                controlconnection.listen            = false;                                // einer muss verbindungen annehmen (Server) der andere hinverbinden (Connect)
                controlconnection.cmdHandler        = uav;
                uav.knownEndpoints.Add(controlconnection);                                  // Aktiviere Kommunikationskanal
            }
            if (Convert.ToBoolean(ConfigurationSettings.AppSettings ["VPN"]))
            {
                // Baue Kommunikationskanal für Empfang von Werten von der Bodenstation
                TCPCommunicationEndPoint recieveConnection1 = new TCPCommunicationEndPoint();
                recieveConnection1.commType          = CommunicationEndpoint.Communicationtype.Send;
                recieveConnection1.endpointAdress    = ConfigurationSettings.AppSettings ["VPNGroundIP"];
                recieveConnection1.endpointPort      = Convert.ToInt32(ConfigurationSettings.AppSettings ["VPNSendPort"]);
                recieveConnection1.endpointSpeedType = CommunicationEndpoint.SpeedType.Gprs3G;
                recieveConnection1.listen            = false;
                uav.knownEndpoints.Add(recieveConnection1);

                // Baue Kommunikationskanal für das Senden von Werten zur Bodenstation auf
                TCPCommunicationEndPoint sendConnection1 = new TCPCommunicationEndPoint();
                sendConnection1.commType          = CommunicationEndpoint.Communicationtype.Recieve;
                sendConnection1.endpointAdress    = ConfigurationSettings.AppSettings ["VPNGroundIP"];
                sendConnection1.endpointPort      = Convert.ToInt32(ConfigurationSettings.AppSettings ["VPNRecievePort"]);
                sendConnection1.endpointSpeedType = CommunicationEndpoint.SpeedType.Gprs3G;
                sendConnection1.listen            = false;
                uav.knownEndpoints.Add(sendConnection1);
            }
            if (Convert.ToBoolean(ConfigurationSettings.AppSettings ["WLAN"]))
            {
                TCPCommunicationEndPoint recieveConnection = new TCPCommunicationEndPoint();
                recieveConnection.commType          = CommunicationEndpoint.Communicationtype.Send;
                recieveConnection.endpointAdress    = ConfigurationSettings.AppSettings ["GroundIP"];
                recieveConnection.endpointPort      = Convert.ToInt32(ConfigurationSettings.AppSettings ["SendPort"]);
                recieveConnection.endpointSpeedType = CommunicationEndpoint.SpeedType.Wifi;
                recieveConnection.listen            = false;
                uav.knownEndpoints.Add(recieveConnection);

                // Baue Kommunikationskanal für das Senden von Werten zur Bodenstation auf
                TCPCommunicationEndPoint sendConnection = new TCPCommunicationEndPoint();
                sendConnection.commType          = CommunicationEndpoint.Communicationtype.Recieve;
                sendConnection.endpointAdress    = ConfigurationSettings.AppSettings ["GroundIP"];
                sendConnection.endpointPort      = Convert.ToInt32(ConfigurationSettings.AppSettings ["RecievePort"]);
                sendConnection.endpointSpeedType = CommunicationEndpoint.SpeedType.Wifi;
                sendConnection.listen            = false;
                uav.knownEndpoints.Add(sendConnection);
            }



            uav.OnLoad();              //Load all non serialised objects from uav and connect to hardware

            uav.run();
        }