#9898·carla

Fix camera sensor frame, timestamp, and transform synchronization

Author: JArmandoAnayaCreated Sep 25, 2026Updated Sep 25, 2026

Setup

  • CARLA version: ue58-dev
  • Platform: Linux
  • Unreal Engine: 5.8

Describe the bug

Camera sensor data can be delivered with frame metadata that does not correspond to the actual captured image.

The current delivery path may read the sensor transform and simulation timestamp at delivery time rather than at capture time. Since image readback and delivery can occur asynchronously, the actor may already have moved to a later simulation state by the time those values are read.

The asynchronous rt_lens path has an additional issue: the GPU readback is queued before the new CaptureScene() call, so the pixels can belong to the previous capture while the reported frame number belongs to the current tick.

This can produce mismatches between:

  • image data,
  • frame number,
  • simulation timestamp,
  • sensor transform.

The issue is especially relevant for consumers that depend on strict temporal alignment, such as ROS 2 perception and localization pipelines.

This work is part of #9897.

Steps to reproduce

A deterministic regression test should be added as part of the fix.

One possible test setup is:

  1. Attach a camera sensor to a moving actor.
  2. Move the actor by a known amount every simulation tick.
  3. Capture consecutive frames while introducing enough processing/readback delay to exercise the asynchronous delivery path.
  4. Compare the reported frame number, timestamp, and sensor transform with the state corresponding to the image capture.

The test should cover the asynchronous rt_lens path and, where practical, the standard batched camera path.

Expected behavior

Each delivered sensor frame should carry metadata captured from the same simulation state as the image itself.

The frame number, timestamp, transform, and pixel data must remain associated throughout the complete readback and delivery pipeline, regardless of which thread eventually performs serialization or publication.

Logs

Not applicable.

Scripts

A deterministic regression test should be introduced with the fix rather than relying on a manual reproduction script.

Screenshots

Not applicable.

Additional context

A suitable implementation pattern already exists in the older pixel-reader path, where frame number, timestamp, and transform are snapshotted before asynchronous processing and passed by value through the pipeline.

The preferred approach is to introduce an immutable capture context that contains the required metadata at capture/readback submission time and carry it through the asynchronous callback, rather than reading live actor state during delivery.

This should be fixed before moving additional camera processing away from the render-critical path, because increasing pipeline asynchrony would otherwise widen the synchronization window.