+
Lunar Lander
Developed by Aaron Titus  Published July 16, 2016
The goal of these exercises is to control a primitive version of an Apollo lander and land on a target on the Moon using vertical and horizontal thrusters. The three thrusters can provide a constant force in the $+x$, $x$, and $+y$ directions, respectively. Only one thruster can be engaged at a time.
Besides modeling the motion of the Apollo lander, the exercises are a "game" in which the user attempts to control the lander and meet the challenge of landing on a given target with minimal speed.
![apollo](./images/lunarlander/apollo.jpg)
Subject Area  Mechanics 

Levels  First Year and Beyond the First Year 
Available Implementations  Glowscript and Easy Java Simulations 
Learning Objectives 
Students will be able to:
1. Model rocket motion with constant thrust, constant mass, and constant gravitational field. (**Exercises 12**)
2. Incorporate keyboard interactions (or other input) into a simulation. (**Exercises 12**)
3. Incorporate fuel burn rate into the model. (**Exercises 35**)
4. Test the model by comparing a numerical computation for a vertically descending rocket with constant fuel burn rate and constant gravitational field to an analytic solution. (**Exercise 5**)

Time to Complete  120 min 
These exercises are not tied to a specific programming language. Example implementations are provided under the Code tab, but the Exercises can be implemented in whatever platform you wish to use (e.g., Excel, Python, MATLAB, etc.).
### Exercise 1: Landing on a Given Target
Your goal is to control the lander and land on the target within the safe landing speed and within the safe landing zone.
Use the following parameters:
 Parameter  Value 
    
 Total initial mass including fuel  $1\times10^4$ kg 
 Initial mass of fuel  $8\times10^3$ kg 
 Fuel burn rate  0 kg/s 
 Height of lander  3 m (CM is 1.5 from the bottom of the lander) 
 g  1.6 N/kg 
 Thrust of an engine  $4.8\times10^4$ N (3 times the initial weight) 
 Initial velocity  $<0,0,0>$ m/s 
 Initial position  $<10,50,0>$ m 
 Target position  $<10,0,0>$ m 
 Safe landing speed  less than 1 m/s 
 Safe landing zone  $\pm1$ m of center of target 
It is best to use keys on the keyboard to turn on or off the thrusters.
Define the position of the lander as its center of mass (CM) position. Define "landing" as when the bottom of the lander reaches the surface of the Moon. Thus, if the lander starts at $y=50$ m and lands with the CM at 1.5 m, then its displacement is actually 48.5 m.
### Exercise 2: Adding a Third Dimension
Add two engines in the $\pm z$ directions. Use the following initial conditions for the lander.
 Parameter  Value 
    
 Initial velocity  $<0,0,0>$ (m/s) 
 Initial position  $<10,50,40$ (m) 
Repeat the challenge of landing on the target within the safe landing zone and safe landing speed. You will need to define two more keys to control the two additional engines.
### Exercise 3: Adding Loss of Fuel
Suppose that the burn rate of fuel $dm/dt$ is constant and nonzero. This represents the change in mass of the system (lander structure and fuel) per second as an engine is firing. Edit your simulation to include a burn rate of $500$ kg/s. If the lander burns all of its fuel, be sure to make the thrust zero. To make the game more interesting, you can increase the absolute value of the burn rate and see if you can land within the safe limits before running out of fuel.
Use your simulation to answer the following questions:
1. As thrusters fire in various directions while you control the lander, does the magnitude of the gravitational force on the lander increase, decrease, or remain the same? Explain your answer.
2. Suppose the vertical thruster is constantly firing for a long time. As it is firing, does the yacceleration of the lander increase, decrease, or remain the same? Explain your answer.
### Exercise 4: Graphing Data
Create a graph to plot either $F_{grav}$ or $a_y$ as a function of time. Check your answers to the questions in Exercise 3 by viewing the graph as you operate the lander. Explain whether your answers in Excercise 3 were correct or incorrect and how you determined this.
### Exercise 5: Comparing to an Analytic Solution
For the simple case of a lander traveling vertically using only its vertical thruster as it lands, you can derive an analytic function for the lander's yvelocity as a function of time. Use the following initial conditions for the lander.
 Parameter  Value 
    
 Initial velocity  $<0,20,0>$ (m/s) 
 Initial position  $<0,50,0>$ (m) 
 Mass burn rate  $500$ kg/s 
If the vertical thrust is constant and is engaged during the entire vertical descent, what is the yvelocity of the lander when it hits the surface of the Moon? Solve the problem analytically. Then, simulate it. Compare the numerical result to the analytic result.
What is the necessary minimum speed of the rocket at its initial position $y=50$ m so that firing its vertical thruster for the entire descent will cause the rocket to land with nearly zero velocity?
Download Options
Share a Variation
Did you have to edit this material to fit your needs? Share your changes by
Creating a Variation
Credits and Licensing
Aaron Titus, "Lunar Lander," Published in the PICUP Collection, July 2016.
The instructor materials are ©2016 Aaron Titus.
The exercises are released under a Creative Commons AttributionNonCommercialShareAlike 4.0 license