PIXELBANKv9.1.0
Menu

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⁡(θ)θ+δθ)\begin{pmatrix} x' \\ y' \\ \theta' \end{pmatrix} = \begin{pmatrix} x + d \cdot \cos(\theta) \\ y + d \cdot \sin(\theta) \\ \theta + \delta\theta \end{pmatrix}

where:

  • (x,y,θ)(x, y, \theta) is the current pose (position and heading)
  • dd is the distance traveled forward
  • δθ\delta\theta is the change in heading
  • (x′,y′,θ′)(x', y', \theta') is the new pose

This "dead reckoning" accumulates error over time, which is why SLAM also uses landmarks.

Example:

Input:
odometry_update([0, 0, 0], (1, 0))
Output:
[1.0, 0.0, 0]
Reasoning:

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
🔒

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.

solution.py

Test Results

0/0
Run code to see test results.
Odometry Pose Update - Easy | PixelBank