Skip to content

Bharath-970/aeroforge

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🚀 AERO — Mission Control Flight Simulator

A high-fidelity, real-time rocket flight simulator with a live 3D Mission Control dashboard. Built from the ground up with a genuine physics engine, aerospace flight software architecture, and a cinematic WebGL visualization suite.


What Is This?

AERO is not a game engine wrapper or a toy. It is a full aerospace simulation stack — the same layered architecture used in real flight software — running a Runge-Kutta 4th-order physics integrator, a deterministic FSW state machine, active GNC guidance algorithms, and a live telemetry datalink, all rendered in real-time through a Three.js WebGL dashboard.

The mission: launch from Earth, achieve stable orbit, execute a Trans-Martian Injection burn, and slingshot to Mars.


Architecture

aero/
├── physics/          # Core physics engine
│   ├── rocket.py     # RK4 integrator, spherical gravity, 6-DOF dynamics
│   ├── aero_drag.py  # Atmospheric drag model (NRLMSISE-00 inspired)
│   ├── propulsion.py # Throttle-responsive engine model with ISP curves
│   ├── orbit.py      # Lambert solver, Kepler propagation, orbital elements
│   └── weather.py    # Stochastic wind turbulence & gust model
│
├── control/          # Guidance, Navigation & Control (GNC)
│   ├── guidance.py   # AscentGuidance gravity turn + pitch limiter
│   ├── pid.py        # PID controller (used for attitude hold)
│   └── lqr.py        # Linear Quadratic Regulator (optimal control)
│
├── fsw/              # Flight Software (FSW) layer
│   ├── state_machine.py  # Deterministic mission phase sequencer
│   └── telemetry.py      # UDP telemetry datalink publisher
│
├── web/              # Mission Control Dashboard (Browser UI)
│   ├── index.html    # Dashboard layout & HUD panels
│   ├── app.js        # Three.js WebGL render loop + telemetry subscriber
│   └── style.css     # Glassmorphism dark-mode UI
│
├── server.py         # WebSocket + HTTP server (serves dashboard + relays telemetry)
└── demo.py           # Mission launcher (interactive TUI pre-flight config)

Physics Engine

The rocket is simulated as a 6-Degree-of-Freedom rigid body using a 4th-order Runge-Kutta (RK4) integrator at 50ms timesteps.

Forces modeled at every tick:

  • Gravity — Spherical Earth model (μ/r²), pointing toward Earth's core in 3D
  • Thrust — Vacuum-optimized Nuclear Thermal engine (Isp 1500s), throttle-responsive
  • Aerodynamic Drag — Altitude-dependent atmospheric density, dynamic pressure (½ρv²), Mach-scaled Cd
  • Wind & Turbulence — Stochastic gust model with configurable intensity and lateral shear
  • Coriolis & Centripetal — Fictitious forces for rotating reference frame accuracy

