Skip to content

fix: Snapshot camera timestamps on the physics thread for ground truth accuracy#83

Open
Arcod7 wants to merge 1 commit into
patrykcieslak:masterfrom
Arcod7:fix/gt-timestamp-camera
Open

fix: Snapshot camera timestamps on the physics thread for ground truth accuracy#83
Arcod7 wants to merge 1 commit into
patrykcieslak:masterfrom
Arcod7:fix/gt-timestamp-camera

Conversation

@Arcod7

@Arcod7 Arcod7 commented Jun 15, 2026

Copy link
Copy Markdown
  • Capture simulation time on the physics thread when the camera pose is committed, instead of relying on the GL thread. This ensures ground truth timestamps match the actual pose used for rendering.
  • Introduce a three-stage handoff (tempCaptureTime_ -> pendingCaptureTime_ -> captureTime_) in OpenGLView to safely pass the timestamp across thread boundaries to all camera types.
  • Expose Camera::getLastCaptureTime() so consumers can retrieve the simulation time of the last delivered frame.
  • Multibeam2 bypasses Camera::UpdateTransform() so its implemented again.
  • Thread safety relies on drawingQueueMutex: the physics thread writes tempCaptureTime_ inside UpdateDrawingQueue, and the render thread reads it in PerformDrawingQueueCopy under the same mutex.
Without the fix With the fix
image image

In this example, I'm building an Octomap from a Depth Camera, but Stonefish was giving me late timestamps for the Depth Camera. This caused a misalignment between the depth camera point cloud and the odometry pose, resulting in a distorted map (left). With the fix, timestamps match the actual pose commit, so the point cloud is correctly registered (right).

@Arcod7 Arcod7 changed the title Snapshot camera timestamps on the physics thread for ground truth accuracy Fix Snapshot camera timestamps on the physics thread for ground truth accuracy Jun 15, 2026
@Arcod7 Arcod7 changed the title Fix Snapshot camera timestamps on the physics thread for ground truth accuracy fix: Snapshot camera timestamps on the physics thread for ground truth accuracy Jun 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant