Sign in to save

Bookmark this page so you can find it later.

Sign in to save

Bookmark this page so you can find it later.

Robot localization is the process of estimating where a robot is using motion data and sensor measurements. SLAM, which means simultaneous localization and mapping, goes one step further by building a map while also estimating the robot pose. Students need this cheat sheet because real robots must handle uncertainty, noisy sensors, and imperfect motion.

These ideas connect robotics with probability, geometry, programming, and data analysis.

The core idea is to track a belief about the robot state instead of assuming the robot knows its exact position. Motion models predict the next pose, sensor models compare expected readings with real measurements, and filters combine both sources of information. Common methods include Bayes filters, Kalman filters for nearly linear Gaussian systems, and particle filters for complex or nonlinear systems.

SLAM adds map landmarks or grid cells to the state so the robot can localize and map at the same time.

Key Facts

  • A 2D robot pose is often written as x = [x, y, theta], where x and y are position and theta is heading angle.
  • A basic odometry update is x_new = x_old + d cos(theta), y_new = y_old + d sin(theta), and theta_new = theta_old + delta_theta.
  • Localization estimates the robot pose from a known map, while SLAM estimates both the robot pose and the map.
  • The Bayes filter prediction step is bel_bar(x_t) = sum over x_(t-1) of p(x_t | x_(t-1), u_t) bel(x_(t-1)).
  • The Bayes filter correction step is bel(x_t) = eta p(z_t | x_t) bel_bar(x_t), where eta normalizes probabilities so they sum to 1.
  • In a Kalman filter, the update equation is x_hat = x_pred + K(z - Hx_pred), where K controls how much the measurement changes the prediction.
  • In a particle filter, particles with higher measurement likelihood receive higher weights and are more likely to survive resampling.
  • Loop closure reduces accumulated drift by recognizing a previously visited place and correcting the estimated path and map.

Vocabulary

Pose
A pose describes the robot position and orientation, usually as x, y, and theta in a 2D plane.
Localization
Localization is the task of estimating a robot's pose using sensor data, motion commands, and often a known map.
SLAM
SLAM is the process of estimating a robot's location while simultaneously building or updating a map of the environment.
Odometry
Odometry estimates robot motion from wheel rotation, motor encoders, or other movement measurements.
Sensor Model
A sensor model gives the probability of receiving a measurement if the robot is in a particular state.
Particle Filter
A particle filter represents belief with many possible robot poses, each with a weight based on how well it matches the evidence.

Common Mistakes to Avoid

  • Treating odometry as exact is wrong because wheel slip, uneven floors, and encoder noise cause drift that grows over time.
  • Forgetting to normalize probabilities is wrong because beliefs must add up to 1 after a measurement update.
  • Mixing degrees and radians is wrong because trigonometric functions in code often expect radians, causing large pose errors.
  • Using too few particles in a particle filter is wrong because the robot may lose important possible poses and fail to recover from uncertainty.
  • Ignoring loop closure is wrong because small motion errors accumulate, making the map bend, stretch, or fail to align with places already visited.

Practice Questions

  1. 1 A robot starts at pose [2.0 m, 3.0 m, 0 degrees] and drives forward 4.0 m with no rotation. What is its new pose?
  2. 2 A robot starts at [0 m, 0 m, 90 degrees] and drives forward 2.0 m. Using x_new = x + d cos(theta) and y_new = y + d sin(theta), what are x_new and y_new?
  3. 3 A particle filter has three particles with unnormalized weights 0.2, 0.3, and 0.5. What are the normalized weights, and which particle is most likely to be resampled?
  4. 4 Why does SLAM need both motion information and sensor measurements instead of relying on only one of them?

Understanding SLAM & Robot Localization

A robot must keep track of which coordinate system it is using. A map uses a fixed world frame. A wheel encoder measures movement in the robot's own frame.

A camera reports features relative to its lens. Localization software converts between these frames before it can compare information correctly. Small errors in heading are especially important.

If a robot turns slightly more than expected, every later movement points in a slightly wrong direction. This is why a long straight drive can produce a path that curves away from reality.

Wheel slip, uneven floors, loose tires, and different wheel diameters all add error. Students should practice drawing the robot frame and the world frame before writing motion code.

Sensors do not report perfect facts about the environment. A distance sensor may return a bad value from a shiny wall. A camera may miss a marker in dim light.

Lidar can see the edge of furniture but may not identify what the object is. The software must decide whether a reading matches a known wall, corner, landmark, or another object. This task is called data association.

It becomes difficult in places with repeated features, such as identical doors in a hallway. A wrong match can pull the estimated pose toward the wrong place.

Good systems reject readings that are physically unlikely. They may combine several sensor types because each has different strengths and weaknesses.

Uncertainty is more than a single amount of error. A robot can be fairly certain about its distance along a corridor while being uncertain about its position across the corridor. Its position error can be connected to its heading error.

A small angle mistake becomes a larger sideways position mistake after travel. Kalman filtering represents this uncertainty in a compact mathematical form, which works well when errors are close to smooth bell shaped patterns. Particle filtering handles cases where several locations are possible at once.

For example, a robot entering a symmetric room may have two believable positions. Groups of particles can represent both possibilities until later measurements rule one out. Students should notice that a filter can be confidently wrong when its sensor assumptions are poor.

Mapping creates its own challenges because map errors and pose errors affect each other. If the robot thinks it is in the wrong place when it observes a wall, it may draw that wall in the wrong place. Later observations then appear inconsistent with the bad map.

Loop closure is valuable because it connects a current observation to a place visited much earlier. The correction may shift many old poses and map features, not just the current one. This is why SLAM is often shown as a graph of robot poses linked by motion and observation constraints.

In real robots, SLAM appears in robot vacuums, warehouse vehicles, drones, and self driving research vehicles. When learning it, pay attention to timing. Sensor readings and wheel measurements must be matched to the correct moment, or even a strong algorithm produces a distorted map.