Align Camera Frames to Nearest IMU Sample With Skew Bound
Last updated: November 29, 2026
Quick Overview
Given sorted camera frame timestamps and a sorted list of (timestamp, reading) IMU samples, pair each frame with the IMU reading closest in time, returning None when no sample is within a maximum allowed skew.
Figure AI
November 29, 20260
0
0 solved
Given sorted camera frame timestamps and a sorted list of (timestamp, reading) IMU samples, pair each frame with the IMU reading closest in time, returning None when no sample is within a maximum allowed skew.
Sensor alignment is everyday work for a humanoid whose head cameras and IMU run on different clocks and rates, and a screen for Figure AI middleware or data roles might start here. The interviewer wants binary search or a two-pointer approach, correct tie handling, and an honest answer about what to do when data is missing.
What the Interviewer Expects
- Uses bisect or two pointers rather than a nested scan
- Checks both neighbours of the insertion point
- Respects the maximum skew and returns None instead of a stale reading
- States a tie-break rule
- Notes that both inputs must share a clock or be offset-corrected first
Key Topics to Cover
How to Approach This
- Clarify input constraints and edge cases before writing code.
- Walk through your approach verbally and confirm with the interviewer before coding.
- Start with a brute force solution, then optimize. Mention time and space complexity.
- Test your solution with examples, including edge cases like empty input or duplicates.
- Consider common patterns: sliding window, two pointers, hash map, BFS/DFS, dynamic programming.
Possible Follow-up Questions
- Rewrite it with two pointers in O(n + m) and explain when that beats bisect.
- How would you interpolate IMU values instead of picking the nearest one?
- What if the IMU clock drifts relative to the camera clock by a few ppm over an hour of teleoperation?
- How would you do this in a streaming setting where frames arrive before later IMU samples?
Sharpen Your Skills on Codemia
Practice similar problems with our interactive workspace, get AI feedback, and track your progress.
Practice DSA ProblemsSample Answer
Requirements
Inputs: cam_ts sorted, imu sorted by timestamp, max_skew in the same units. Output: for each camera timestamp, the IMU value whose timestamp is closest, or None if the closest is more than `max_...
High-Level Design
For each frame time c, the nearest IMU sample is either the last one before c or the first one at or after c. bisect_left on the IMU timestamps finds that boundary in O(log m). Compare the two...