Skip to the lesson
FixTheRobot Explore Robotics / Robot Foundations / Module 4 / Lesson 4

Robot Foundations · Module 4: Sensing the World

Noise, and Why One Sensor Is Not Enough

Every reading carries random noise and, often, a steady bias. Averaging tames the first. Only a second, different sensor can expose the second.

  • Lesson 4 of 4
  • Beginner
  • No code
  • About 10 minutes

Point Pip's scanner at a wall that does not move and read it forty times. You will not get forty identical numbers. They scatter by a few centimetres, higher and lower. The wall did not move: the sensor is noisy. This is true of every sensor ever built, and the way a robot copes with it is one of the oldest ideas in engineering. It is also where the module ends, with a reason for the rest of the course: no single sensor is enough.

What you will be able to do

  • Describe noise and bias, and say how they differ.
  • Reduce noise by averaging, and say how much averaging helps.
  • Explain why averaging cannot remove bias.
  • Give a reason a robot needs more than one kind of sensor.

The idea

Two different kinds of error affect every reading, and they need different cures.

  • Noise is the random part. Each reading is a little too high or a little too low, unpredictably. Read again and the error is different. Noise comes from tiny electrical disturbances, from vibration, from rounding in the electronics.
  • Bias is the steady part. The sensor reads a little high, or a little low, every time, by about the same amount. Bias comes from a mounting that is slightly off, a part that has aged, a temperature change, a calibration that was never quite right.
Forty readings of a fixed wall from two sensorsA plot of forty distance readings against reading number. Blue dots are scattered randomly a few centimetres around the true distance of 2 metres. Orange dots are scattered the same way but around a value about 4 centimetres higher. A blue line through the blue dots lies at the true value. An orange line through the orange dots lies about 4 centimetres above it.0102030401.821.881.952.012.072.142.2reading numberdistance read (m) with bias: 2.052 mnoise only: 2.011 mtrue: 2 m
Forty readings of a wall at 2 m. Blue: noise only. Orange: the same noise plus a 4 cm bias. The averages (solid lines) show what each sensor really believes.

The first ten blue readings, in metres: 1.954, 1.97, 2.055, 1.946, 1.939, 2.127, 2.087, 2.005, 2.087, 2.052. Every one is wrong by a small amount, in either direction. The blue average is much closer to the truth than any single reading. The orange average sits just as tightly, on the wrong value.

Averaging cures noise

If errors are random, some are too high and some too low, and they partly cancel when you add them up. Averaging many readings throws away the noise and keeps what is common to them. How much does it help? The typical error shrinks with the square root of the number of readings:

The typical error of an average falls as one over the square root of the number of readings.

typical error of the average ≈ typical error of one reading ÷ √N

N is the number of readings. The square root means diminishing returns: four times as many readings halve the error, and a hundred times as many cut it by ten.

The typical error of an average of N readings of a sensor whose single readings are off by about 5 cm, simulated over thousands of trials
Readings averaged (N)Typical error of the averageCompared with one reading
15 cmthe starting point
42.5 cm2 times smaller
161.2 cm4 times smaller
640.6 cm8 times smaller

The table is computed, not quoted: it agrees with the formula (5 ÷ √4 ≈ 2.5, 5 ÷ √16 ≈ 1.3). There is a price. Averaging forty readings takes forty readings: at Pip's scanner rate that is four seconds, during which the robot may have moved. Averaging suits a robot that is standing still, or a quantity that changes slowly.

Averaging cannot cure bias

Average the orange readings as long as you like and the answer settles, precisely, on the wrong value. Every reading was wrong in the same direction, so nothing cancels. Bias hides: the readings agree with each other and so look trustworthy, and only a comparison with something else shows that they are off.

Averaging beats noise and does nothing to bias. The cure for bias is a second, different source of the same information.

Why one sensor is not enough

Put the whole module side by side. Each sensor of the module fails in its own way:

The strengths and weaknesses of four sensors
SensorStrengthWeakness
Wheel encodersFast, smooth, work anywhereDrift: slip and tiny errors add up without limit
GyroscopeFast, not fooled by wheel slipBias drifts the heading
Laser scannerMeasures where things are, and does not driftNoisy, slower, blind to thin or glassy things and to the space behind objects
CameraRecognises what things areNo distance, fails in darkness and glare

Look at which weaknesses cancel. Encoders drift, the scanner does not. The scanner is noisy and slow, the encoders are smooth and fast. Put them together and each one covers for the other: the encoders carry the robot's position forward between scans, and the scanner pulls it back whenever drift has built up. Combining sensors this way is called sensor fusion. It is the idea behind module 7, and behind most of what makes a real robot's idea of where it is trustworthy.

A sensor you cannot cross-check can be confidently wrong. A robot with two sensors that disagree at least knows that something is off, and that is worth more than a single, tidy, wrong answer.

Words to know

