#8159·IsaacLab

[Bug Report] Sensor refreshes can be delayed as float32 clocks accumulate rounding error

Author: yusufdxbCreated Sep 29, 2026Updated Sep 30, 2026
Labelsbug

Describe the bug

SensorBase decides whether a sensor is due from the difference of two float32 per-env timestamps (update_timestamp_kernel in source/isaaclab/isaaclab/sensors/kernels.py):

python
new_timestamp = timestamp[env] + dt
timestamp[env] = new_timestamp
if new_timestamp - timestamp_last_update[env] + 1e-6 >= update_period:
    is_outdated[env] = True

Both timestamps grow with the time since the env was last reset. Each timestamp + dt is rounded to the float32 grid at that magnitude, so once the clock is large enough the computed difference over one period can fall below update_period - 1e-6. The sensor is then not marked outdated on the step it is due, and its refresh is delayed by one or more updates. Nothing is logged; a lazily read sensor returns the data of its previous refresh.

Example: dt = 0.005, update_period = 0.02 (4 steps), data read every 4 steps. Between 16 s and 32 s, every float32 add of dt rounds down by 8.4e-7 s, so a 4-step window measures 0.019996643 s; with the tolerance that is 0.019997643 < 0.02. From t = 16.02 s every other read returns stale data. The onset depends on dt and on the number of steps per period: with long periods at small dt it can be within the first seconds (e.g. dt = 0.001, update_period = 0.02: first delayed refresh at about 2 s).

Steps to reproduce

CPU only, no simulator. Drives SensorBase.update() and the lazy data read of a minimal sensor:

python
from types import SimpleNamespace

from isaaclab import sim as sim_utils
from isaaclab.sensors import SensorBase, SensorBaseCfg

DT, DECIMATION, EPISODE_S = 0.005, 4, 20.0


class CountingSensor(SensorBase):
    def __init__(self):
        self.cfg = SensorBaseCfg(prim_path="/World/envs/env_.*/sensor", update_period=DECIMATION * DT)
        self._initialize_handle = self._invalidate_initialize_handle = self._prim_deletion_handle = None
        self._debug_vis_handle, self._is_initialized, self._is_visualizing = None, False, False
        self.refreshes = 0
        sim = SimpleNamespace(
            device="cpu", backend="stub", get_physics_dt=lambda: DT,
            get_clone_plan=lambda: SimpleNamespace(topology=SimpleNamespace(world_prototype_layout=[0])),
        )
        instance = sim_utils.SimulationContext.instance
        sim_utils.SimulationContext.instance = staticmethod(lambda: sim)
        try:
            self._initialize_impl()
        finally:
            sim_utils.SimulationContext.instance = instance
        self._is_initialized = True

    def _initialize_impl(self):
        super()._initialize_impl()

    @property
    def data(self):
        self._update_outdated_buffers()

    def _update_buffers_impl(self, env_mask):
        self.refreshes += int(env_mask.numpy()[0])


sensor = CountingSensor()
stale = []
for step in range(1, int(EPISODE_S / DT) + 1):
    sensor.update(DT)
    if step % DECIMATION == 0:
        before = sensor.refreshes
        sensor.data
        if sensor.refreshes == before:
            stale.append(round(step * DT, 3))
print(f"stale reads: {len(stale)} / {int(EPISODE_S / DT) // DECIMATION}; first at t = {stale[:1]} s")

Output on develop (09b1d54):

stale reads: 100 / 1000; first at t = [16.02] s

Expected: stale reads: 0 / 1000.

Impact

The due-ness check is shared by every sensor through SensorBase.update(). With update_period equal to the policy step (dt = 0.005, decimation 4), I measured delayed refreshes in full environments for RayCaster (height scanner), Imu, ContactSensor (history 0), FrameTransformer, and a Newton Warp-rendered Camera, each from 16.02 s into the episode, on the Newton and Isaac Sim PhysX backends. A contact sensor with update_period = dt and history is affected from 64 s. I did not test Kit RTX cameras. Sensors with update_period = 0 are not affected.

Related work

#7283 identified that the sensor clock is float32 and that differences of it carry an error that grows with simulated time; #7574 fixed the query it reported by changing the default tolerance of compute_first_contact() / compute_first_air(). That change does not affect the shared due/not-due check in update_timestamp_kernel, and current develop still reproduces the delayed refreshes above.

Proposed fix

Keep the float32 timestamps as they are (the backend kernels read them) and add a private per-env float64 "elapsed since refresh" value, restarted at every refresh and reset, used only to decide whether a sensor is due. Cost: +8 bytes per env per sensor, no public API change, and in my measurements no measurable change in whole-environment step time. I have a PR with regression tests ready and will link it here.

System Info

  • Commit: 09b1d54 (develop)
  • Isaac Sim Version: 6.1 (PhysX runs); kit-less Newton otherwise
  • OS: Ubuntu 22.04 (Linux 6.8)
  • GPU: desktop GPU; the reproducer above runs on CPU and fails identically on CUDA
  • CUDA: 12.8
  • GPU Driver: 570.211.01
  • Warp: 1.17.0