Beispiel #1
0
        private static Satellite SelectVisibleSatellite(List <Satellite> satellites, GroundStation gs, Angle minAngle)
        {
            var visible = new List <Satellite>();

            visible.Clear();
            Console.Clear();

            foreach (var satellite in satellites)
            {
                var satPos = satellite.Predict();
                if (gs.IsVisible(satPos, minAngle, satPos.Time))
                {
                    visible.Add(satellite);
                }
            }

            for (var i = 0; i < visible.Count; i++)
            {
                var sat = visible[i];
                Console.WriteLine($"[{i}] {sat.Name}");
            }

            string input;
            int    selectedSatellite;

            do
            {
                Console.Write("> ");
                input = Console.ReadLine();
            } while (!int.TryParse(input, out selectedSatellite));

            return(visible[selectedSatellite]);
        }
        public void UpdateUI(StaticInstance instance)
        {
            GroundStation station = instance.myFacilities[0] as GroundStation;

            rangeInfo.Info($"{station.TrackingShort:F0} Mm");
            groupInfo.Info(instance.Group);
        }
Beispiel #3
0
        private void FillContent(GroundStation model)
        {
            _title.text = model.Name;

            if (!string.IsNullOrEmpty(model.ImageUrl))
            {
                StartCoroutine(LoadImage(model.ImageUrl));
            }

            FillDescription(_model.Description);
        }
Beispiel #4
0
        internal static void TrackingInterface(StaticInstance instance)
        {
            GroundStation myStation = instance.myFacilities[0] as GroundStation;

            fRange     = myStation.TrackingShort;
            sGroup     = instance.Group;
            bCraftLock = false;

            LabelInfo = new GUIStyle(GUI.skin.label);
            LabelInfo.normal.background = null;
            LabelInfo.normal.textColor  = Color.white;
            LabelInfo.fontSize          = 13;
            LabelInfo.fontStyle         = FontStyle.Bold;
            LabelInfo.padding.left      = 3;
            LabelInfo.padding.top       = 0;
            LabelInfo.padding.bottom    = 0;

            BoxInfo = new GUIStyle(GUI.skin.box);
            BoxInfo.normal.textColor  = Color.cyan;
            BoxInfo.fontSize          = 13;
            BoxInfo.padding.top       = 2;
            BoxInfo.padding.bottom    = 1;
            BoxInfo.padding.left      = 5;
            BoxInfo.padding.right     = 5;
            BoxInfo.normal.background = null;

            GUILayout.Space(2);


            GUILayout.BeginHorizontal();
            {
                GUILayout.Space(5);
                GUILayout.Label("Range: " + (fRange).ToString("#0") + " tkm", LabelInfo, GUILayout.Height(25));
            }
            GUILayout.EndHorizontal();

            GUILayout.Space(2);



            GUILayout.BeginHorizontal();

            GUILayout.Label("Member of Group: " + sGroup, LabelInfo, GUILayout.Height(25));

            GUILayout.EndHorizontal();
            GUILayout.Space(5);
        }
Beispiel #5
0
        private void CreateGroundStationInfoCard(GroundStation model)
        {
            if (string.IsNullOrEmpty(model.ImageUrl) && string.IsNullOrEmpty(model.Description))
            {
                return;
            }

            _instantedInfoCard = Instantiate(_groundObjectInfoCardPrefab);
            _instantedInfoCard.transform.position = _camera.position + new Vector3(_camera.forward.x, 0f, _camera.forward.z) * 0.5f;

            var infoCard = _instantedInfoCard.GetComponent <InfoCardController>();

            infoCard.Init(model);
            infoCard.OnCloseInfoCard.AddListener(() => {
                _groundStationManager.UndohilightObject(model.Id);
                Destroy(_instantedInfoCard.gameObject);
            });

            //_groundStationManager.HilightObject(model.Id);
        }
