Family edition
Drone Simulator: Program a Drone Through the Rings
Your child runs a short program that flies a drone through six rings, then reads it block by block and finds that each block is a place in the sky, given as three numbers. They change one number at a time, say which ring the drone will miss before they press Run, and check. At the end you hide a bug in the program for them to find, and they hide one for you.
What you need
- A computer or Chromebook with a current browser. It draws in 3D, so an older computer runs it more slowly but gets the same result.
- The lesson link: mytekdev.com/try/dronesimulator?lesson=program-a-drone-through-the-rings&ref=fam-drone-1. No account, no email and nothing to install.
- Optional: the activity sheet at the end of this plan, printed, and a pencil, for writing each prediction down before Run.
Before you start: try it once yourself
Fly the course and make the lesson's changes yourself once before you start, about ten minutes.
- Open the lesson. Go to mytekdev.com/try/dronesimulator?lesson=program-a-drone-through-the-rings&ref=fam-drone-1. The app opens on the Simulator with six orange rings. Press Run, the play button at the top left. Each ring turns green as the drone flies through it, and the counter at the top of the 3D view ends at Course Complete! with 6 / 6.
- Read the program. Open Blocks: arm drone, takeoff to 22, six fly to blocks, land. The first fly to block is x 0, y 70, alt 22.
- Miss ring 1. Change the first block's x from 0 to 30. Go back to Simulator, press reset, the circle arrow next to Run, then Run. Ring 1 stays orange, the other five turn green, and the counter stops at Gates: 5 / 6. Set x back to 0.
- Miss ring 3. Change the third block's x from 18 to -18, reset and Run. Ring 3 stays orange. Set it back to 18.
- Skip ring 4. Change the fourth block's alt from 30 to 60, reset and Run. The drone flies over ring 4. Set it back to 30.
The starter program. Each fly to block aims 10 past one ring: the rings are at 60, 120, 180, 240, 300 and 360 forward.
The ideas, in plain words
A program is a sequence: the drone runs one block, finishes it, then runs the next, top to bottom. Each fly to block names a place in the sky with three numbers, the way a street address names a house: x is left and right, y is forward, and alt is the height. The block does not say how to get there; the drone works that out and flies straight to the spot.
Because each block names a place rather than a move, the blocks do not depend on each other. Change one block and the drone goes somewhere new for that one leg, then the next block sends it back to the next ring. That is why one wrong number leaves exactly one ring orange, and why your child can find a bug by reading: match each block to its ring and look for the number that does not fit.
| Your child might ask | A good answer |
|---|---|
| Why is y forward and not up? | Think of x and y as a map lying flat on the ground. Height gets its own number, alt. |
| Why does the block say 70 when the ring is at 60? | It aims just past the ring, so the drone flies through it and out the other side instead of stopping in it. |
| Why does only one ring stay orange? | Each fly to block aims at one ring. The next block still aims at the next ring, so the drone gets back on course. |
| Why are some x numbers negative? | The middle of the course is x 0. Positive numbers are on one side of that line and negative numbers on the other, so 18 and -18 are the same distance from the middle on opposite sides. |
Do it together
- Open mytekdev.com/try/dronesimulator?lesson=program-a-drone-through-the-rings&ref=fam-drone-1 together. The app opens on the Simulator with six orange rings. A short guide runs along the bottom; follow it together. It has your child press Run, the play button at the top left, then look in Blocks and come back to the Simulator. Then ask: how does the drone know where each ring is?
You'll know it worked when: Each ring turns green as the drone flies through it, the drone lands, and the counter at the top of the 3D view ends at Course Complete! with 6 / 6.
- Open Blocks again and read the program from top to bottom together: arm drone, takeoff to 22, six fly to blocks, land. The steps run in order. The first fly to block says x 0, y 70, alt 22: x is left and right, y is forward, and alt is the height. Ring 1 is 60 forward and 22 high, and the block aims at 70 so the drone flies through the ring and out the other side.
You'll know it worked when: Your child can point to a fly to block and say what each of its three numbers means.
- Change the first block's x from 0 to 30, and ask which ring will stay orange. Then go back to Simulator, press reset, the circle arrow next to Run, and press Run. Set x back to 0 afterward.
If you get stuck: Run and reset are only on the Simulator tab, so after every change in Blocks, switch back. If the drone flies back down the course, it was not reset first.
You'll know it worked when: Ring 1 stays orange, the other five turn green, and the counter stops at Gates: 5 / 6.
- Predict, then test. Find the third fly to block (x 18, y 190, alt 22) and change its x to -18. Before Run, your child writes or says which ring will stay orange. Then reset and Run, and set it back to 18.
You'll know it worked when: Ring 3 stays orange, because the drone now flies to the other side of it, and the rings before and after still turn green.
- A challenge: make the drone skip ring 4 without deleting any blocks.
You'll know it worked when: The drone misses ring 4 and passes the rest. Raising the fourth block's alt from 30 to 60 flies it over the ring, and other changes work too.
- Play the secret change game. One of you changes one number in one fly to block while the other looks away, and writes the change down. The other reads the blocks, says which ring will stay orange, then presses reset and Run, fixes the number and runs it again. Swap roles. The prediction always comes before Run.
If you get stuck: Keep the secret change in Blocks. Typing in the Python tab brings up a warning, and after that Run ignores the blocks, so fixing the block changes nothing.
You'll know it worked when: Your child names the ring before pressing Run, by matching each block to its ring. That means they can read a program and know what it will do before running it.
- Finish with one question: ring 2 stays orange. Which block would you check first, and why?
You'll know it worked when: Your child says the second fly to block, because each block aims at one ring.
Talk about it
Ask these while you work together. A child who has understood the lesson can answer them without help:
- Point to the block that sends the drone through ring 3. What do its three numbers mean?
- Why do you press reset before Run?
- You changed one number. Which ring will stay orange? Say it before you run it.
- How did you make the drone skip ring 4 without deleting a block?
- Someone changed one number in secret. Which ring will stay orange?
For younger and older kids
Younger: For ages 7 and 8, do the ring 3 test side by side and the ring 4 challenge together, and save the secret change game for another day.
Older: For teens, work in the Python tab and write the secret change as a line of Python. Then explain in a few sentences why each fly to aims 10 past its ring, and what would happen if it aimed at the ring's center.
Keep going
- Open the Python tab and find the line that is the block you changed. Change a number there and Run it.
- Open Missions and press Start on Ring Runner. Fly all six rings in under 75 seconds for gold: try set speed in the Movement blocks.
- Add a seventh fly to block that flies back over the course and lands at the start.
Bring it into other subjects
- Math: the rings are 60 apart going forward. Make a table of each ring's forward number (60, 120, 180, 240, 300, 360). What is the pattern, and where would ring 7 be? (Add 60 each time; ring 7 would be at 420.)
- Math: a graph has two coordinates. Why does a drone need three? (Because it can also go up and down: height is the third.)
- Science: press the sun button in the Simulator, set Weather to Windy, then reset and Run. Does the drone still pass every ring? Why might wind push it off? (Answers vary: wind pushes the drone sideways while it flies.)
- Computer science: open the Python tab. Each fly to block is one line, drone.fly_to(x, y, alt). Find the line for ring 3. (drone.fly_to(18, 190, 22))
For your records
Ready to copy into an hour log, a portfolio or a transcript.
| Lesson | Drone Simulator: Program a Drone Through the Rings |
|---|---|
| Subjects | Computer science, Math |
| Time | 45 minutes |
| What we did | Read a block program that flies a drone through six rings and learned that each block names a place with three coordinates. Predicted which ring each change would make the drone miss, tested every prediction, and found and fixed a hidden bug by reading the program. |
| Skills practiced | sequences in a program; 3D coordinates (x, y and height); predicting before running; debugging by reading code |
Drone Simulator: Program a Drone Through the Rings
Activity sheet (optional)
Name: ______________________________ Date: ______________
Open the app: scan the QR code, or go to mytekdev.com/try/dronesimulator?lesson=program-a-drone-through-the-rings
Essential question: How does a program tell a drone where to fly?
- Run it. Press Run, the play button. Watch the six rings turn green.
- Read a block. Open Blocks. The first fly to block says x ____ y ____ alt ____. x is left and right, y is forward, alt is height.
- Reset first. Before every Run, press reset, the circle arrow, so the drone starts over.
- Predict, then test. For each change, write your prediction first. Then reset, Run, and write what happened. Change it back after.
| Change | I predict this ring stays orange | What happened |
|---|---|---|
| 3rd fly to: x 18 to -18 | ||
| My change to skip ring 4: | ||
| The secret change I found |
1. How did you make the drone skip ring 4 without deleting a block?
2. Which prediction surprised you most, or was wrong? Why?
Quick check
Name: ______________________________
1. In the block fly to x 0 y 70 alt 22, what does 22 tell the drone? (A) how far forward to go, (B) how high to fly, (C) how fast to fly.
2. You change the x of the fifth fly to block and press reset and Run. What is most likely to happen? (A) the drone misses ring 5 and passes the others, (B) the drone misses every ring, (C) nothing changes.
3. Ring 2 stays orange in someone else's program. Which block would you check first, and what would you look for?
Answers
Measured in the app: changing one number in one fly to block makes the drone miss that block's ring only, and it still passes the others and lands. The first block's x changed to 30 misses ring 1; the third block's x changed to -18 misses ring 3; the fourth block's alt changed to 60 skips ring 4.
| Question | Answer | Why |
|---|---|---|
| 1 | B | alt is the altitude, the height. The other two numbers are x, left and right, and y, forward. |
| 2 | A | Each fly to block aims at one ring. Moving that block's x sends the drone beside ring 5, and the other blocks still aim at their rings. |
| 3 | The second fly to block. Look for a number that does not match ring 2: its x, its y or its alt | A good answer names the second fly to block and one of its numbers to check. |
If your state or umbrella school asks, this lesson covers CSTA 2017 1B-AP-10, CSTA 2017 1B-AP-15, CSTA 2017 2-AP-17, Common Core Math 5.G.A.1.
The Drone Simulator is built on GEARS (GearsBot) by Cort Wee, open source under the GNU General Public License 3.0. Its blocks are Blockly, its 3D view is Babylon.js and its Python runs in Skulpt.