Пример #1
0
        private void ButtonCreateAircraft_Click(object sender, EventArgs e)
        {
            buttonCreateAircraft.Enabled = false;

            try
            {
                m_aircraft = m_stkRoot.GetObjectFromPath($"Aircraft/{m_aircraftName}") as AgAircraft;
                m_aircraft.Unload();
            }
            catch
            {
                // Aircraft does not exist
            }

            m_aircraft = m_scenario.Children.New(AgESTKObjectType.eAircraft, m_aircraftName) as AgAircraft;
            ((IAgVeGfxAttributesBasic)m_aircraft.Graphics.Attributes).Color = Color.White;

            m_stkRoot.ExecuteCommand($"RealTime */Aircraft/{m_aircraftName} SetProp");
            m_stkRoot.ExecuteCommand($"RealTime */Aircraft/{m_aircraftName} SetLookAhead DeadReckon 2 .1 20");
            m_stkRoot.ExecuteCommand($"RealTime */Aircraft/{m_aircraftName} SetHistory 5 1");
            m_stkRoot.ExecuteCommand($"SetAttitude */Aircraft/{m_aircraftName} RealTime Extrapolate 1 1");
            m_stkRoot.ExecuteCommand($"SetAttitude */Aircraft/{m_aircraftName} DataReference Fixed YPR 0 0 0 YPR " + @"""" + $"Aircraft/{m_aircraftName} NorthEastDown" + @"""");
            m_stkRoot.ExecuteCommand("SetUnits / FEET");

            // Start the thread to send position and attitude commands to STK
            m_stkCommands = new Thread(new ThreadStart(SendCommandsToSTK));
            m_stkCommands.IsBackground = true;
            m_stkCommands.Start();
        }
Пример #2
0
        private void LoadAttitude_Click(object sender, EventArgs e)
        {
            foreach (Section item in CommonData.sectionList)
            {
                item.linkedToAttitude = false;
                if (item.articName.Contains("Yaw") || item.articName.Contains("Pitch") || item.articName.Contains("Roll"))
                {
                    item.linkedToAttitude = true;
                }
            }
            string       objectPath = CommonData.objectClass + "/" + CommonData.simpleName;
            IAgStkObject obj        = CommonData.StkRoot.GetObjectFromPath(objectPath);
            string       fileName   = CommonData.directoryStr + "\\" + CommonData.simpleName + ".a";

            if (AttitudeCoordFrame.SelectedIndex == 0)
            {
                ArticFunctions.WriteVVLHAttitudeFile(fileName);
            }
            else if (AttitudeCoordFrame.SelectedIndex == 1)
            {
                ArticFunctions.WriteICRFAttitudeFile(fileName);
            }

            if (CommonData.objectClass == "Aircraft")
            {
                try
                {
                    AgAircraft aircraft = obj as AgAircraft;
                    IAgVeRouteAttitudeStandard attitude = aircraft.Attitude as IAgVeRouteAttitudeStandard;
                    attitude.External.Load(fileName);
                }
                catch (Exception)
                {
                    MessageBox.Show("Could not load attitude file");
                }
            }
            else if (CommonData.objectClass == "Satellite")
            {
                try
                {
                    IAgSatellite sat = obj as IAgSatellite;
                    IAgVeOrbitAttitudeStandard attitude = sat.Attitude as IAgVeOrbitAttitudeStandard;
                    attitude.External.Load(fileName);
                }
                catch (Exception)
                {
                    MessageBox.Show("Could not load attitude file");
                }
            }
        }
Пример #3
0
        IAgVePropagatorGreatArc createAircraftFromWaypoints()
        {
            //Create vehicle (aircraft) using GreatArc propagator
            AgAircraft aircraft = null;
            IAgVePropagatorGreatArc greatArcPropagator = null;

            if (CommonData.StkRoot.CurrentScenario.Children.Contains(AgESTKObjectType.eAircraft, "MyAircraft"))
            {
                aircraft           = CommonData.StkRoot.GetObjectFromPath("Aircraft/MyAircraft") as AgAircraft;
                greatArcPropagator = aircraft.Route as IAgVePropagatorGreatArc;
            }
            else
            {
                aircraft = CommonData.StkRoot.CurrentScenario.Children.New(AgESTKObjectType.eAircraft, "MyAircraft") as AgAircraft;
                aircraft.SetRouteType(AgEVePropagatorType.ePropagatorGreatArc);
                greatArcPropagator = aircraft.Route as IAgVePropagatorGreatArc;
            }

            //greatArcPropagator.Propagate();
            return(greatArcPropagator);
        }