Quadrotor Flips Optimization using CMA-ES

Quadrotors have fascinated me for a long time. There has been an enormous amount of research with these small machines leading to a lot of cool experiments and products over the past few years. Machine learning techniques have been used in a lot of research papers to optimize the flight. I wanted to learn how you can perform the task using Python and apply machine learning techniques. I started hunting for articles on this topic and among the humongous list, I found that I liked the paper A Simple Learning Strategy for High-Speed Quadrocopter Multi-Flips the most. The article is written by Sergei Lupashin, Angela Schollig, Michael Sherback, Raffaello D’Andrea from group Flying Machine Arena.

Acrobatic maneuvers are tough to perform on quadrotors as they require precise control over the thrust that is applied to the motors. The paper describes how machine learning technique can be used to perform flips along one of the axes at a high rotation rate of 1600 degrees/second and return to the starting position without any human intervention. Let me give a very brief overview the approach used in the paper.

Quadrotors are sophisticated devices that are influenced by a lot of factors. So rather than making use of higher order model, most of the researchers go ahead with a simplistic lower order model as this reduces the complexities introduced by the higher order models without compromising the accuracy of the model. A quadrotor has four motors, and primitively it can be modeled as the collective forces generated by the four motors and gravitational force acting on it. The movement of the quadrotor for this maneuver is controlled using the collective acceleration value applied to the all the motors, this value is then broken down into multiple control parameters based on a PI controller. A control envelope is used to restrict input values generated.

The flip is performed in 5 steps and is defined by five parameters, and simplistically they are the acceleration and period for which the force is applied. These form the values that are optimized to gain better performance. Initially, a rough guess of the initial values of the five control parameters is provided to the optimization algorithm. The roughly estimated parameters are fed to an optimizer that is running an algorithm like CMA-ES to obtain the best set of values. The algorithm makes use of the simple low order quadrotor model to perform the optimization. The optimal parameters obtained from the optimizer are then fed to the quadrotor to carry out the flips in real time.

The entire algorithm is implemented using Python. The quadrotor model makes of numpy array methods and odeint from scipy to perform the integration. CMA-ES is used as the optimization library, and the implementation by deap framework is used. The library can be found on github.

The generated data can be visualized using matplotlib or through blender. You can see the results from an incomplete simulation using both the visualization methods

Matplotlib Result

Matplotlib Based 3d Plot
Matplotlib Based 3d Plot

Blender Animation


I would like to point out that these are my personal opinions and I you have any valid concerns related to the post please let me know. The library is modular and hence feel free to utilize it in any of your ventures.

References and Links

  1. A Simple Learning Strategy for High-Speed Quadrocopter Multi-Flips
    • Sergei Lupashin, Angela Sch ̈ollig, Michael Sherback, Raffaello D’Andrea
  2. Adaptive Open-Loop Aerobatic Maneuvers for Quadrocopters
    • Sergei Lupashin, Rafaello D’Andrea
  3. Adaptive fast open-loop maneuvers for quadrocopters
    • Sergei Lupashin, Rafaello D’Andrea