Description
Quadrotor Simulator and PD Controller
1 Introduction
The goal of this programming exercise is to get you familiar with working with the quadrotor simulator and implementing a Proportional Derivative (PD) controller. In Week 1, we provided you with a quadrotor GUI in which to tune PD control gains. In this exercise, you will have to implement your own PD controller to control the height of a quadrotor, as well as tune its gains.
Before starting on this programming exercise, we strongly recommend watching the video lectures, completing the review questions for the associated topics, and reading through this handout.
To get started, you will need to download the starter code and unzip its contents into the directory in which you wish to complete the exercise.
2 Quadrotor Simulator
3 PD Controller
As you have seen in the lecture, the dynamic equation for the motion of the quadrotor in the z direction is
Figure 1: 1D quadrotor model.
Hence, the control input for a PD controller is
u = m(z¨des + Kpe + Kve˙ + g)
where e and ˙e can be calculated from the current and desired states (z,zdes,z,˙ z˙des).
4 Assignment
4.1 Files included in this exercise
[?] controller.m – Controller for a quadrotor. runsim.m – Test script to be called for testing. height_control.m – Simulation code that will be called by runsim. submit.m – A script to be called for generating the submitted files evaluate.p – Evaluation script to be called by submit.m fixed_set_point.m – Step response function. utils – Helper functions for quadrotor simulator
? indicates files you will need to implement
4.2 Tasks
You will need to first implement a PD controller for height control of the quadrotor. Then, tune the proportional gain (Kp) and derivative gain (Kv) in the file controller.m until the quadrotor converges quickly and smoothly to a step response input.
2
4.3 Submission and Grading
To submit your results to our server, you need to run the command submit in your MATLAB command window. A script will then evaluate your controller on two test cases and generate output files (files with the type .mat) to be uploaded to the web UI. There will be one output file for each test case. In the first test case, the quadrotor simply needs to stabilize at a height of 0. The second test case gives the quadrotor a step input of 1 meter; that is, your quadrotor will be asked to rise to a height of 1 meter. The response to this input should have a rise time of less than 1s and a maximum overshoot of less than 5%. Remember that rise time is the time it takes to reach 90% of the steady-state value, so in this case you must reach 0.9 meters in under one second. Please note that the step response is different from the exercises you have already completed. Thus, while using your position and derivative gains from a past assignment might be a good place to start, you might need to tune them further to successfully complete this assignment.
Part Submitted Files Points
Hover Control hover.mat 10
Step Response step.mat 20
Total Points 30
3




Reviews
There are no reviews yet.