Skip to content
Tactiverge

School/○ Innovator/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?

About 35 min · 3 goals · Checked by automated tests

1.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.

2.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.

Loading the interactive…

Can't use the interactive? Read a description instead

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.

3.Checkpoint: guided practice

Check what you just discovered before going on. Hints appear after a wrong answer.

Practice 1

A rover at (2, 3) m has ψ = 90° (nose pointing +y). Its camera sees a rock at forward 4 m, left 0 m. What is the rock's map x coordinate?

m

4.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.

Open BUILD 006: Engineer a Planetary Rover →

5.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

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.

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 −ψ.

6.Watch

→ 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.

1 min · captions on YouTube · source

Nothing loads from YouTube until you press play.

The video is optional: everything you need is also in the lesson text and the interactive.

7.Practice on your own

Practice, not a test. Wrong answers get a hint and another try.

Practice 2 · a fresh version every time

In a simulation, an aircraft is at (−8, 8) km with its nose pointing 45° anticlockwise from the world +x axis. A waypoint is at (−14, 12) km. In the aircraft's body frame (x forward, y to the left), what is the waypoint's left (y) coordinate, in km? (2 decimal places; negative means to the right)

km

Practice 3 · a fresh version every time

A rover is 2 km west and 0 km north of its lander. Its next waypoint is 0 km east and 1 km north of the lander. What compass bearing should it head on (degrees clockwise from north, 0 to 360)?

°

Practice 4

A waypoint's body coordinates are forward −5 km, left 0.5 km. What should a simple guidance loop do?

Practice 5

A waypoint is at forward 3 km, left 3 km in the body frame. By how many degrees should the vehicle turn left to face it?

°

8.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?

Guess first. Being wrong here is how the surprise works.

9.Reflect

10.Go further

Concepts: Navigation frames, heading and waypoints · Coordinate frames and transforms