Beispiel #6
0
        static void Main(string[] args)
        {
            var tleUrl     = new Uri("https://celestrak.com/NORAD/elements/visual.txt");
            var provider   = new RemoteTleProvider(true, tleUrl);
            var tles       = provider.GetTles();
            var satellites = tles.Select(pair => new Satellite(pair.Value)).ToList();

            var minAngle = (Angle)10;
            var gs       = new GroundStation(new GeodeticCoordinate(30.229777, -81.617525, 0));

            var        state    = TrackingState.ListingComPorts;
            Satellite  tracking = null;
            SerialPort comPort  = null;

            while (true)
            {
                switch (state)
                {
                case TrackingState.ListingComPorts:
                    comPort = SelectComPort();
                    if (comPort != null)
                    {
                        if (comPort.IsOpen)
                        {
                            comPort.Close();
                        }
                        comPort.Open();

                        comPort.WriteLine("$G");
                        comPort.WriteLine("G10P0L20X0Y0Z0");
                    }
                    state = TrackingState.ListingVisible;
                    break;

                case TrackingState.ListingVisible:
                    tracking = SelectVisibleSatellite(satellites, gs, minAngle);
                    state    = TrackingState.Tracking;
                    break;

                case TrackingState.Tracking:
                    if (PressedKey(ConsoleKey.V))
                    {
                        state = TrackingState.ListingVisible;
                    }
                    if (PressedKey(ConsoleKey.Q))
                    {
                        state = TrackingState.Quitting;
                    }

                    Console.Clear();
                    var observation = gs.Observe(tracking, DateTime.UtcNow);
                    Console.WriteLine(tracking.Name);
                    Console.WriteLine($"{observation.Elevation.Degrees:F2};{observation.Azimuth.Degrees:F2}");

                    comPort?.WriteLine($"G1X{-observation.Elevation.Degrees:F2}Y{observation.Azimuth.Degrees:F2}F1000");

                    Thread.Sleep(250);
                    break;
                }

                if (state == TrackingState.Quitting)
                {
                    break;
                }
            }

            comPort?.Close();
        }
Beispiel #7
0
 public CommandInterpreter(GroundStation groundStation)
 {
     this.groundStation = groundStation;
 }
Beispiel #8
0
        public void EnableControls(GroupBox gbPortSettings, GroupBox gbLineSettings, CheckBox chkDTR, CheckBox chkRTS, TextBox txtSendData, Button btnSend, Button btnRequestPicture, Button btnOpenPort, Button btnAtachFile, bool portOpen, GroundStation gs, DataMode currentDataMode)
        {
            // Enable/disable controls based on whether the port is open or not
            System.Diagnostics.Debug.Print("Enable controls TP: " + !portOpen);
            gbPortSettings.Invoke(new EventHandler(delegate
            {
                gbPortSettings.Enabled    = !portOpen;
                btnRequestPicture.Enabled = txtSendData.Enabled = btnSend.Enabled = portOpen;

                if (portOpen && (currentDataMode == DataMode.Image || currentDataMode == DataMode.TextFile))
                {
                    btnAtachFile.Enabled = true;
                }
                else
                {
                    btnAtachFile.Enabled = false;
                }
                if (portOpen)
                {
                    btnOpenPort.Text = "&Close Port";
                }
                else
                {
                    btnOpenPort.Text = "&Open Port";
                }
                gs.ConnectionChanged(portOpen);
            }));

            gbLineSettings.Invoke(new EventHandler(delegate
            {
                chkDTR.Enabled = !portOpen;
                chkRTS.Enabled = !portOpen;
            }));
        }
 private void StationSelected(GroundStation model)
 {
     _onGroundStationSelectedEvent.Invoke(model);
 }
Beispiel #10
0
        public void Init(GroundStation model)
        {
            _model = model;

            FillContent(_model);
        }
Beispiel #11
0
 /// <summary>
 /// Задает полям переданные значения, но:<br/>
 /// velocity = new Vector(0.0, 0.0, 0.0)<br/>
 /// vector = new Vector(0.0, 0.0, 0.0)<br/>
 /// referenceSystem = carrier<br/>
 /// isAnalizing = false<br/>
 /// carrier = <see cref="SunSystem.Planets.FixedEarth"/><br/>
 /// </summary>
 ///
 /// <param name="ID"> Идентификатор</param>
 /// <param name="basis"> Базис относительно базовой системы координат.</param>
 /// <param name="view"> Область видимости.</param>
 /// <param name="groundStation"> Наземная станция.</param>
 ///
 /// <exception cref="ArgumentNullException">
 /// Вызывается при передаче null.
 /// </exception>
 public GroundStationConnector(string ID, Basis basis, View view, GroundStation groundStation) :
     base(ID, new Vector(0.0, 0.0, 0.0), basis, view)
 {
     Carrier         = groundStation;
     referenceSystem = Carrier;
 }
Beispiel #12
0
 /// <summary>
 /// Конструктор копирования.
 /// </summary>
 ///
 /// <param name="connector"> Копируемое средство связи. Не должно быть null.</param>
 ///
 /// <exception cref="ArgumentNullException">
 /// Вызывается при передаче null.
 /// </exception>
 public GroundStationConnector(GroundStationConnector connector) : base(connector)
 {
     carrier         = connector.carrier;
     referenceSystem = carrier;
 }
Beispiel #13
0
 public void Init(GroundStation model)
 {
     _model = model;
 }