Quad-rotor P&S Learn how to fly a drone autonomously

See our gallery for images of the flying areana where students implement their algorithms for making a quad-rotor drone fly autonomously.

Abstract

Quad-rotors are becoming more and more commonplace as technological advancements increase capabilities and reduce costs. Quad-rotor vehicles are encountered both for domestic entertainment and industrial applications, some examples are: toys for people of all ages, professional cinematography, or, inspection of industrial scale structures and processes. One reason why quad-rotors have become so pervasive is their mechanical simplicity, which lends itself to the high operational reliability. Moreover, the control and estimation techniques required to stabilise a quad-rotor around hover utilises only the control theory taught to under-graduates, while acrobatic feats and fleet manoeuvres inspire many directions in current research.

The learning objective of this course are:

This video shows highlights from the third time we ran the course in Autumn semester 2018.


Since then we made some adjustments to accommodate online teaching while still enabling the hands-on element of the course. This video shows highlights from this transition and the Spring semester 2020.




Course Material

We are still updating aspects of the course, so please check here occasionally for the latest script and exercise materials.

Course Script

The course script is intended as a stand alone script that allows the student to review all the theory we cover in class, as well as provide additional information for those students wishing to delve further particular topics.

The script can be downloaded here (Version 2019-Mar-04), and is also available in the ETH Research Collection.

The script includes a introduction to Simulink tutorial that provides step-by-step instructions for simulating a simple pendulum system. The end point of the tutorial can be downloaded with the following links. The multiple Simulink files are identical, just saved for different versions of Matlab, choose the file that is compatible with the version of Matlab you have installed on your computer.
Parameter script: matlab parameter script
Simulink template: R2017b , R2015a
(These files were uploaded on 2018-Feb-14)



Class dates for Autumn 2021 Semester

The first class will take place on Monday, September 27, 2021, 13:15-17:00, for ALL enrolled students

Following that, classes will occur every second week. The students will be split into two groups (A and B) and the classes for each group will occur on alternating weeks.

Thus the schedule for Group A will be:


And the schedule for Group B will be:



Exercise 1

The goal of exercise 1 is to simulate the equations of motion for an N-rotor vehicle and through this gain a deeper understanding and intution for the vehicle's behaviour.
Exercise Sheet (Version 2020-Sept-28)

The following files provide a template for Simulink that will assist in getting started with this exercise. To use the template you should save all files locally on you computer into the same folder. The multiple Simulink files are identical, just saved for different versions of Matlab, choose the file that is compatible with the version of Matlab you have installed on your computer.
Parameter scripts: (right-click and select "Download linked file")
simulation paramters
get vehicle paramters
visualise N-rotor vehicle
get default controller
compute equilibrium thrusts
get reference specification
function equations of motion template

Simulink template: R2017b , R2016b , R2015b

Or, for convenience, all files together in one Zip file

(These files were uploaded on 2019-Mar-08)

The following files provide a sample solution to part A of this exercise. Only the Simulink file is provided and should be saved into the same folder as all the template files provided above. This Simulink file with the solution can be open and run without causing any conflict with the template Simulink file that you edited as part of completing part A of the exercise sheet.
Solution for Part A: R2017b , R2016b , R2015b
(These files were uploaded on 2019-Mar-08)

Exercise 2

The goal of exercise 2 is to design, implement, and tune a PID and LQR controller for the Crazyflie 2.0 quad-rotor vehicle.
Exercise Sheet (Version 2019-Mar-08)

The following files provide a template for Simulink that are the starting point for this exercise. To use the template you should save all files locally on you computer into the same folder. The multiple Simulink files are identical, just saved for different versions of Matlab, choose the file that is compatible with the version of Matlab you have installed on your computer.
Parameter scripts: (right-click and select "Download linked file")
simulation paramters
get crazyflie vehicle paramters
visualise N-rotor vehicle
get default controller
get crazyflie inner controller
compute equilibrium thrusts
get measurement noise details
get reference specification

Simulink template: R2017b , R2016b , R2015b

Or, for convenience, all files together in one Zip file

(These files were uploaded on 2019-Mar-08)


Visualisation
The following script plots a visualisation of the N-rotor vehicle design:
N-rotor vehicle visualisation script
The following script plots a visualisation of trajectory simulated by the Simulink model:
Trajectory visualisation script
To use the trajectory visualisation script, first compile and run the Simulink model, then enter either of the following commands in the Matlab Command Window:

>> traj_handles = visualise_nrotor_trajectory( simout_full_state )
>> traj_handles = visualise_nrotor_trajectory( simout_full_state , [] , nrotor_vehicle_layout_true )
			

Exercise 3

The goal of exercise 3 is to familiarise with the practical setup and then implement, and tune a PID controller for altitude and yaw.
Exercise Sheet (Version 2019-Mar-21)

Exercise 4

The goal of exercise 4 is to continue your implementation and tuning a PID controller for altitude and yaw, and then to implement an LQR controller for the x and y positions.
Exercise Sheet (Version 2019-Mar-27)

The following example MATLAB script will assist in tuning your outer LQR controller. To use the example you should save the file locally on you computer and run the script in MATLAB. Further details are explained in the comments of the script. Note that the controller sample time in the lab is 1/200 and 1/50 for the at home setup.
matlab LQR synthesis example script