Exercise 4, “Improve Your Programs Together with AI!”, has been added to the RumiCar programming class textbook, “RumiCar Hands-On! Take on the Challenge of Self-Driving Algorithms”. Try developing a self-driving program for RumiCar with the help of AI!
Describe what you want in plain English, typed or spoken, and the AI rewrites the program. In this chapter you improve the programs from the earlier exercises together with an AI. The class textbook is available on GitHub.
What you do in Exercise 4
Exercise 4 has two tasks. Each one builds on an exercise you have already done.
| Task | Builds on | What you do |
|---|---|---|
| Exercise-4.1 Smooth Forward & Reverse | The challenge from Exercise-2.3 | Speed up and slow down gradually instead of jumping to full speed, so the car slips less |
| Exercise-4.2 Getting Unstuck at a Corner | Exercise-3.2 Driving in Urban Areas | Turn a car that gets stuck after hitting the wall of a curve at an angle into a car that gets itself out |
In Exercise-4.2, you think first. You have three things to work with: the values of the three distance sensors, the commands you are sending to the motor, and the time since power-on (millis()). With only these, you decide how the car can tell it is stuck and how it gets out (back up and turn), and then you tell the AI your plan.
The tool is Google’s “Antigravity CLI” (command agy), and the free plan is enough. You can also ask by voice.
You learn how to ask and how to check
The motto of this chapter is “People decide the plan, the AI writes the code, people check it.” You learn never to trust the AI’s answer blindly.
- How to ask: Compare a vague request such as “Stop it from slipping” with a request that includes your plan. A good request has three parts: what, how much, and what stays the same.
- How to check: Read the lines the AI changed (the diff) before you approve. Never approve a change you don’t understand; ask the AI to explain it.
- Safety: You do the uploading to the car yourself. For the first test, turn the power on while holding the car up in your hands.
- Choosing the numbers: The numbers in the textbook are not the best values. Tell apart the values that have a reason from the provisional ones, and decide them again on your own car and course.
If the AI’s answer differs from the sample answer, that is fine: both can be right. You pass when you can explain in your own words why it works.
Getting the textbook and preparing
The class textbook (PDF) is published in the “Hands-on text” folder on GitHub. The textbook is revised from time to time, and the date in the file name changes with each revision. The latest version is always in this folder.
- Where the latest version is: Hands-on text folder (GitHub). The English edition is the PDF whose name starts with “RumiCar Hands-on English”
- The version when this article was written: RumiCar Hands-on English 20261122.pdf (text version 3.3, 202 pages; Exercise 4 is on pages 145–172)
If the second link does not open, the textbook has been replaced by a newer version. Open the latest one from the folder in the first link. If the file is too large to preview, please download it.
Before you start, check the following.
- Update the RumiCar library to 0.7.0 or later (the examples then include Exercise-4.1, 4.2 and the sample answers)
- Install Antigravity CLI and sign in with a personal Google account (work and school accounts are not accepted)
- Age 13 and over (varies by country): use your own Google account. Younger students: use it together with a parent
The Exercise 4 examples include AGENTS.md, a file of instructions for the AI. You can continue at home, so please give it a try.
