This summer I built a motion planner for robot vehicles in just over a week: about three thousand lines of C, 243 tests, and four kinds of vehicle. I did not type a single line of it myself. All of it was written in sessions with an AI agent (Claude Code), and I steered: specifying, reviewing, breaking things, redirecting.
The most instructive thing about that project is not in the code. It is in this one fact: every behavioural bug was found by a human driving the GUI, not by the agent. Every single one, while all the tests were green.
But first: what is it?
What it is: a path follower that knows motors are slow
For the Omnibot project at Fontys ICT we have an electric quad: rear-wheel drive, car-style steering on the front wheels, an NVIDIA Orin for planning and an ESP32-P4 for real-time control. It has to follow a path neatly.
The standard solutions, such as pure pursuit and Stanley, assume the vehicle does what you ask, at the moment you ask it. But our steering servo turns at most about 86 degrees per second, and the speed control has a lag of about 0.8 seconds. Ask for a steering angle and you get it a quarter of a second later. At 3 m/s that is 75 centimetres further on. By then you are already in the kerb.
The answer is model predictive control (MPC): simulate a number of possible futures with a model of how the vehicle really responds, and pick the best one. The usual MPC reaches for a heavy optimisation library for that. I set a hard requirement:
No external maths libraries, no solver, no matrix inversion. Only
sin,cosandtan.
Not out of purism, but because the same code has to run on the planning computer and later on the microcontroller, and because a student has to be able to understand it at two in the morning.
That works if you only generate movements the vehicle can physically make. Then optimising comes down to little more than "simulate lots of futures and take the cheapest". There are two variants in the code: a fixed grid of candidates (predictable, ideal for tests) and MPPI, which simulates 256 random variations around the previous solution and averages them cleverly. MPPI drives best.
Why it is fun: the vehicle brakes by itself
This is where the beauty is for me. Nobody programmed a rule that says: slow down before a corner. The model knows the steering servo can only turn so fast. Drive too fast and every simulated future misses the corner, so the cheapest one is automatically the future in which the vehicle slowed down earlier. The behaviour follows from the physics.
A second surprise is geometric. In a corner, the inner rear wheel always runs inside the line the front wheel draws. On our vehicle, at full steering lock, that is 25 centimetres. For a vehicle driving next to a kerb, those 25 centimetres are the whole problem. That is why the planner checks all four wheels, not just the centre of the vehicle. Hence the name: no cutting corners.
![]()
Off-tracking, simulated with the real C model: the rear wheel (orange) runs 25 cm inside the track of the front wheel. The figure labels are in Dutch.
A few numbers from the paper:
- One MPPI computation with 256 variations takes 3.2 ms on a single core of a 2017 laptop. So the Orin has plenty of headroom.
- Docking (stopping neatly at a target pose) is accurate to 0.9 to 4.6 cm, for all four vehicle types.
- Ackermann, skid-steer, differential drive and a three-wheeled omni robot sit behind one interface. Adding a new vehicle requires no change at all to the solvers or the GUI.
And there is a playground: a GUI with sliders where you drag walls and waypoints around and immediately see what the planner does. That GUI runs exactly the same C library as the tests. Nothing was rebuilt in Python, and every figure in the paper comes from the real solver.

Why it matters: six bugs the agent did not see
Back to that one fact. Six behavioural bugs were found, and all of them were found by a human playing with the GUI:
- a crash when switching to the omni robot;
- a vehicle that kept circling the goal, because circling was cheaper than stopping;
- a vehicle that kept creeping forward a tiny bit forever after reaching the goal;
- getting stuck in corners sharper than 90 degrees;
- freezing next to a wall that had been dragged into a bend;
- a dangerous back-and-forth shuffle when a differential drive docked.
Every time, the test suite was green. They share the same shape: it is behaviour that only exists in the closed loop, over many seconds, in a situation nobody had thought of writing a test for.
The seventh is perhaps the best one, because it was not a bug at all. After a fix, a screenshot seemed to show the problem was still there. But the GUI had been running since before the rebuild and still had the old library in memory. An afternoon gone. Since then the Help → About menu shows which file is actually loaded. When a human and an agent debug together, make the tool say what it is really running.
What did work well, and is worth copying?
- A plan document before every phase, with references and an explicit list of what is out of scope. You then have the architecture discussion in prose, where being wrong is cheap.
- Test-driven development on the PC. Pure C modules without hardware, so every claim about behaviour can be checked in under a second.
- Measure first, then encode. Test limits were set by measuring first and then freezing that value. Numbers you invent to make a test pass are worse than no test at all.
What this means for education
I work with students at Fontys ICT, and this project is also a data point in a question that keeps me busy: what does good education in embedded software look like when there is an AI agent in the room?
The agent delivers structure, tests, documentation and consistency across a C codebase of many files, at a pace no student can match. What it does not deliver is the suspicion that makes someone drag a wall into a bend just to see what happens. If that is the skill that remains, our assignments should be built around it. Less "write this function", more "try to break this system and explain why it failed".
Where are we now?
The planner works in simulation and has been tested thoroughly there. Two things are still open, and they are written up rather than waved away:
- Robustness. In simulation, the vehicle is the model. In reality, grip changes with the surface and response time changes with battery voltage. The plan is to measure first, then add a simple correction, and only then consider heavier methods.
- Real hardware. Every actuator value is still an estimate until we have measured the step response on the real vehicles.
The code is open source (AGPL-3.0), and the documentation and figures are free to use in teaching material (CC BY-SA 4.0). The full paper, dead ends included, is in the repository: chat-l18l/no_cutting_corners_with_AI.
This article is part of the series Building with AI agents: projects I build together with AI agents. That link takes you to every part of the series, including new ones.
Lees dit artikel in het Nederlands: No Cutting Corners: wat de AI-agent níet vond
Reacties