Lite / Intelligent Robotic Systems / Week 14
Navigating with transforms: from map to cockpit
A drone's flight plan lives on a map; its motors only understand 'forward' and 'left'. What converts one into the other, fifty times a second?
Why should I care?
This is the aerospace payoff of the transform maths. A vehicle's pose is one transform, T_world←body. Its inverse puts the mission (waypoints, no-fly zones, landing pads) into the vehicle's view; the transform itself puts what the sensors see onto the map. Every autopilot, rover and spacecraft guidance loop runs this pair constantly.
- Write a vehicle's pose as a homogeneous transform from heading and position.
- Convert a world waypoint into the body frame with the inverse transform, and a body-frame sensor reading into the world.
- Use body-frame coordinates to make simple steering decisions.
Predict
A rover's camera sees a rock 3 m dead ahead. The rover is at (10, 5) m heading north. Where is the rock on the map?
- (13, 5)
- (10, 8)
- (7, 5)
- (10, 2)
Guess first, then reveal
(10, 8). Heading north means forward is +y on the map, so 3 m ahead is (10, 5 + 3). (13, 5) treats 'forward' as east: the classic frame mix-up.
Discover
Place the aircraft at (−4, −4) km, heading 30°, target CHARLIE. Compute CHARLIE's body coordinates yourself with the inverse transform (subtract the position, rotate by −ψ where ψ = 90° − heading). Check the readout. Then 'fly' to it using only the body-frame numbers: turn when 'left' is large, move when it's ahead.
What the interactive shows (text version)
The diagram gives the target's position in the world frame (distance and bearing) and in the body frame (kilometres ahead and to the left or right), plus the turn needed. Two buttons turn the vehicle towards the target and move it 2 km forward, so the approach can be flown step by step from the readout alone.
Watch (optional)
Watch for: Watch for how the rover decides its next move from what is in front of it (body frame) while following a route planned on a map (world frame).
In one minute, NASA engineers explain why rovers can't be joysticked from Earth and must plan drives carefully.
“Mars in a Minute: How Do Rovers Drive on Mars?” by NASA Jet Propulsion Laboratory (opens YouTube; streaming video uses a lot of data)
The video is optional. Everything you need is in this lesson's text.
Understand
Pose as a transform
With ψ = 90° − heading (the nose's maths angle) and position (x, y): T_W←B = [cos ψ −sin ψ x; sin ψ cos ψ y; 0 0 1]. Body-frame points (forward f, left l, 1) go in; map points come out. A sensor that reports 'rock at 3 m ahead, 1 m left' becomes a map point with one multiplication.
The inverse brings the mission aboard
p_B = T_W←B⁻¹ · p_W: subtract the vehicle's position, then rotate by −ψ. Forward = d·(cos ψ, sin ψ), left = d·(−sin ψ, cos ψ), where d is the vector from vehicle to waypoint. Those are just dot products with the vehicle's forward and left directions.
Steering from body coordinates
Body coordinates make decisions easy: left > 0 means steer left, forward < 0 means the target is behind (turn round), and atan2(left, forward) is the angle to turn (positive = left). A simple guidance law commands a turn rate proportional to that angle. Wind, sensor noise and limited turn rates are what make real autopilots harder.
Explain it another way
Intuitive
The map is the mission; the cockpit is the vehicle's view. The pose transform is the window between them: look through it one way and you see map points as 'ahead and left'; look the other way and the camera's view lands on the map.
Technical
The guidance loop: estimate pose T_WB (from GPS, inertial sensors or visual odometry), compute p_B = T_WB⁻¹p_W for the active waypoint, compute heading error e = atan2(l, f), command yaw rate r = k·e, saturate it, and switch waypoints within an acceptance radius.
Mathematical
Aircraft at (4, −10) km, ψ = 120°, waypoint (−18, 12): d = (−22, 22). Forward = −22(−0.5) + 22(0.866) = 11 + 19.05 = 30.05 km. Left = −(−22)(0.866) + 22(−0.5) = 19.05 − 11 = 8.05 km. Turn angle atan2(8.05, 30.05) ≈ 15° to the left.
Applied
Planetary rovers combine both directions: obstacles seen by cameras (body frame) are placed on a local map (world frame), and the next route waypoint (world) is brought back into the body frame to choose the next arc to drive.
Worked example 1
A drone at (0, 0) with heading 90° (east) sees a landing pad 2 m forward and 1 m to the right. Where is the pad on the map?
ψ = 0°, so body forward = +x, left = +y. Right 1 m means l = −1. p_W = (0, 0) + R(0°)(2, −1) = (2, −1) m.
Common mix-ups
'Forward' on a vehicle means +x on the map.
✓ Only when it heads east (ψ = 0°). Forward is (cos ψ, sin ψ) on the map.To bring a waypoint into the body frame, rotate by +ψ.
✓ Use the inverse: subtract the position, then rotate by −ψ.
Practice
Practice, not a test. Answers are checked on our server; a wrong answer gets a hint and another try. Nothing is saved.
Apply it
Write a short guidance loop in pseudocode for the diagram's aircraft: inputs pose and waypoint, outputs a turn command and 'arrived'. Choose an arrival radius and a maximum turn per step, then test your loop by hand in the diagram for one waypoint. Compare with the navigation level of the Planetary Rover Build.
Reflect
If the pose estimate is 5° wrong in heading, how does that error show up in the body-frame position of a waypoint 10 km away? Estimate it.
Write your answer on paper or in your own notes. Lite never stores what you write.
Go further
- Dead reckoning (Wikipedia)
How navigators track pose from heading and speed alone, and why errors grow.