In simulation and defense-grade mission planning, real-time aircraft trajectory generation is critical. In this article, we demonstrate how to use AGI STK (Systems Tool Kit) and its Python API to programmatically create and propagate multiple aircraft objects, ideal for radar or surveillance simulation scenarios.
✨ Objective
Create 10 (scalable to 5000+) aircraft objects in STK using the Great Arc propagator, with each aircraft having randomized routes and properties. The generated targets can be used to simulate UAV flights, radar targets, or enemy track playback.
🔧 Prerequisites
Ensure you have:
- AGI STK installed (version 12 or compatible)
- Python environment configured with the STK Python API
- A scenario already loaded in STK
🧠 Code Breakdown
Below is the Python script used to attach to STK, set scenario parameters, and generate multiple aircraft targets dynamically.
from agi.stk12.stkengine import STKEngine
from agi.stk12.stkobjects import AgESTKObjectType, AgEVePropagatorType, AgEVeWayPtCompMethod, AgEVeAltitudeRef
from agi.stk12.stkdesktop import STKDesktop
import random
stk = STKDesktop.AttachToApplication()
root = stk.Root
scenario = root.CurrentScenario
# Define simulation window
start_time = "28 Jun 2025 15:00:00.000"
stop_time = "28 Jun 2025 15:30:00.000"
scenario.SetTimePeriod(start_time, stop_time)
# Reference location - Bangalore
base_lat, base_lon = 12.9716, 77.5946
# Begin updates
root.BeginUpdate()
aircraft_objects = []
for i in range(1, 11):
name = f"target{i}"
if scenario.Children.Contains(AgESTKObjectType.eAircraft, name):
scenario.Children.GetElements(AgESTKObjectType.eAircraft).Item(name).Unload()
aircraft = scenario.Children.New(AgESTKObjectType.eAircraft, name)
aircraft.SetRouteType(AgEVePropagatorType.ePropagatorGreatArc)
route = aircraft.Route
route.Method = AgEVeWayPtCompMethod.eDetermineTimeAccFromVel
route.SetAltitudeRefType(AgEVeAltitudeRef.eWayPtAltRefMSL)
# Randomize initial location and flight parameters
speed_mps = random.uniform(200, 350)
alt_m = random.uniform(8000, 20000)
lat = random.uniform(base_lat, base_lat + 10)
lon = random.uniform(base_lon, base_lon + 10)
# Add waypoints
for _ in range(4):
lat += random.uniform(-2, 2)
lon += random.uniform(-2, 2)
wp = route.Waypoints.Add()
wp.Latitude = lat
wp.Longitude = lon
wp.Altitude = alt_m / 1000
wp.Speed = speed_mps / 1000
aircraft_objects.append(aircraft)
root.EndUpdate()
# Propagate all aircraft routes
root.BeginUpdate()
for ac in aircraft_objects:
try:
ac.Route.Propagate()
except:
print(f"❌ Propagation failed for {ac.InstanceName}")
root.EndUpdate()
🔁 Configure Scenario Animation
scenario.SetTimePeriod("28 Jun 2025 15:00:00.000", "28 Jun 2025 16:00:00.000")
scenario.Animation.StartTime = scenario.StartTime
scenario.Animation.EnableAnimCycleTime = True
scenario.Animation.AnimCycleType = 1 # Repeat
scenario.Animation.RefreshDelta = 1
root.Rewind()
✅ Output
Once executed, your STK scenario will contain 10 new aircraft, each following a unique flight path. You can now integrate this simulation with real-time visualization platforms like CesiumJS for external rendering or use it for performance testing of radar-based systems.
📌 Final Thoughts
Automating object creation in STK is a powerful way to simulate large-scale mission scenarios, especially when paired with geospatial visualizers or data replay tools. At Manya Technologies, we use this technique to simulate thousands of targets for real-time radar systems and defense mission planning.
👉 Contact Manya Technologies – business@manyatechnologies.com