Skip to content

About

No description, website, or topics provided.

Resources

Stars

1 star

Watchers

0 watching

Forks

Repository files navigation

🚀 C++ Rocket Flight Simulator & Real-Time Python Visualizer

A high-performance 1D rocket flight simulation engine built with native C++20 and integrated into a real-time 2D graphical visualization interface in Python via pybind11.

This hybrid application models atmospheric flight dynamics from launch through powered ascent, coasting, apogee, and free-fall descent until touchdown, complete with real-time HUD telemetry and an adaptive dynamic camera system.


📌 Key Features

  • C++ Physics Engine Core: Blazing-fast numerical computation layer integrated natively into Python through high-performance pybind11 C-extension bindings.
  • Dynamic Air Density Model: Calculates atmospheric drag based on current altitude using an exponential barometric model: $$\rho(h) = \rho_0 \cdot e^{-h/H}$$
  • Variable Mass & Thrust Dynamics: Simulates fuel mass depletion in real time, dynamically updating total vehicle mass ($m(t)$), motor thrust, and acceleration at each integration step.
  • Euler Integration Scheme: Solves state variables iteratively: $$\text{Position} \longrightarrow \text{Acceleration} \longrightarrow \text{Velocity}$$
  • Real-Time Pygame HUD & Visualizer: Renders flight animation with an integrated HUD display (altitude, velocity, acceleration, fuel level, engine status) and a dynamic tracking camera centered on the vehicle.

🛠️ Mathematical & Physical Model

The engine models three core forces acting on the vehicle along the vertical axis:

  1. Thrust ($F_T$): Active during motor burn phase ($F_T = \dot{m} \cdot v_e$).
  2. Gravity ($F_g$): $F_g = m(t) \cdot g$
  3. Aerodynamic Drag ($F_D$): $$F_D = \frac{1}{2} \cdot \rho(h) \cdot v \cdot |v| \cdot C_d \cdot A$$ where $A = \pi \cdot r^2$ is the cross-sectional area derived from vehicle diameter.

💻 Tech Stack & Architecture

  • Engine: C++20
  • Visualizer: Python 3 (Pygame)
  • Binding: pybind11
  • Build System: CMake 3.20+

🛠️ Building & Running

Prerequisites

  • C++20 compatible compiler (clang++, g++, or MSVC)
  • Python 3.10+ with pygame and pybind11 installed
  • CMake 3.20+

1. Installation

Clone the repository:

git clone [https://github.com/karinarosot/Rocket-Flight-Simulator-Program.git](https://github.com/karinarosot/Rocket-Flight-Simulator-Program.git)
cd Rocket-Flight-Simulator-Program

# Install Python Dependencies
pip install pygame pybind11

# Build the Native C++ Extension Module 
mkdir build && cd build
cmake ..
cmake --build .

# Run Simulation
mkdir build && cd build
cmake ..
cmake --build .

# Controls & HUD Telemetry
During flight execution, the real-time telemetry HUD displays:
* Altitude
* Velocity
*Acceleration
*Fuel mass
*Engine stats: BURNING- during powered ascent and COASTING after burnout.

About

No description, website, or topics provided.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages