Odometry Pose Update
Update a robot's 2D pose given odometry measurements.
In mobile robotics, odometry estimates motion from wheel encoders or visual odometry. The standard 2D motion model is:
x′y′θ′=x+d⋅cos(θ)y+d⋅sin(θ)θ+δθ
where:
- (x,y,θ) is the current pose (position and heading)
- d is the distance traveled forward
- δθ is the change in heading
- (x′,y′,θ′) is the new pose
This "dead reckoning" accumulates error over time, which is why SLAM also uses landmarks.
Example:
odometry_update([0, 0, 0], (1, 0))
[1.0, 0.0, 0]
Starting at origin facing right (θ=0), moving 1 unit:
- x' = 0 + 1 × cos(0) = 0 + 1 × 1 = 1
- y' = 0 + 1 × sin(0) = 0 + 1 × 0 = 0
- θ' = 0 + 0 = 0
Robot moves 1 unit in the x direction.
Constraints:
- pose: [x, y, theta] current pose (theta in radians)
- motion: (distance, delta_theta) odometry measurement
- Return new pose [x', y', theta'] rounded to 4 decimal places
More from CV: Structure from Motion and SLAM
Odometry Pose Update: Background & Strategy
Background Knowledge
Odometry and Dead Reckoning
Odometry is a fundamental technique in mobile robotics for estimating a robot's position and orientation by integrating motion measurements over time. In 2D SLAM systems, odometry typically comes from wheel encoders (for wheeled robots) or visual odometry (from camera-based motion estimation). The core idea is straightforward: given the robot's current pose and a measured motion (distance traveled and heading change), calculate the new pose using kinematic equations. This process is called "dead reckoning" because it relies solely on motion measurements without external references like GPS or landmarks.
The 2D Kinematic Motion Model
The motion model you've been given represents a differential-drive or unicycle robot moving in 2D space. The key insight is that when a robot moves forward by distance d while at heading θ, the displacement in the global coordinate frame depends on the current orientation. The cos(\theta) and sin(\theta) terms convert the robot's local forward motion into global x and y components. The heading update is simply additive: θ′=\theta+\deltaθ.
Why Odometry Alone Isn't Sufficient
While odometry provides real-time motion estimates, it accumulates error over time—a phenomenon called pose drift. Small measurement errors in distance and heading compound with each update, causing the estimated pose to diverge from the true pose. This is why SLAM systems combine odometry with landmark observations and loop closure detection to correct accumulated errors and maintain global consistency.
Algorithm/Approach
The solution follows a straightforward state update pattern:
- Extract the current pose components: x, y, θ
- Extract the odometry measurements: d (distance) and δθ (heading change)
- Apply the kinematic equations to compute new pose components
- Return the updated pose
This is a direct application of the motion model—no iteration, optimization, or filtering is needed at this level. The challenge is primarily in correctly implementing the trigonometric transformations and handling angle conventions (radians vs. degrees, angle wrapping).
Step-by-Step Strategy
Continue the full explanation
You're reading the free preview. Unlock the complete walkthrough, the code editor, test runner and reference solution with Premium.
Editor locked
The code editor is locked for Pro problems. It is only available for free problems. Please upgrade to gain access to the code editor for all problems.