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 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 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 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 Why does SLAM need both motion information and sensor measurements instead of relying on only one of them?