Robotics from zero · Chapter 3
Sensing and understanding the world
Sensors provide observations, not a complete copy of the world. A robot combines measurements over time to estimate the state it needs for a task.
After this chapter
Distinguish the real state, a measurement and an estimate; notice noise, missing observations and stale data.
Add noise or missing samples, then scrub time or play.
- Actual position: 10 cm
- Measurement: 10 cm
- Estimated position: 10 cm
Age of last valid sample: 0 ms
This is a model. Its numbers explain an idea. They are not safety settings for a real robot.
What does the robot actually know?
A box moves along a conveyor. We can see its true position in this teaching scene, but the robot only receives measurements. Add noise and then hide two samples. Compare the three rows before deciding when to act.
1 World state
State is the information needed to describe the situation: position, speed or whether a gripper holds something. A robot usually cannot observe all of it directly.
2 Observation
A sensor measures one aspect of the world. Camera pixels, a distance reading and an encoder count have different units, viewpoints and failure modes.
3 Estimate
An estimate combines evidence and assumptions. Filtering can reduce a spike, but it can also lag motion. A smooth value is not proof that the object is still there.
Apply the idea
A delivery robot’s position estimate looks stable, but its last valid reading is old. Should it continue at the same speed?
Show the answer
First check the observation time, possible motion since that time and available independent evidence. It may need to slow, stop or obtain a new reading. A stable number alone does not justify continuing.
Under the hood
Open the model assumptions and calculations
Samples are 200 ms apart; the object moves 10 cm per sample. The estimate is the median of the last three valid readings, averaging the middle pair when there are two. Dropout removes samples 5 and 6. Data age measures time since the last valid sample, not the age of every value in the median. The noise pattern is fixed for repeatable comparisons.
Δt = 200 ms
x[k] = 10 + 10k cm
estimate = median(last 3 valid measurements)
data age = now − last valid measurement timeif measurement is valid:
history.append(measurement)
last_valid_time = now
estimate = median(history[-3:])
age = now - last_valid_timeReal-world catch
This filter does not predict motion or fuse multiple sensors. It can lag even when data age is zero. The scene exposes truth so you can compare it; a real robot does not have that view. No confidence percentage or safety decision is inferred here.
Explore the ultrasonic lab for echo timing, surface effects and measurement error. Next, use observations to correct an action.
LabHow does an ultrasonic sensor measure distance? →