0% found this document useful (0 votes)
1K views3 pages

Assignment1 Writeup

This document provides instructions for a programming exercise involving implementing a PD controller to control the height of a quadrotor simulator. It describes downloading starter code, running the simulator, and implementing a PD controller in the file "controller.m" to control the quadrotor's height based on its position and velocity errors relative to a desired height. Students are tasked with tuning the PD gains to stabilize the quadrotor at a desired height and respond to a step input with a rise time under 1 second and overshoot under 5%. Running "submit.m" will generate output files to submit for grading based on hover and step response performance.

Uploaded by

Vinoth Kumar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
1K views3 pages

Assignment1 Writeup

This document provides instructions for a programming exercise involving implementing a PD controller to control the height of a quadrotor simulator. It describes downloading starter code, running the simulator, and implementing a PD controller in the file "controller.m" to control the quadrotor's height based on its position and velocity errors relative to a desired height. Students are tasked with tuning the PD gains to stabilize the quadrotor at a desired height and respond to a step input with a rise time under 1 second and overshoot under 5%. Running "submit.m" will generate output files to submit for grading based on hover and step response performance.

Uploaded by

Vinoth Kumar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

Programming Exercise 1:

Quadrotor Simulator and PD Controller

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.

Quadrotor Simulator

We utilize one of MATLABs ODE solvers, called ode45, to simulate the behavior of the
quadrotor.You can read more details at Mathworks or other online resources. We then use
the function plot/plot3 to help visualize the current state of the quadrotor at each time
step. You may take a look at file height_control.m for the simulation code.
Before implementing your own function, you should first try running runsim.m in your
MATLAB setup. If you see a quadrotor falling from the height 0, then the simulator is
running smoothly on your computer and you may continue with other tasks. The supplementary segment Supplementary Material: Getting Started With the First Programming
Assignment walks through these steps. The starter code for the controller (controller.m)
produces robot inputs which are all zero thrust and thus the quadrotor falls due to gravity.

PD Controller

As you have seen in the lecture, the dynamic equation for the motion of the quadrotor in
the z direction is
u
g
z =
m

Figure 1: 1D quadrotor model.


Hence, the control input for a PD controller is
u = m(
zdes + Kp e + Kv e + g)
where e and e can be calculated from the current and desired states (z, zdes , z,
zdes ).

4
4.1

Assignment
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.

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%. 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
20
Step Response step.mat
Total Points
30
You may submit your results multiple times, and we will count only the highest score towards
your grade.

You might also like