blog · robot navigation
Why appearance-based teach and repeat converges
A robot that knows only how far it has driven, and where a few landmarks appear in its camera, can follow a taught route for kilometres without a map. Here is why its error stays bounded, with a simulation you can play with.
Teach once, repeat forever
Many robots drive the same route again and again: a delivery robot between two buildings, a farm robot along a row of trees, a patrol around a fence. Such a robot does not need a full map of the world. It only needs to remember one route and follow it. That is teach and repeat: an operator drives the route once, the robot records it, and from then on it repeats it on its own.
There are two ways to record the route. Metric systems build a map along the path and localise in it, so the robot always knows its position in metres. Appearance-based systems, the subject of this post, store no map at all. During teaching they record two things against the distance travelled, as measured by wheel odometry:
- the velocity commands the operator gave, and
- an image (or the image features) roughly every metre.
To repeat, the robot keeps counting distance. At every moment it looks up the command recorded at that distance and executes it, and it compares its camera image with the image recorded at that distance. If the landmarks appear further left than they did during teaching, it turns a little to the left, and vice versa. That is all. No map, no global position, no planner, and it is remarkably robust: our lab has run variants of this scheme through day and night and across seasons.
But it hides a puzzle. The camera only ever corrects the robot's heading. Nothing in the scheme measures how far along the route the robot really is, and the odometry that indexes the recording drifts. So why does the robot not drift away?
What the camera can and cannot see
Describe the robot's error against the taught path by three numbers: the longitudinal error x (how far ahead of or behind the recorded position it is), the lateral error y (how far to the side), and the heading error θ. Let the recorded landmarks lie at a typical distance l ahead of the robot: a few metres in a forest, tens of metres in an open field.
Comparing the two images gives one number, the horizontal shift of the landmarks, an angle κ. Turning the robot by θ slides every landmark by θ; stepping sideways by y slides a landmark at distance l by roughly y/l. So
and the longitudinal error x does not appear at all: a step forward barely moves distant landmarks sideways. The camera also cannot tell a rotation from a sideways step, because both slide the scene horizontally. The robot issues the recorded yaw rate ωr and turns against the shift with a gain α:
simulation · runs in your browser
The robot starts 2 m beside the route. It repeats the loop three times.what the camera compares · shift
closed-loop eigenvalues now ·
feature distance l ≈
error along the distance driven · longitudinal · lateral
Watch the error chart while the robot drives. Started beside the route, it swings back within a few metres: the lateral error (blue) dies out on any part of the route. Now press 4 m ahead. On the first straight nothing happens to the longitudinal error (orange), because the camera cannot see it. Then the first curve arrives and the orange line drops. A few curves later it is gone.
How a curve turns an invisible error into a visible one
The robot replays the turn recorded at the distance it thinks it has driven. If it is really 4 m ahead, it reaches the bend 4 m before it starts turning, so it overshoots to the outside of the curve. That longitudinal error has now become a lateral error, and lateral error the camera sees. The correction pulls the robot back towards the path, and the geometry of the turn trades the remaining error back and forth between the two directions while the camera keeps shrinking it.
To make this precise, write how the errors change when the robot drives at speed v and the recording turns at rate ω. For small errors, and assuming the robot drives about as fast as it did during teaching:
where sx and sy collect odometry drift and image noise. The heading loop (2) is fast and settles where the shift vanishes, at
The robot simply points at the recorded landmarks, whatever the gain α. Put that heading into (3) and the two errors obey a linear system:
with eigenvalues
These are the two blue dots in the simulation's small plot. They tell the whole story:
- On a straight (ω = 0) the eigenvalues are 0 and −v/l. The lateral error decays: it shrinks by a factor of e every l metres. The longitudinal error belongs to the zero eigenvalue, so it neither grows nor shrinks on its own; odometry drift simply adds to it.
- On a curve both eigenvalues have a negative real part, and once the curve is sharp enough they become a complex pair with real part −v/2l. Now both errors decay, and the imaginary part is the trading of error between the two directions described above.
Real routes alternate the two. Krajník et al. turned this into a theorem:
Convergence theorem. Along a route that alternates straight and curved segments, the position error of a robot repeating it this way stays bounded, and converges to a neighbourhood of the taught path whose size is proportional to the disturbances.
The simulation lets you test both halves. Set the odometry error to +8 %, so that odometry counts every metre as 1.08 m. On every straight the longitudinal error grows, as the zero eigenvalue says it must; at every curve it is pulled back. Lap after lap the error stays inside the same band instead of piling up. That is "bounded", and the band gets wider as the disturbance grows, which is "proportional to the disturbances".
What it means in practice
- Nearby landmarks help. Everything decays at a rate proportional to v/l. Switch the simulation to far (open field) landmarks and the same start offset takes several times longer to disappear. In a forest the robot converges within metres; in an open field it needs tens of metres.
- The gain hardly matters. By (4) the robot settles on the same heading whatever α is, as long as the heading loop is fast compared with how the position changes. The visual correction does not need careful tuning.
- Long straights are the weak spot. On a straight the longitudinal error can only grow with odometry drift; it is corrected at the next curve. Later systems, including our multidimensional particle filter, therefore also estimate the position along the route from the images instead of trusting odometry alone.
- The matching only needs to work. The robot needs one number from each pair of images, the horizontal shift. That is why the image matching can be swapped for one that copes with night, rain or seasons, such as the Siamese network we trained for exactly this, without touching the rest.
That is the quiet strength of appearance-based teach and repeat. There is no map to get wrong and no global position to lose, and the geometry of an ordinary route with a few bends keeps a simple, almost naive controller on the path.
Where this comes from
- T. Krajník, F. Majer, L. Halodová, T. Vintr: Navigation without localisation: reliable teach and repeat based on the convergence theorem. IEEE/RSJ IROS, 2018. The theorem and its proof.
- T. Krajník, J. Faigl, V. Vonásek et al.: Simple yet stable bearing-only navigation. Journal of Field Robotics, 2010. The original bearing-only scheme.
- Z. Rozsypálek et al.: Multidimensional particle filter for long-term visual teach and repeat in changing environments. IEEE RA-L, 2023.
- Z. Rozsypálek et al.: Contrastive learning for image registration in visual teach and repeat navigation. Sensors, 2022.
About the simulation: a point robot at 1 m/s with no actuator delay, a camera with an 85° field of view, and landmark shifts taken as the median over the landmarks seen in both images, as in the real system's histogram voting. Errors are measured against the recorded pose at the odometry distance.