AeroControl is a Python-based simulation environment designed to model and stabilize aircraft altitude using a Proportional-Integral-Derivative (PID) control loop. This project implements a real-time tuning dashboard to visualize how different control gains affect flight stability under unpredictable atmospheric conditions.
-
Real-Time PID Tuner: Interactive GUI built with Tkinter to adjust
$K_p$ ,$K_i$ , and$K_d$ gains on the fly. -
Stochastic Wind Turbulence: Simulates unpredictable atmospheric gusts using Gaussian noise (
$\mu=0, \sigma=2.0$ ) to test controller robustness. -
Physics Engine: Models vertical motion using Newton’s Second Law (
$F = ma$ ), accounting for gravity and dynamic thrust. - Dynamic Visualization: Live Matplotlib integration to track altitude response, overshoot, and settling time.
The core of the simulation is the PID controller, which calculates the required thrust
-
Proportional (
$K_p$ ): Reacts to the current error. Higher values decrease rise time but increase overshoot. -
Integral (
$K_i$ ): Accumulates past errors to eliminate the steady-state error caused by gravity. -
Derivative (
$K_d$ ): Predicts future error by calculating the rate of change, providing a damping effect to reduce oscillations.
- Language: Python 3.x
- GUI Framework: Tkinter
- Math/Physics: NumPy
- Data Visualization: Matplotlib
- Domain: Control Theory & Aerospace Engineering
-
Clone the Repository
git clone https://github.com/prxcode/aerocontrol.git cd aerocontrol -
Create a Virtual Environment
python -m venv venv
-
Activate the Environment
- Windows:
venv\Scripts\activate - macOS/Linux:
source venv/bin/activate
- Windows:
-
Install Dependencies
pip install -r requirements.txt
Run the main dashboard script:
python main.pyUse the sliders in the control panel to observe how the aircraft reacts to different PID settings while the "Wind Turbulence" toggle is active.
The simulation demonstrates a classic underdamped system response:
-
Overshoot: The aircraft initially exceeds the 100m target due to momentum before the derivative term (
$K_d$ ) applies a braking force. - Settling Time: The system typically reaches a stable state within ~15-20 seconds with tuned gains.
- Robustness: With turbulence enabled, the controller continuously adjusts thrust to maintain altitude, proving the effectiveness of the feedback loop.
- 3D Dynamics: Expanding the logic to a 6-DOF model (Roll, Pitch, Yaw).
- Auto-Tuning: Implementing the Ziegler-Nichols method for automated gain calculation.
- Data Logging: Exporting simulation telemetry to CSV for post-flight analysis.
