Flight Controller – Fixed-Wing Pitch Control with SITL
A C++ project that implements and validates a cascaded pitch control system for a fixed-wing aircraft using a custom
Software-In-The-Loop (SITL) simulation. The controller uses an inner pitch-rate loop and an outer pitch-angle loop,
with a first-order pitch dynamics model, actuator limits, anti-windup, and multiple command profiles. The work is
ongoing—I plan to extend the project further as I continue learning and applying flight control design.
Context
Personal • UAARG-inspired
Tech
C++, CMake, SITL
Status
Ongoing
1. Motivation
I built this project to deepen my understanding of aircraft control systems so I can apply it to tuning vehicles in ArduPilot with the University of Alberta Aerial Robotics Group (UAARG). It also gave me hands-on experience with flight control design and with building a non-trivial C++ project from the ground up rather than reusing boilerplate.
2. Control Architecture
The system uses a cascaded structure common in flight control:
Outer loop — Regulates pitch angle (θ) and outputs a pitch-rate command (qcmd).
Inner loop — Regulates pitch rate (q) and outputs an elevator command.
The rate loop stabilizes fast rotational dynamics first; the angle loop then commands slower attitude changes. Managing rate is prioritized because it has a larger impact on stability than angle alone.
High-level architecture overview: pitch angle (outer) and pitch rate (inner) control loops.
3. Dynamics and Controllers
Pitch dynamics are modeled with a first-order pitch-rate equation (q̇ = −(1/τ)q + K·δe) and pitch angle from integrating q. The inner loop is a PI pitch-rate controller with integrator anti-windup and output saturation for actuator limits; the outer loop is a P pitch-angle controller that outputs qcmd. The rate loop is tuned to be significantly faster than the angle loop.
4. SITL Framework and Validation
The SITL runs at a fixed timestep (500 Hz) with a deterministic loop, modular plant and controller interfaces, and CSV logging for analysis. It supports step, ramp, and sinusoidal commands plus random noise to test transient response, tracking, and disturbance rejection. Validation includes step response, saturation behavior, and disturbance injection, with metrics like rise time, overshoot, and steady-state error.
Validation: step and ramp inputs with Gaussian noise. Measured angle tracks commanded angle; slight under-reaction to the step is intentional for realistic behavior.
5. Repository and Next Steps
The repo is organized with src/control/ for the pitch rate and angle controllers, sim/ for the SITL main, plant, and input profiles, and include/ for headers. Build with CMake (mkdir build, cmake .., make). I plan to keep extending this project—e.g. richer dynamics, more axes, or different control structures—as I continue working on flight controls.