Homework 2: LQR Lunar Lander

Due 2/27/2012.

This assignment is to use discrete time LQR to land a lunar vehicle. Let x denote the height of the lander above the surface of the moon. Assume that the vehicle has unit mass. Assume that the vehicle experiences a viscous drag of 0.1 (due to the solar wind). Let u be a scalar that denotes the downward thrust produced by the vehicle's engines. In this problem, we will assume that thrust may be either positive or negative (sorry, I know this is a little weird). For starters, we will assume that there is no gravity. The equation of motion of this vehicle is:

\ddot{x} + 0.1 \dot{x} = u,

where \ddot{x} denotes vehicle vertical acceleration and \dot{x} denotes vehicle vertical velocity.

In discrete time, assuming dt=1, this is:

x_{t+1} = x_t + \dot{x}_t
\dot{x}_{t+1} = 0.9 \dot{x}_t + u

1. Use discrete time LQR to compute an optimal value function and policy for landing the vehicle with a finite time horizon. At time 1, the vehicle is 100m above the lunar surface. At the final timestep, the vehicle position should be close to zero with velocity close to zero. Use the following Q and R values: Q_T = 100 * eye(2), Q_t = eye(2), R = 10.

2. Solve the same problem assuming that gravity is active. Now, the discrete time equation of motion becomes:

x_{t+1} = x_t + \dot{x}_t
\dot{x}_{t+1} = 0.9 \dot{x}_t + u - 9.81

The programming should be done in MATLAB or Octave. Students may get access to MATLAB here. Alternatively, students may code in Python (using Numpy). If the student would rather code in a different language, please see Dr Platt.

Students should submit their homework via email to the TA (zihechen@buffalo.edu) in the form of a ZIP file that includes the following:

1. Three PDFs of plots for each of the two questions showing vehicle position and thrust as a function of time for three time horizons: 20 timesteps, 40 timesteps, and 60 timesteps.

2. A text file showing output from a sample run of your code.

3. A directory containing all source code for your project.

Notes and updates:

1. The optimal policy for this system may cause the vehicle to terminate in a location slightly below the lunar surface (it overshoots the target location by a little bit). Don't worry about this.

2. Notice that I updated the above equation of motion to include a constant gravity term.

3. Notice that I changed the equation of motion back to NOT include the gravity term.

4. Notice that I added a second part to the problem.

5. Notice that I pushed the due date back to Monday, 2/27.