Unformatted text preview:

6.081, Spring Semester, 2007—Work for Week 5 1MASSACHVSETTS INSTITVTE OF TECHNOLOGYDepartment of Electrical Engineering and Computer Science6.081—Introduction to EECS ISpring Semester, 2007Work for Week 5Issued: Tuesday, March 6This handout contains• Software Lab for March 6th• Prelab exercises due Thursday March 8th before lab• Post-lab exercises due Tuesday March 13th in Lecture.Dynamic Feedback ControlIn many of the labs so far, you developed progressively more sophisticated approaches for measuringthe robot’s environment, as well as progressively more intelligent approaches to controlling therobot’s actions based on those measurements. In those labs, our primary goal was to have youlearn a little about the robot as well as have you investigate some ideas in software engineering. Inthis lab, we will also be using measurements to control the robot, also k nown as feedback control,but we will be investigating a situation in which detailed analysis is needed to achieve a desiredperformance. The problem we are asking you to investigate is how to control the robot so th at itdrives down the center of a narrow corridor at a constant forward velocity. Such a task is similarto what an automobile driver does when keeping a car on the road. We will suggest a simplefeedback scheme to keep the robot in the center of corridor, and ask you to develop and analyzea mathematical mod el based on difference equations that explains the beh avior of that simplefeedback system. In n ext week’s lab, you will use more sophisticated mathematical tools to developimprovements to the simple feedback scheme suggested in this lab.The summary of tasks for this week are:• Post-lecture software lab on solving second order difference equations• Pre-lab tutor exercises to practice solving difference equations• Robot lab on implementing and analyzing a simple feedback scheme• Post-lab writeup and exercises due Tuesday in lecture.Tuesday’s Software Lab: Solving second-order difference equationsFor this lab, you will be writing a python program that solves arbitrary second-order homogeneousdifference equations analytically, by computing natural frequencies. Your program should take asinputs the initial values x[0] and x[1] as well as co efficients a1and a2for the difference equation inthe formy[n] = a1∗ y[n − 1] + a2∗ y[n − 2].Your program should print out the solution to the difference equation and also return a procedu rethat, when called with n, returns y[n]. For example, if the difference equation isy[n] = 2 ∗ y[n − 1] − 2 ∗ y[n − 2],6.081, Spring Semester, 2007—Work for Week 5 2and the initial conditions are y[0] = 0, y[1] = 1, your program should print something equivalenttoy[n] = (2.77555756156e-017+0.5j)*(1-1j)**n + (-2.77555756156e-017-0.5j)*(1+1j)**nand your program sh ou ld ALSO return a function which can be used to evaluate y[n] for any n.Getting StartedTo save time, you should use our imp lementation of the polynomial manipulation p rogram fromthe recent post-lab exercises in your second-order difference equation solver. Please downloadimportPolynomial.py and polynomial.pyc. Executing the module importPolynomial.py in IDLE willimport our version of the polynomial manipulation routines implemented in the class Polynomial.You can see the class interface by typinghelp(Polynomial)at the IDLE command line. Note that the Polynomial class has functions to add, multiply, printand find the roots of polynomials.Demonstrate to your LA that you understand the Polynomial class. Then, before you wr ite anyco de, describe your app roach to the difference equation solver to your LA.A note on complex numbersFor this problem, your procedure will sometimes need to compute znwhere z is a complex number.Python understands complex numbers to some extent, but you have to write them in the forma + bj, where a is the real part and b is the imaginary part. Note that Python uses the conventionthat j =√−1. T his should not surprise you, as entering EECS students, you already appreciatethat the variable i must be reserved for electrical current.So, for example, the Python command(-4)**0.5will produce an error, but the Python command(-4+0j)**0.5produces (1.2246063538223773e-016+2j). (Why the very small real part?)Note: use y**0.5 to compute the square root of a number. The python sqrt() function does notunderstand complex numbers.6.081, Spring Semester, 2007—Work for Week 5 3Demonstrate that your program worksUse your program to solve the difference equationy[n] = 2 ∗ y[n − 1] − 2 ∗ y[n − 2],using the initial conditions y[0] = 0, y[1] = 1. Demonstrate to your LA th at the program printsthe correct inf ormation and also returns the correct p rocedure.Use your program t o find difference equations with given propertiesUse your program to find a difference equation whose solution oscillates rapidly, but the amplitudeof the oscillation decays slowly. Use your program to fin d a difference equation whose solutionoscillates rapidly, but th e amp litud e of the oscillation remains constant.What to t urn inFor this software lab, hand in a brief (few page) lab report along with your post-lab report onMarch 13th. Also, hand in a copy of your carefully commented python cod e with an explanation,written in actual English sentences, of how and why it works.Homework in preparation for Thursday’s labThis section includes p roblems to complete with the online tutor. These are due before lab onThursday. The examples are to help you solidify your understanding of difference equations.Read the entire document!Please read the entire section on the lab before coming to lab.Exercises with the online tutorUse the online tutor to complete the problems due Thursday, March 8th.Thursday’s LabAs we are sure you have come to expect, Thursday’s lab will end with a nano-quiz that is basedboth on tutorial problems due on thursday, and on material covered this week. It should be nogreat s urprise that you will be asked a question about the solution to a difference equation. Pleasekeep in mind that the point of the quizzes is as a d iagnostic f or us (did we succeed in teachingyou?) and to encourage you to do the tutorial problems before coming to lab and participate inlab.6.081, Spring Semester, 2007—Work for Week 5 4Figure 1: Robot in corridor.Robot Feedback SystemIn this lab you will be contr olling the r obot to drive down a narrow corridor as shown in Figure 1.Notice that in the figure,


View Full Document

MIT 6 01 - Dynamic Feedback Control

Documents in this Course
Week 1

Week 1

3 pages

Op-Amps

Op-Amps

8 pages

Op-Amps

Op-Amps

6 pages

Syllabus

Syllabus

14 pages

Planning

Planning

14 pages

Load more
Download Dynamic Feedback Control
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Dynamic Feedback Control and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Dynamic Feedback Control 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?