MTBuilder AcademyLearn it. Test it. Build it.
Think & measureLesson 3 of 48
Foundation60 minutes2 project connections

Vectors and reference frames

Represent direction as well as magnitude and transform simple 2D observations so a robot can interpret a camera or sensor mounted at an angle.

After this lesson, you can
  • Resolve and rotate a 2D vector between named coordinate frames while checking direction, magnitude, and sign.
Print / Save PDF
ReadPracticedBench demonstrated
01

Understand

The working idea

A scalar has magnitude only: 2 metres, 5 seconds, 12 volts. A vector also has direction. “The toy car moved 2 m” is incomplete for mapping; “2 m east” can be represented by components such as [2, 0] in a frame whose x-axis points east and y-axis north. Components are not intrinsic labels on the motion. They depend on the chosen coordinate frame.

In two dimensions, a vector of magnitude r at angle θ from +x has components x = r cos θ and y = r sin θ. Its magnitude is sqrt(x² + y²). To express a vector from a sensor frame in a body frame rotated by θ, use the rotation matrix R(θ) = [[cos θ, -sin θ], [sin θ, cos θ]]. Multiplying R by the component column rotates the description. Translation is separate: a direction vector is rotated but not shifted, while a point measured from a camera may need both rotation and the camera's position offset.

This distinction drives mounting decisions. A camera facing 90° left of a robot cannot feed its “forward” coordinate directly into robot forward motion. If the camera reports an object 0.40 m along its own forward axis, the body-frame vector is approximately [0, 0.40] m under the stated axis convention. Explicit frame names—camera, body, world—prevent silent sign errors.

A common misconception is that the same pair of numbers describes a vector in every frame. Another is adding a position offset to a velocity or force vector merely because both are drawn as arrows. Name each frame, draw positive axes, state whether the quantity is a point or free vector, and check that rotation preserves magnitude. If the length changes during a pure rotation, the calculation is wrong.

02

Follow the reasoning

Worked example

A range sensor points 30° left of a toy car's forward +x axis and reports an obstacle 0.80 m straight ahead in its sensor frame. Find the body-frame components, ignoring sensor position offset.

  1. 1

    Represent the sensor reading as [0.80, 0] m in the sensor frame.

  2. 2

    Rotate by +30°: x = 0.80 cos 30° = 0.693 m.

  3. 3

    Compute y = 0.80 sin 30° = 0.400 m, where +y was defined as left.

Result

The obstacle vector is approximately [0.693, 0.400] m in the car body frame.

Sanity checksqrt(0.693² + 0.400²) ≈ 0.800 m, so the pure rotation preserved distance; both components are positive for forward-left.

03

Try it yourself

Independent check

A robot's body frame has +x forward and +y left. Which body vector describes 0.5 m directly to its right?
04

Move to the bench

Map a sensor-relative direction into a toy-car body frame.

Gather
  • toy car or paper car outline
  • phone camera used only to document
  • protractor
  • ruler
  • masking tape
  • small block

Experiment

  1. Tape body +x and +y axes on a table and mount or draw a sensor direction 45° left of body +x.
  2. Place the block 300 mm along the sensor axis and predict its body x/y coordinates.
  3. Measure the actual table coordinates from the body origin and record deviations separately for x and y.
  4. Deliberately flip the sign of the sine term; plot that faulty prediction and diagnose it from the mirrored side of the car.
  5. Move the sensor origin 50 mm forward and decide which coordinate receives the translation offset.

Observe

  • Expected before translation: x and y are each about 212 mm; actual values reflect drawing and placement tolerances.
  • Expected fault clue: a sine-sign error preserves distance but places the block on the wrong side, unlike a scale error.
Transfer it

Sketch frames for a printer head, its carriage, and the page; state which transform would locate a nozzle point on the page.

Limits and cautions
  • Keep the tabletop area clear so the taped axes do not create a trip or snag hazard.
  • Do not use a moving powered car during this geometry exercise.
05

Keep evidence

Bench note

Record what you expected, what you actually measured or observed, and one difference worth investigating. This is self-reported evidence, not a certification.

0 / 5,000A bench demonstration needs a concrete note of at least 20 characters.
Terms in this lessonBrowse the advanced glossary

Sources and further reading

  1. Modern Robotics