Professional Documents
Culture Documents
Staggering Proportions: Design Lab 5 6.01 - Spring 2013
Staggering Proportions: Design Lab 5 6.01 - Spring 2013
Staggering Proportions: Design Lab 5 6.01 - Spring 2013
1 Proportional wall-follower
We wish to drive the robot at a constant forward velocity of V = 0.1 m/s along a wall. To maintain a constant distance between the robot and wall, we will steer left if the robot is too close to the wall and steer right otherwise. We will think about this problem as a control problem in which we set the rotational velocity [n] (not shown) to reduce the error between the desired distance di [n] = 0.5 m and the actual distance do [n]. Then if the error e[n] = di [n] do [n] is positive (indicating that the robot is too close to the wall), we will set [n] to be positive, which will steer left (which increases [n], and ultimately increases do [n]).
[n 1] do [n] do [ n 1 ]
wall
VT
desired path
di [n] = 0.5 m
Edit the le wallFollowerBrain.py to implement a proportional controller. We have provided a procedure called sonarDist.getDistanceRight to calculate the perpendicular distance to the wall from inp.sonars, as follows. If both sonars 6 and 7 hit the wall (as indicated by values less than sonarMax), then these hits establish a straight line, from which the perpendicular distance is calculated. If only one of sonars 6 and 7 hit the wall, then that sonar distance is returned (since we cannot triangulate the position of the wall). If neither of sonars 6 and 7 hits, then None is returned. Test your code by using soar in wallFollowerWorld.py. Notice that the brain has code to plot the distance to the wall as a function of discrete time (where one step is 0.1 seconds) after the brain has been stopped. Experiment with a few values of the gain of your proportional controller to determine how gain aects the resulting behavior. For each oscillatory response, determine the period of the oscillation, and enter the gain and period in the table below. Save plots for three values of gain to illustrate the trends that you found.
Design Lab 5
period
Checko 1.
Show your three plots to a sta member. What quantities (and units) are represented on the x and y axes? Describe how the gain K aects behavior of the wall-follower. What value of K is best, and why? Compare the eect of K in this lab and in Design Lab 4 (wall nder).
Di
error
controller
command sensor
plant
Do
Design Lab 5
2.2.1 Plant 1
Write an expression for [n], the robots angular orientation with respect to the wall, that depends on its rotational velocity. Assume that the rotational velocity at time n 1 is [n 1], and that this rotational velocity is constant until time n. Also assume that the time between steps is T .
2.2.2 Plant 2
Write an expression for do [n], that depends on angular displacement. Assume that the angular displacement at time n 1 is [n 1], and that this angular displacement is constant until time n. Assume that the forward velocity is constant, at V m/s. Linearize the resulting dierence equation using the small angle approximation (i.e., if is small, then sin ). This approximation makes our model linear, allowing us to analyze it easily. It may be useful, however, to think about the consequences of this approximation when trying to account for behaviors in subsequent sections.
Design Lab 5
+
Convert your dierence equations into operator (R) equations, and nd the system functional.
H=
Do = Di
DL05/sf
2.5 Poles
Find an algebraic expression for the poles p of the system.
p=
Design Lab 5
real part
imaginary part
Re
Checko 2.
Describe the poles of the wall follower system. How does the gain K aect the poles? What are the implications of the poles for system behavior? Explain the extent to which these implications are consistent with the results from Checko 1.
Design Lab 5
3 Software model
In this weeks software lab, you implemented a SystemFunctional class to represent and analyze the performance of linear, time-invariant systems. We can use that class to automate much of the preceding algebra, which is especially useful for large systems that would be dicult to analyze by hand. Write a procedure called wallFollowerModel to model the behavior of the wall follower system. The procedure should take a single input, which is the gain K, and return the corresponding system functional (where T = 0.1 second and V = 0.1 m/s). We have provided a template le called wallFollowerModel.py. The template le will automatically load the sta version of the SystemFunctional class and associated procedures from this weeks software lab. You can access these classes and procedures as sf.SystemFunctional, sf.Cascade, sf.FeedbackAdd, sf.Gain, and sf.R. We have also provided a procedure called sf.FeedbackSubtract, which is similar to sf.FeedbackAdd except that the feedback path is subtracted (instead of being added) to the input. We recommend that you use the sta versions while you are developing your new code. If you have time at the end of this lab, it would be very cool to use your own versions of this code instead of ours. DL05/model Enter the denition for wallFollowerModel and any procedures it calls into the tutor.
Dene a SystemFunctional for each of the values of K from Checko 1. Use the dominantPole method to determine the period that corresponds to each gain. Enter results in the following table. Trigonometric functions and other math utilities are available in the math module (e.g., math.atan2).
dominant pole
Checko 3.
Show your results to a sta member. Explain similarities and dierences between your results in this part and your results in Checko 1.