Interpolate Vehicle Pose at Query Time With Heading Wraparound
Last updated: November 29, 2026
Quick Overview
Given a time-sorted list of localization samples (t, x, y, yaw), implement a function that returns the interpolated pose at an arbitrary query time, correctly handling yaw wrapping at plus or minus pi and queries outside the recorded window.
Nuro
November 29, 20260
0
0 solved
Given a time-sorted list of localization samples (t, x, y, yaw), implement a function that returns the interpolated pose at an arbitrary query time, correctly handling yaw wrapping at plus or minus pi and queries outside the recorded window.
Planning, perception and log replay at Nuro all need the ego pose at timestamps that rarely line up with localization samples, so a small interpolation utility is a realistic screen question. The interviewer is mostly checking numerical care: angle wraparound, boundary conditions, and not silently extrapolating.
What the Interviewer Expects
- Locate the bracketing samples with binary search
- Interpolate yaw along the shortest angular difference, not raw subtraction
- Decide and document behavior outside the recorded window
- Normalize the output yaw into a canonical range
- Discuss when linear interpolation is not good enough (high yaw rate, SE(2) or SE(3))
Key Topics to Cover
How to Approach This
- Apply SOLID principles. Single Responsibility makes code testable, Open/Closed makes it extensible.
- Choose data structures based on access patterns, not familiarity.
- Prefer immutable data and message passing over shared mutable state for concurrency.
- Design APIs with RESTful conventions, versioning, meaningful errors, and pagination from day one.
Possible Follow-up Questions
- How would you interpolate a full 3D orientation stored as quaternions?
- How would you handle a gap of several seconds in the localization stream?
- Would you ever extrapolate, and how far, for a planner running ahead of the last sample?
- How would you test this function?
Sharpen Your Skills on Codemia
Practice similar problems with our interactive workspace, get AI feedback, and track your progress.
Practice System Design ProblemsSample Answer
Requirements
times is strictly increasing, poses[i] = (x, y, yaw) with yaw in radians. Return the pose at query q. Outside [times[0], times[-1]] I return None instead of extrapolating, because a downstre...
High-Level Design
- Binary search for the last sample at or before
q. - Compute the fraction
abetween that sample and the next. - Linearly blend x and y.
- For yaw, take the wrapped difference
wrap(h1 - h0)...