Beispiel #1
0
        private void Goto(SWaypoint targetWaypoint)
        {
            SCommGotoExecute gotoExecuteCmd = new SCommGotoExecute();

            gotoExecuteCmd.Command = 0x01; // execute GOTO
            gotoExecuteCmd.TargetWaypoint.Altitude  = targetWaypoint.Altitude;
            gotoExecuteCmd.TargetWaypoint.Longitude = (int)(targetWaypoint.Longitude * 1e7);
            gotoExecuteCmd.TargetWaypoint.Latitude  = (int)(targetWaypoint.Latitude * 1e7);

            // Send
            byte[] toSend = Comm.GetBytes(gotoExecuteCmd);
            formMain.SendData(0x80, toSend);
        }
Beispiel #2
0
        public void ExecuteOrbit(SWaypoint targetCenter, float velocity)
        {
            SCommGotoExecute executeOrbitCmd = new SCommGotoExecute();

            executeOrbitCmd.Command = 0x03; // execute orbit
            executeOrbitCmd.TargetWaypoint.Altitude  = targetCenter.Altitude;
            executeOrbitCmd.TargetWaypoint.Longitude = (int)(targetCenter.Longitude * 1e7);
            executeOrbitCmd.TargetWaypoint.Latitude  = (int)(targetCenter.Latitude * 1e7);
            executeOrbitCmd.Velocity = velocity;

            // Send
            byte[] toSend = Comm.GetBytes(executeOrbitCmd);
            formMain.SendData(0x80, toSend);
        }
Beispiel #3
0
        public void LoadWaypoints()
        {
            Waypoints.Clear();
            try
            {
                StreamReader sr = File.OpenText("waypoints.txt");
                while (!sr.EndOfStream)
                {
                    string    s = sr.ReadLine();
                    string[]  t = s.Split(' ');
                    SWaypoint w = new SWaypoint();
                    w.Altitude  = float.Parse(t[0]);
                    w.Latitude  = double.Parse(t[1]);
                    w.Longitude = double.Parse(t[2]);

                    Waypoints.Add(w);
                }
                sr.Close();
                FillWaypointList(0);
            }
            catch (Exception)
            { }
        }