← Selected work

Autonomous UAV control: from RRT* to minimum snap

Abstract

3D simulation of a quadrotor with a complete autonomous control stack: RRT* path planning around obstacles, minimum snap trajectory generation, and a cascaded controller for tracking. Everything is written in Python and tested, with the mathematical derivation documented in the repository.

01The problem

Making a quadrotor follow a trajectory is not just about finding a path to the goal. The path must be feasible for the drone's dynamics, collision-free, and smooth enough: the quadrotor is modeled here as a 4th-order system, so the trajectory must be differentiable at least four times (velocity, acceleration, jerk, snap).

02Planning: RRT*

Waypoints are generated by RRT*, which explores free space around obstacles and progressively refines the path towards the optimum, where vanilla RRT stops at the first path found. [3]

RRT* exploration in an environment with obstacles
Fig. 1 - RRT* exploration: the tree covers free space and converges to an optimal, obstacle-free path.

03Trajectory: minimum snap

Between waypoints, the optimal trajectory is the one that minimizes snap (the fourth derivative of position). It takes the form of a 7th-order polynomial whose 8 coefficients are set by 8 boundary conditions: position, velocity, acceleration and jerk imposed at start and end.

Each condition yields one linear equation: the problem is solved by assembling an 8x8 constraint matrix and computing c = A⁻¹ b. Pure linear algebra, documented equation by equation in the repository. [2]

04Control

Tracking is handled by a cascaded controller inspired by the Flying Machine Arena work (ETH Zurich): an outer position loop commanding a faster inner attitude loop. [1]

Controller step response in position and attitude
Fig. 2 - Controller step response: position (x, y, z) and attitude (roll, pitch, yaw) converge to the setpoint.

05Results

The simulation opens on a flight dashboard: on the left, a 3D animation of the drone with the executed trajectory against the minimum snap reference, the RRT path and the obstacles; on the right, four time series synchronized by a time cursor: position, attitude, propeller speeds and tracking error.

Flight dashboard: 3D drone animation and synchronized time series
Fig. 3 - Flight dashboard: the 3D animation and the position, attitude, propeller speed and tracking error curves share the same time cursor.

Two simulation demos, straight from the repository.

Video 1 - Trajectory tracking in 3D simulation: reference versus executed trajectory.
Video 2 - Simulated flight with live telemetry: position and velocity against the setpoint.

06The stack

LayerChoice
PlanningRRT* with obstacle avoidance
Trajectoryminimum snap, 7th-order polynomials
Controlcascaded position / attitude
LanguagePython, NumPy
Qualitypytest, measured coverage
@software{uav_autonomous_control,
  author = {Vinceslas, Medhy},
  title  = {3D UAV simulation and autonomous control for path tracking},
  url    = {https://github.com/Mdhvince/UAV-Autonomous-control},
  note   = {Open source}
}

07References

  1. Lupashin, S., Hehn, M., Mueller, M. W., Schoellig, A. P., Sherback, M., D'Andrea, R. A platform for aerial robotics research and demonstration: The Flying Machine Arena. Mechatronics, 2014.
  2. Mellinger, D., Kumar, V. Minimum snap trajectory generation and control for quadrotors. ICRA, 2011.
  3. Karaman, S., Frazzoli, E. Sampling-based algorithms for optimal motion planning. IJRR, 2011.
View the code on GitHub Get in touch