PID-Based UAV Pitch Autopilot with Sensor Fusion and Robustness Validation
Designed and validated a UAV pitch control system using PD/PID controllers and complementary sensor fusion.
Achieved <2% overshoot and ~3 s settling time under realistic sensor noise and bias conditions.
Demonstrated robust closed-loop performance across multiple feedback strategies and disturbance levels.
This project models and controls UAV pitch dynamics using:
- Plant Model: Second-order pitch dynamics
- Controllers: P, PD, and PID control strategies
- Sensors:
- Gyroscope (rate measurement with bias and noise)
- Accelerometer (angle estimation with noise)
- Sensor Fusion: Complementary filter for reliable attitude estimation
Reference → PID Controller → UAV Model → Sensors → Complementary Filter → Feedback
- Overshoot: ~1.97%
- Settling Time: ~3.1 s
- Steady-State Error: ~0.0047 rad
- Accelerometer-only: High noise leads to oscillatory response
- Gyro-only: Smooth short-term response but drifts due to bias
- Filtered (Best): Combines noise reduction and drift correction
![Sensor Estimation Under High Noise Conditions] 
- Increasing Kp improves response speed but increases overshoot
- Derivative action (Kd) improves damping and reduces oscillations
- Integral action (Ki) removes steady-state error but must be tuned carefully
- Gyro drift occurs due to bias accumulation during integration
- Complementary filtering balances noise rejection and drift correction
System tested under increasing disturbance levels:
- Baseline noise
- Moderate disturbance
- Severe disturbance
Results:
- Raw accelerometer feedback degraded significantly with noise
- Gyro-only feedback showed increasing drift
- Filtered feedback remained stable and met performance requirements
| ID | Requirement | Limit | Result |
|---|---|---|---|
| REQ_01 | Overshoot (baseline, filtered) | < 5% | PASS |
| REQ_02 | Settling time (baseline, filtered) | < 5 s | PASS |
| REQ_03 | Steady-state error | < 0.05 rad | PASS |
| REQ_04 | Filtered SSE < Raw SSE | inequality | PASS |
| REQ_05 | Filtered SSE < Gyro SSE | inequality | PASS |
| REQ_06 | Overshoot (moderate disturbance) | < 10% | PASS |
| REQ_07 | Overshoot (severe disturbance) | < 15% | PASS |
- Simplified second-order model (not full aircraft dynamics)
- Complementary filter introduces slight estimation lag
- Performance degrades under extreme disturbance conditions
pip install numpy matplotlib control
python uav_controller.py
- Generates plots automatically
- Outputs verification results
- Saves figures in
images/
UAV-Controller-Design/
├── README.md
├── uav_controller.py
├── images/
└── .gitignore
Saad Wajih