Collision detection uses true spherical altitude (distance from Earth's core minus Earth radius) to prevent false ground-collision triggers during orbital passes.


Flight Software (FSW) State Machine

The mission follows a deterministic sequence of phases managed by FSWController:

Phase Trigger Description
PRE_LAUNCH Fuel > 0 Systems armed, awaiting ignition
ASCENT_GRAVITY_TURN Liftoff GNC drives gravity turn to orbital velocity
MECO_AND_SEPARATION Vx > 7,800 m/s Main engine cut-off, stage separation
ORBITAL_FREE_FALL Post-MECO Coasting in parking orbit around Earth
TRANS_MARTIAN_INJECTION 1 full Earth orbit Max-thrust burn to 11.2 km/s escape velocity
DEORBIT_BURN Re-entry conditions Retrograde burn
TERMINAL_LANDING Alt < 5 km Powered descent
TOUCHDOWN Alt < 5m, Vz < 2 m/s Mission complete

Guidance & Control (GNC)

AscentGuidance — Gravity Turn

The ascent computer calculates the optimal pitch angle dynamically based on the current velocity vector. It runs a gravity turn: as horizontal velocity builds, the rocket naturally rolls over and aims its thrust more sideways to build orbital velocity rather than fighting gravity straight up.

Active RCS Auto-Stabilizer: Below 80 km altitude, the pitch is hard-clamped to 20 degrees maximum from vertical. If the guidance computer tries to pitch more aggressively, the RCS cold-gas jets fire automatically to fight the rotation — preventing the rocket from going sideways in thick air and falling back to Earth.

Manual RCS Override

Pressing [ FIRE RCS PITCH ] in the dashboard fires a pitch adjustment of -0.1 radians and suppresses the guidance computer for 3 full seconds, preventing the GNC from immediately correcting your input back. The rocket physically holds your commanded attitude.

LQR Controller (lqr.py)

A full Linear Quadratic Regulator is implemented for precision attitude hold in vacuum — the mathematically optimal control law that minimizes both attitude error and control effort simultaneously.


Mission Control Dashboard

The browser dashboard at http://localhost:8080 is a real-time flight operations center:

Telemetry Panel

  • Altitude (km) — live spherical altitude above Earth surface
  • Vertical Velocity (m/s) — positive = climbing, negative = descending
  • Fuel Load (kg) — remaining propellant mass
  • CMD Throttle (%) — current engine throttle command

Trajectory Monitor (WebGL 3D)

  • Atmospheric Phase: Full 3D rocket model with engine exhaust particles, atmospheric haze, and infinite scrolling runway grid
  • Orbital Phase: Zooms out to show the cyan rocket dot orbiting the Earth globe, with the satellite conjunction network visible
  • Deep Space Phase: Solar system view with Earth, Luna, and Mars labeled. The rocket dot lerps from Earth orbit directly to Mars during the TMI slingshot burn.

Time Warp Controls

Button Multiplier Use Case
[ 1X ] 1x Watching launch in real-time
[ 2X ] 2x Normal ascent
[ 5X ] 5x Upper atmosphere
[ 100X ] 100x Reaching orbit
[ 500X ] 500x Completing the Earth parking orbit

Mission Log

Live FSW status messages stream at the bottom of the trajectory monitor:

> FSW_INIT: PRIMARY TURBOPUMP NOMINAL
> ENVIRONMENT: MESOSPHERE (MAX Q)
> GNC: GRAVITY TURN PITCH EXECUTING
> RCS: ACTIVE AUTO-STABILIZER (PROGRADE CLAMP)
> SENSOR: EXTERNAL PRESSURE 0 kPa. VACUUM ACHIEVED.
> NAV TARGET: MARS (NASA JPL HORIZONS)

Interactive Commands

  • [ JETTISON STAGE 1 ] — drops the first stage booster (removes 1,000 kg)
  • [ FIRE RCS PITCH ] — fires cold-gas attitude thrusters with 3-second GNC suppression

Satellite Conjunction Avoidance

In orbital view, the Celestrak satellite constellation is visualized as a swarm of pink particles orbiting Earth. As the rocket climbs into LEO, the FSW monitors for conjunction threats. If the rocket's trajectory intersects an active satellite corridor, the CONJUNCTION_EVASION state triggers and the RCS fires to maneuver around the debris field — the same automated collision avoidance logic used by real satellite operators.


Running the Simulation

Prerequisites:

pip install -r requirements.txt

Step 1 — Start the server:

cd ~/Documents/aero
python3 server.py

Step 2 — Launch the mission engine (in a separate terminal):

python3 demo.py

Accept the default prompts (or configure your own fuel load, wind speed, and target orbit altitude), then press Enter to Ignite.

Step 3 — Open Mission Control:

http://localhost:8080

Hit [ 500X ] warp and watch the full mission unfold.


Tech Stack

Layer Technology
Physics Engine Python / NumPy (RK4, 6-DOF)
GNC Algorithms Python (Gravity Turn, PID, LQR)
FSW State Machine Python (Enum-based deterministic FSM)
Telemetry Datalink UDP + WebSocket
Web Server Python (asyncio + websockets)
3D Visualization Three.js (WebGL)
UI / Dashboard Vanilla HTML + CSS (Glassmorphism)
Fonts Google Fonts — Inter + Roboto Mono

Built with an obsessive attention to real aerospace engineering principles.

About

Autonomous rocket landing + satellite collision avoidance — 6-DOF physics, LQR/PID control, EKF state estimation, real TLE data from Space-Track.org

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors