First programs in Python
Room TLQGNR. An example of where it fits: ZEIT1307 Computational Problem Solving, at UNSW Canberra. Notebook: first-programs.ipynb.
A first program that moves something real, then the first lesson in why programs that control things need feedback.
What students do
- Drive straight for 3 s at 0.1 m/s and measure how far the pod went.
- Turn a quarter turn by time: 0.8 rad/s for (π/2)/0.8 s.
- A square by time: four sides, four turns. It does not close.
- The same square by feedback: turn until the heading is right, drive until the distance is right.
- Your turn: any polygon, a spiral, a star, and back to where you started.
| Square | Missed its start by (three runs on the server, 2026-11-22) |
|---|---|
| By time | 21 to 27 cm, heading off by 13° to 58° |
| By feedback on the pose | 0.6 to 1.4 cm |
The point for students: commands arrive late and unevenly and the pod speeds up and slows down, so a program that trusts the clock drifts, and one that looks at where the pod is does not.
Run it, start to end
You need a laptop with a browser and a steady connection: classroom or home Wi-Fi rather than a phone hotspot.
- Download the notebook, first-programs.ipynb.
- Open it in one of these:
- Google Colab, nothing to install: go to colab.research.google.com, then File, Upload notebook, and choose the file.
- Jupyter on your laptop, with Python 3.10 or later: in a terminal, in the folder you downloaded it to, run
python3 -m pip install notebookonce, thenjupyter notebook first-programs.ipynb. - VS Code: open the file, accept the Python and Jupyter extensions it offers, and pick a Python 3.10 or later kernel at the top right.
- In the second code cell, change
MY_NAME = "your name here"to your name. The room's code is already there. - Run the first code cell. It prints
ready: it has fetched the Plato Pod client from the server. - Run the second. It prints
You are podand a number, and a Watch it link. Open the link in a tab beside the notebook to see your pod in 3D. - Run the rest one cell at a time, from the top, reading each section before you run it.
- When you are done, run the last cell,
arena.close(). It gives your pod back to the room.
If the connection drops for a moment, the notebook connects again by itself and says so. If a cell stops with an error, run it again; if that fails too, choose Restart from the Kernel or Runtime menu and run from the top. Your name gets the same pod back. The room takes six people at a time.