Noise
The random part of a sensor error: different on every reading, and as likely to be too high as too low. On Pip: the few-centimetre scatter of the scanner readings of a still wall.
Bias
The steady part of a sensor error: about the same, in the same direction, every time. On Pip: a gyroscope that always reads a slow turn.
Averaging
Adding readings up and dividing by how many there are, to reduce noise. On Pip: forty readings of a still wall give one reliable number.
Typical error
The size of error you can normally expect. About two readings in three fall within it. On Pip: 5 cm for a single scanner reading in this lesson's example.
Sensor fusion
Combining readings of different sensors so that each covers the weakness of the others. On Pip: encoders carrying the position forward, scans correcting it.
Redundancy
Having more than one way to find out the same thing. On Pip: two sensors that both bear on where it is.

A worked example: how many readings, and what is left?

Pip is parked in front of a wall and must know its distance to within 1 cm. A single reading is typically off by 5 cm.

  1. Required improvement. From 5 cm to 1 cm is a factor of 5.
  2. The square-root rule. The error of an average falls by √N, so √N must be 5, which means N = 5 × 5 = 25 readings.
  3. How long. At 10 scans a second, 25 readings take 3 seconds.
  4. What remains. The noise is down to about 1 cm. But if the scanner has a 4 cm bias, as the orange sensor does, the answer is now precisely 4 cm too long. Averaging tightened the answer around the wrong value.

So Pip has two problems and two cures. Noise: average (cost, 3 seconds of standing still). Bias: compare with another sensor, such as the position the encoders imply. If the two disagree by 4 cm every time, Pip has found the bias, and can subtract it.

The table above shows the diminishing return: going from 16 to 64 readings halved the error again, but cost forty-eight extra readings to do it. In practice a robot averages a handful and moves on.

Try it yourself

Find a kitchen scale, or a ruler and something to measure. Measure the same object five times, trying to read the scale carefully each time, and write down each result. (a) Do you get the same number five times? (b) Average the five readings. Is the average more trustworthy than a single one? (c) Now measure the same object with a different instrument (a tape instead of a ruler, or the scale of a friend). Do they agree? What would that tell you?

What to expect

(a) You will probably see differences of a millimetre or so on a ruler, caused by how you align your eye and the edge: that is noise. (b) Yes, the average is steadier. (c) If the two instruments disagree by the same amount each time, one has a bias, perhaps a worn end on the ruler, and averaging either would never have told you. Only the comparison did.

Common mistakes

"If I average enough readings, I will get the exact answer."

You get closer to what the sensor believes on average, which is the truth plus any bias. Averaging removes noise only, and the improvement slows down: the error falls with the square root of N.

"The two sensors disagree, so one of them is broken."

Possibly. More often each has its own error, and neither is broken. The disagreement is information: how big it is, and whether it is steady or growing, says which error you are looking at.

"More sensors are always better."

More sensors of the same kind in the same place share the same blind spots. The value comes from sensors that fail in different ways. Each new one also adds cost, weight, wiring and software.

Remember this

  1. Noise is random and changes with every reading. Bias is steady and the same every time.
  2. Averaging N readings cuts the noise by √N and leaves the bias exactly as it was.
  3. Bias shows up only when you compare with a different source of the same information.
  4. Sensors that fail in different ways, fused together, cover for one another. That is why robots carry several.

Check yourself

Three questions. Write an answer in your own words, then reveal the explanation. Nothing you type leaves your browser.

Question 1

A sensor reading is typically off by 2 cm. About how many readings must be averaged to bring the typical error of the average down to 0.5 cm?

Explanation

The improvement needed is 2 ÷ 0.5 = 4 times, and the error falls by √N, so √N = 4 and N = 16 readings.

Question 2

A robot averages 100 readings of a distance and gets 1.340 m every time it tries. A tape measure says the true distance is 1.300 m. What is wrong, and would more averaging help?

Explanation

The sensor has a bias of about +4 cm. All its readings are too long by the same amount, and the noise has been averaged away, which is why the 100-reading answer is steady and consistently wrong. More averaging would not help. The fix is to find the bias against a reference, as the tape measure did, and subtract it, or to use a second sensor that does not share it.

Question 3

Encoders drift but are smooth and quick. A laser scanner does not drift but is noisy and slower. Describe how a robot could use both to know where it is.

Explanation

Use the encoders to carry the position forward between scans, since they update fast and smoothly. Each time a scan arrives, compare it with the position the encoders imply, and correct the position when they disagree. The encoders supply speed and smoothness, the scanner supplies the anchor that stops drift. This is the idea of module 7.

What’s next

That completes the sensors. You know what each one measures, how it fails, and why a robot carries several. Lab 2 puts that to use: you give a simulated robot sensors one by one and see which jobs each makes possible.

Next lesson

Goals, Paths and Plans

State a navigation task as a start, a goal and obstacles, and explain what a planner adds to a controller.

The lab of this module (after lesson 3)

Teach the Robot to Sense

Send a robot through a room with no sensor, then add a LiDAR, a camera and encoders, and choose the right sensor for each job. About 15–20 minutes.

Where this goes on the site

Nothing below is needed to continue this course. These pages take the topic of this module further, and most assume more mathematics or Python than this course does.