Skip to content

Fix compute_first_contact/air missing transitions as the sensor clock ages - #7574

Merged
kellyguo11 merged 4 commits into
developfrom
antoiner/fix-first-contact-tolerance
Sep 7, 2026
Merged

kellyguo11 merged 4 commits into
developfrom
antoiner/fix-first-contact-tolerance

Conversation

@AntoineRichard

@AntoineRichard AntoineRichard commented Sep 4, 2026 •

Copy link
Copy Markdown
Collaborator

Description

ContactSensor.compute_first_contact(dt) / compute_first_air(dt) silently missed most touchdowns and lift-offs once the simulation had run for a few seconds. On a transition step the contact (resp. air) timer is exactly one sensor update interval, so the check degenerated to dt < dt + 1e-8. The sensor clock is a float32 accumulator whose rounding error reaches ~1e-6 after a few seconds of simulated time, roughly 100x the default tolerance, so the events vanished depending on the magnitude of the sim clock. The reporter's CPU reproducer shows 352/500 touchdowns and lift-offs missed at the default tolerance; it reproduces exactly on develop. All three backends (Newton, PhysX, OVPhysX) share the same logic, and the 2.x torch sensor had the same defect, so this is long-standing rather than a Newton regression.

Fix. abs_tol now defaults to None and is resolved at call time by a single helper in BaseContactSensor to half the sensor update interval, i.e. 0.5 * max(cfg.update_period, physics_dt). Valid timer values are integer multiples of that interval, so half an interval is the midpoint between "one update ago" and "two updates ago". This stays robust to float32 clock drift for hours of simulated time and works for both history_length == 0 (lazy, once-per-policy-step refresh) and history_length > 0 (every physics substep). The Warp kernels are unchanged. Passing an explicit abs_tol still works; callers who want the previous behaviour can pass abs_tol=1e-8.

Tests. Public-API regression tests in the Newton, PhysX and OVPhysX contact sensor suites: settle a body in contact, age the sensor clock to 2.5 / 10 / 30 s, lift and land the body, and poll compute_first_contact / compute_first_air with default arguments. These fail on the unfixed code (e.g. compute_first_air missed the lift-off at clock 2.833s: reported [], expected [0]) and pass with the fix. The Newton variant covers both history_length modes.

Refresh before query. Both methods now call the sensor's outdated-buffer refresh before comparing, restoring what the 2.x torch sensor did by reading through self.data. The Warp port (#4707 / #4716) read the private timer buffer directly, so a history_length == 0 caller that polled before touching data saw the previous step's timers. The aged-clock tests now poll before reading data; the Newton lazy-mode cases fail without the refresh (transition reported one policy step late) and pass with it. Adopted from the approach in #7294.

Out of scope, noted for follow-up.

  • The transition interval is counted in both the ending and the starting phase, so last_air_time / last_contact_time overestimate each phase by one update interval (also raised in the issue). That bias is present since 2.x and baked into tuned feet_air_time thresholds, so changing it would rescale rewards for trained velocity policies and deserves its own PR.
  • On cuda:0 with history_length == 0, the PhysX and OVPhysX sensors serve stale net forces when buffers refresh only on data access, independently of this change. That is why the PhysX/OVPhysX public-API tests cover only the substep cadence.

Fixes #7283

Type of change

  • Bug fix (non-breaking change which fixes an issue)

Release backport

  • Backport this pull request to the active release branch after it merges into develop

Checklist

  • I have read and understood the contribution guidelines
  • I have run the pre-commit checks with ./isaaclab.sh --format
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • I have added a changelog fragment under source/<pkg>/changelog.d/ for every touched package (do not edit CHANGELOG.rst or bump extension.toml — CI handles that)
  • I have added my name to the CONTRIBUTORS.md or my name already exists there

compute_first_contact and compute_first_air compared the contact/air timer
against dt + 1e-8. On a transition step the timer is exactly one sensor
update interval, so the check degenerated to dt < dt + 1e-8. The sensor
clock is a float32 accumulator whose rounding error reaches ~1e-6 after a
few seconds of simulated time, roughly 100x the tolerance, so most
touchdowns and lift-offs were silently dropped.

Resolve abs_tol at call time instead: it now defaults to None, meaning half
the sensor update interval. Valid timers are integer multiples of that
interval, so half an interval is the midpoint between "one update ago" and
"two updates ago", which stays robust for hours of simulated time and works
for both the substep and the lazy refresh cadence. Callers that relied on
the old default can pass abs_tol=1e-8 explicitly.

Fixes #7283
Cover the tolerance contract at two levels.

Kernel-level (no simulation, CPU, one file per backend): drive each
backend's contact update kernel from an aged clock over an alternating
contact schedule and assert that a threshold of dt + half an update
interval flags every touchdown and lift-off and nothing else. These
exercise the threshold math the new default produces, for both the substep
and the lazy refresh cadence.

Public-API: drop or teleport a body and poll compute_first_contact and
compute_first_air with the default tolerance after ageing the sensor clock
to 2.5, 10 and 30 s, comparing against transitions observed from the
reported contact forces. These fail on the old 1e-8 default.

The PhysX and OvPhysx public-API cases cover only the substep cadence:
with zero history those backends serve stale contact forces on GPU when
buffers refresh solely on data access, independently of this change.
@AntoineRichard
AntoineRichard requested a review from a team September 4, 2026 14:53
@github-actions github-actions Bot added bug Something isn't working isaac-lab Related to Isaac Lab team labels Sep 4, 2026
@greptile-apps

greptile-apps Bot commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

The PR replaces the fixed contact-transition comparison tolerance with half the configured sensor update interval across Newton, PhysX, and OVPhysX, and adds aged-clock regression coverage.

  • Centralizes default tolerance resolution in BaseContactSensor.
  • Applies the resolved threshold to first-contact and first-air detection in all three backends.
  • Adds backend kernel and public-API regression tests plus changelog fragments.

Confidence Score: 4/5

The long-running transition-detection failure should be addressed before merging because simulations around 18 hours can again silently lose contact and air events.

The new half-interval tolerance fixes short aged-clock runs but remains below the quantized float32 timestamp increment at sufficiently large, realistic simulation times, causing all three backends to fail the same strict transition comparison.

Files Needing Attention: source/isaaclab/isaaclab/sensors/contact_sensor/base_contact_sensor.py and the aged-clock kernel tests

Important Files Changed

Filename Overview
source/isaaclab/isaaclab/sensors/contact_sensor/base_contact_sensor.py Introduces the shared cadence-based tolerance, but half an interval becomes insufficient once float32 timestamp spacing exceeds the resulting threshold margin.
source/isaaclab_newton/isaaclab_newton/sensors/contact_sensor/contact_sensor.py Adopts the shared tolerance consistently for Newton, inheriting its long-runtime precision limit.
source/isaaclab_ov/isaaclab_ov/sensors/contact_sensor/contact_sensor.py Adopts the shared tolerance consistently for OVPhysX, inheriting its long-runtime precision limit.
source/isaaclab_physx/isaaclab_physx/sensors/contact_sensor/contact_sensor.py Adopts the shared tolerance consistently for PhysX, inheriting its long-runtime precision limit.
source/isaaclab_newton/test/sensors/test_contact_sensor_kernels.py Covers clocks only through 30 seconds, leaving the float32 spacing boundary at long runtimes untested.
source/isaaclab_ov/test/sensors/test_contact_sensor_kernels.py Adds both refresh-cadence regression coverage but does not exercise large float32 clock magnitudes.
source/isaaclab_physx/test/sensors/test_contact_sensor_kernels.py Adds both refresh-cadence regression coverage but does not exercise large float32 clock magnitudes.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart LR
  A[Float32 sensor timestamp] --> B[Backend timer update]
  B --> C[Current contact or air timer]
  D[dt plus resolved tolerance] --> E[Transition comparison]
  C --> E
  E --> F[First contact or first air result]
Loading

Reviews (1): Last reviewed commit: "Add first-transition tolerance regressio..." | Re-trigger Greptile

if abs_tol is not None:
return abs_tol
# An update period of 0.0 means the sensor is updated on every physics step.
return 0.5 * max(self.cfg.update_period, self._sim_physics_dt)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Long-running transitions fail again

When a simulation with a 0.005-second physics step reaches 65536 seconds, the next float32 timestamp increment is 0.0078125 seconds while the new default threshold is only 0.0075 seconds. The strict timer comparison therefore silently drops touchdowns and lift-offs again across all three backends.

Knowledge Base Used: Simulation, rendering, and sensors

@isaaclab-review-bot isaaclab-review-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isaac Lab Review Bot

The PR centralizes the default first-transition tolerance in BaseContactSensor and applies it consistently across Newton, PhysX, and OVPhysX while preserving explicit tolerance behavior. No candidate findings were supplied or supported for acceptance.

  • Design and architecture: The shared helper is an appropriate ownership point for backend-independent transition semantics. Each backend resolves the tolerance before launching its unchanged Warp transition kernel, avoiding duplicated policy logic in kernels.
  • API: The abstract base and all concrete overrides consistently change abs_tol from float = 1e-8 to float | None = None. Explicit float values retain their prior behavior, documentation includes [s] units, and changelog fragments describe the changed default and the abs_tol=1e-8 compatibility path.
  • Implementation: The threshold path was traced as dt + 0.5 * max(cfg.update_period, physics_dt) through all three backends and both refresh cadences represented by the tests. Public API regression tests exercise the new default against aged clocks. The duplicated kernel-level tests validate the numerical threshold rather than the helper itself, but the backend API tests cover helper integration, so this remains a non-blocking test-maintenance tradeoff.

No blocking issues. No inline issue met the actionable-evidence threshold; the assessment above records the review feedback.

Automated review; human maintainers own approval decisions.

@aidaodedjl

Copy link
Copy Markdown

Thanks for the quick turnaround and for the archaeology on the 2.x torch sensor — good to know this predates the Newton backend entirely.

The half-interval default is the right minimal fix, and the reasoning for rejecting option (2) is airtight. One pushback on the reason for rejecting option (1), though, since #7294 implements exactly that path: the policy-step-visibility concern is solvable, and that PR solves it. The latches are cleared by the reset kernels and — the part that matters for substep refresh — compute_first_contact() / compute_first_air() refresh outdated buffers before reading, so a lazy caller never sees a latch from a previous policy step, and an every-substep caller never sees a stale one. The flags never need to cross a boundary the kernel cannot see; the query pulls them across.

Not arguing to swap fixes — the tolerance change is smaller, and the calibrated-thresholds argument for keeping the last_*_time bias out of this PR is the correct call. The question is whether the latching design is still of interest as a follow-up: beyond not resting on a comparison margin, it makes compute_first_* event-accurate rather than timer-inferred, which matters if anyone ever queries with a dt smaller than the update interval, and it composes with per-transition event ages (useful once the last_*_time bias gets revisited, since the correction will need exactly that distinction). If the answer is "the tolerance fix is all we want", I will close #7294 against this one with no hard feelings — it did its job getting the issue confirmed.

The kernels are unchanged by the fix, so these tests passed with or without
it and only duplicated the threshold arithmetic already covered by the
public-API aged-clock tests in each backend's contact sensor suite.
compute_first_contact and compute_first_air read the private timer buffers
directly, so with history_length == 0 a caller that polled before touching
the sensor's data saw the previous step's timers. The 2.x torch sensor read
through self.data and therefore refreshed first; the Warp port dropped that.

Call the outdated-buffer refresh before launching the comparison kernel in
all three backends. The call is generation-gated, so it is a no-op when the
buffers are already fresh. The aged-clock tests now poll before reading the
data so the lazy cadence exercises the refresh; without it the Newton
lazy-mode cases report the transition one policy step late.
@kellyguo11

Copy link
Copy Markdown
Contributor

run-ci

@isaaclab-bot isaaclab-bot Bot added ci:run-docker Trigger the on-demand Docker and GPU CI workflow and removed ci:run-docker Trigger the on-demand Docker and GPU CI workflow labels Sep 7, 2026
@kellyguo11
kellyguo11 merged commit 4cf35cc into develop Sep 7, 2026
53 checks passed
@kellyguo11
kellyguo11 deleted the antoiner/fix-first-contact-tolerance branch September 7, 2026 19:09
@isaaclab-bot

isaaclab-bot Bot commented Sep 7, 2026

Copy link
Copy Markdown
Contributor

Backported to release/3.0.0 as 913ac53.

isaaclab-bot Bot pushed a commit that referenced this pull request Sep 7, 2026
… ages (#7574)

# Description

`ContactSensor.compute_first_contact(dt)` / `compute_first_air(dt)`
silently missed most touchdowns and lift-offs once the simulation had
run for a few seconds. On a transition step the contact (resp. air)
timer is exactly one sensor update interval, so the check degenerated to
`dt < dt + 1e-8`. The sensor clock is a float32 accumulator whose
rounding error reaches ~1e-6 after a few seconds of simulated time,
roughly 100x the default tolerance, so the events vanished depending on
the magnitude of the sim clock. The reporter's CPU reproducer shows
352/500 touchdowns and lift-offs missed at the default tolerance; it
reproduces exactly on `develop`. All three backends (Newton, PhysX,
OVPhysX) share the same logic, and the 2.x torch sensor had the same
defect, so this is long-standing rather than a Newton regression.

**Fix.** `abs_tol` now defaults to `None` and is resolved at call time
by a single helper in `BaseContactSensor` to **half the sensor update
interval**, i.e. `0.5 * max(cfg.update_period, physics_dt)`. Valid timer
values are integer multiples of that interval, so half an interval is
the midpoint between "one update ago" and "two updates ago". This stays
robust to float32 clock drift for hours of simulated time and works for
both `history_length == 0` (lazy, once-per-policy-step refresh) and
`history_length > 0` (every physics substep). The Warp kernels are
unchanged. Passing an explicit `abs_tol` still works; callers who want
the previous behaviour can pass `abs_tol=1e-8`.

**Tests.** Public-API regression tests in the Newton, PhysX and OVPhysX
contact sensor suites: settle a body in contact, age the sensor clock to
2.5 / 10 / 30 s, lift and land the body, and poll
`compute_first_contact` / `compute_first_air` with default arguments.
These fail on the unfixed code (e.g. `compute_first_air missed the
lift-off at clock 2.833s: reported [], expected [0]`) and pass with the
fix. The Newton variant covers both `history_length` modes.

**Refresh before query.** Both methods now call the sensor's
outdated-buffer refresh before comparing, restoring what the 2.x torch
sensor did by reading through `self.data`. The Warp port (#4707 / #4716)
read the private timer buffer directly, so a `history_length == 0`
caller that polled before touching `data` saw the previous step's
timers. The aged-clock tests now poll before reading `data`; the Newton
lazy-mode cases fail without the refresh (transition reported one policy
step late) and pass with it. Adopted from the approach in #7294.

**Out of scope, noted for follow-up.**
- The transition interval is counted in both the ending and the starting
phase, so `last_air_time` / `last_contact_time` overestimate each phase
by one update interval (also raised in the issue). That bias is present
since 2.x and baked into tuned `feet_air_time` thresholds, so changing
it would rescale rewards for trained velocity policies and deserves its
own PR.
- On `cuda:0` with `history_length == 0`, the PhysX and OVPhysX sensors
serve stale net forces when buffers refresh only on data access,
independently of this change. That is why the PhysX/OVPhysX public-API
tests cover only the substep cadence.

Fixes #7283

## Type of change

- Bug fix (non-breaking change which fixes an issue)

## Release backport

- [x] <!-- backport-active-release --> Backport this pull request to the
active release branch after it merges into `develop`

## Checklist

- [x] I have read and understood the [contribution
guidelines](https://isaac-sim.github.io/IsaacLab/main/source/refs/contributing.html)
- [x] I have run the [`pre-commit` checks](https://pre-commit.com/) with
`./isaaclab.sh --format`
- [x] I have made corresponding changes to the documentation
- [x] My changes generate no new warnings
- [x] I have added tests that prove my fix is effective or that my
feature works
- [x] I have added a changelog fragment under
`source/<pkg>/changelog.d/` for every touched package (do **not** edit
`CHANGELOG.rst` or bump `extension.toml` — CI handles that)
- [x] I have added my name to the `CONTRIBUTORS.md` or my name already
exists there

(cherry picked from commit 4cf35cc)
kellyguo11 pushed a commit that referenced this pull request Sep 11, 2026
#7614)

# Description

On the PhysX and OVPhysX backends on GPU, a `ContactSensor` with the
default `history_length=0` and the default `lazy_sensor_update=True`
kept reporting the last in-contact force after the body had left
contact, for as long as the body stayed in the air, whenever its data
was read less often than every physics step (for example once per policy
step with `decimation=4`).

**Root cause.** PhysX zeroes a body's entry in
`get_net_contact_forces()` only on the exact physics step where that
body's contact is lost. With `history_length=0` the sensor only called
the getter when `.data` was accessed, so a policy-rate reader skipped
most contact-lost steps and never saw the zero. The Isaac Lab kernels
and the CUDA-graph replay are not involved: the raw getter output, the
cached Warp view, and the sensor output agree at every read, and
disabling the graph changes nothing. CPU is unaffected. `history_length
> 0` is unaffected because the base class already refreshes every
physics step. The experiment table and a standalone reproduction are in
#7613; OVPhysX reproduces identically through its contact binding.

**Fix.** Both sensors override `update()` to fetch the physics-owned
buffers on every physics step, skipping the fetch when the base class
already refreshed on that step (history-bearing sensors, or
`force_recompute`). The Warp kernels that turn the fetched buffers into
sensor data still run lazily on data access, so the per-step cost is one
getter call, which is exactly what history-bearing sensors already pay.
The buffers are refreshed in place, so the cached views and the captured
CUDA graph stay valid. On PhysX the outer-graph-capture guard moves into
a helper shared by the eager fetch and the buffer update, so a capture
is rejected on either path and the existing capture test keeps its
"raise before touching PhysX" contract.

**Tests.** `test_lazy_sensor_reports_contact_loss` in both the PhysX and
OVPhysX contact sensor suites: settle a cube for six policy steps of
four physics steps each, reading the sensor once per policy step, then
hold it in the air for six more, and require every air read after the
first to be below 0.1 N. On the unfixed code it fails on `cuda:0` with
the force stuck at the resting value for all six reads, and passes on
`cpu`; with the fix it passes on both. The PhysX
`test_contact_history_updates_at_sensor_period` row for
`history_length=0` asserted the old zero-fetch cadence and was updated
to the new one; its history-bearing rows are unchanged.

**Exposure.** Every shipped velocity task sets `history_length=3` and is
unaffected. The Kuka Allegro and Franka lift tasks configure fingertip
contact sensors with the default history length and feed the force
matrix into observations, so on PhysX GPU those observations could hold
a stale contact force after a finger released the object.

Found while working on #7283 / #7574.

Fixes #7613

## Type of change

- Bug fix (non-breaking change which fixes an issue)

## Release backport

- [ ] <!-- backport-active-release --> Backport this pull request to the
active release branch after it merges into `develop`

## Checklist

- [x] I have read and understood the [contribution
guidelines](https://isaac-sim.github.io/IsaacLab/main/source/refs/contributing.html)
- [x] I have run the [`pre-commit` checks](https://pre-commit.com/) with
`./isaaclab.sh --format`
- [x] I have made corresponding changes to the documentation
- [x] My changes generate no new warnings
- [x] I have added tests that prove my fix is effective or that my
feature works
- [x] I have added a changelog fragment under
`source/<pkg>/changelog.d/` for every touched package (do **not** edit
`CHANGELOG.rst` or bump `extension.toml` — CI handles that)
- [x] I have added my name to the `CONTRIBUTORS.md` or my name already
exists there
maxkra15 pushed a commit that referenced this pull request Oct 6, 2026
# Description

The sensor scheduler decides whether a sensor is due by subtracting two
float32 per-env timestamps (`timestamp - timestamp_last_update + 1e-6 >=
update_period` in `update_timestamp_kernel`). Both grow with the time
since the env's last reset. As they grow, float32 rounding of the
repeated `timestamp + dt` makes the computed elapsed time fall below
`update_period - 1e-6`, so otherwise-due refreshes are delayed by one or
more updates, and a lazily read sensor returns its previous data. With
`dt = 0.005` and `update_period = 0.02` this starts at t = 16.02 s; with
long periods at small `dt` it starts within the first seconds.

Reproduction (CPU only, the script in #8159): develop prints `stale
reads: 100 / 1000; first at t = [16.02] s`; this branch prints `stale
reads: 0 / 1000`.

The fix:

- adds a private per-env buffer `_elapsed_since_update` (float64): the
time since the last refresh, accumulated from zero and restarted at
every actual refresh and every reset;
- uses it only for the due-ness decision: `elapsed >= update_period -
1e-6`;
- keeps `_timestamp` / `_timestamp_last_update` bitwise unchanged (`dt`
is passed as float64 and cast to float32 for the timestamp; PhysX and
OVPhysX still read `timestamp` for the `timestamp == 0` reset guard);
- advances the contact sensors' air/contact times (PhysX, Newton,
OVPhysX) by the same `_elapsed_since_update` instead of `timestamp -
timestamp_last_update`, so nothing subtracts the growing float32
timestamps any more;
- preserves the scheduling semantics: the period is counted from the
actual refresh (not a fixed time grid), lazy reads shift the phase, a
due sensor stays due until read, `update_period = 0` refreshes on every
read, `dt` may vary between calls, and a reset still marks the env
outdated;
- changes no public API or config; the private timing buffers are
allocated by a new `SensorBase._create_timing_buffers()`.

The elapsed value is bounded by the update period plus the time a due
sensor waits to be read, so its rounding error no longer depends on how
long the episode has run.

`SensorBase._create_timing_buffers()` allocates the env masks,
timestamps, outdated flags and the new buffer for the current
`_num_envs`. `_initialize_impl()` and the three `isaaclab_ov` sensors
that change `_num_envs` after initialization (contact sensor, frame
transformer, joint wrench sensor) call it instead of rebuilding the
buffers, and so do the two hand-built fake sensors in
`test_simulation_render_context.py`.

Breaking: a sensor that allocates or resizes the timing buffers itself
instead of calling `SensorBase._initialize_impl()` or
`_create_timing_buffers()` fails with `AttributeError:
'_elapsed_since_update'` on its first `update()`, and code that launches
the changed Warp kernels directly must pass the new buffer. Both are
covered in the `isaaclab` changelog.

Related: #7283 / #7574 made `compute_first_contact()` /
`compute_first_air()` robust to the same float32 clock error by
defaulting their tolerance to half the sensor update interval. With the
air/contact times now advanced by the float64 elapsed time, their error
no longer grows with the clock (kernel-level check below). The
half-interval default is kept: even with exact timers, a fixed `1e-8`
tolerance is below the float32 resolution of the timer for periods of
0.2 s and more (`float32(0.2 + 1e-8) == float32(0.2)`), so it still
misses every transition there.

Fixes #8159

## Type of change

- Breaking change (existing functionality will not work without user
modification)

## Release backport

- [ ] <!-- backport-active-release --> Backport this pull request to the
active release branch after it merges into `develop`

## Screenshots

Not applicable. Evidence:

| Validation | develop | this PR |
| --- | ---: | ---: |
| Scheduler tests (`test_sensor_update_schedule.py`, 4 cases) | 3 fail /
1 pass | 4 / 4 pass |
| Contact kernels of PhysX, Newton and OVPhysX, 40 s against an exact
model (CPU + CUDA, substep and lazy refresh, resets): max air/contact
time error | 7.7e-5 s | 3.9e-8 s |
| Same, missed first-contact/first-air with a fixed `abs_tol=1e-8`
(default half-interval tolerance: 0 on both) | up to 34,772 of 60,085 |
0 (no false positives) |
| Reproducer in #8159, stale reads | 100 / 1000 | 0 / 1000 |
| Isaac-Velocity-Rough-UnitreeGo2, Isaac Sim PhysX, 8 envs, 20 s, stale
height-scan reads | 465 | 0 |
| Same task, Newton with `use_newton_actuators=False`, 20 s | 700 | 0 |
| Same task, Newton default preset, 20 s (one `update(step_dt)` per
step, not exposed in 20 s) | 0 | 0 |
| Same task, Newton default preset, 70 s | 1200 | 0 |
| IMU / FrameTransformer / ContactSensor (history 0) / Newton Warp
camera at `update_period = step_dt`, 70 s, stale reads each | 4400 | 0 |
| Scheduler stress, real `SensorBase`, up to 200,000 simulated s,
periods 1 to 1000 steps and non-integer, variable `dt`, 4096 envs with
random resets | early and late refreshes | 0 early / late / missed |

The aged-clock and variable-`dt` cases fail on develop at the first
delayed refresh. The case that passes on develop (an unread due sensor
stays due until read) guards the scheduling semantics: it fails under
fixed-grid scheduling, and the variable-`dt` case is the only one that
fails when updates are counted instead of timed (checked by mutating the
patched code).

Performance (desktop GPU shared with another job; alternating develop/PR
processes; bootstrap 95% CI): the scheduler kernels cost slightly more
(+30 to 160 ns device time per step, 1 to 8192 envs), and no
statistically meaningful whole-environment step-time change was observed
up to 8192 envs on the task above with the Newton default preset and
with `use_newton_actuators=False` (e.g. 8192 envs: 101.1 vs 100.4 ms and
102.5 vs 102.9 ms per step, CIs include 0). Memory: +8 bytes per env per
sensor.

Not runtime-validated: the `_create_timing_buffers()` calls in the three
`isaaclab_ov` resize branches (the OVPhysX sensor tests pass on CPU and
CUDA, but their scenes never take the `binding count != _num_envs`
branch), Kit RTX cameras, PhysX-path performance, and torch 2.12 (runs
used torch 2.11 + CUDA 12.8; the changed code path is Warp only). The
performance numbers above are from the scheduler change; the contact
kernels now read one float64 per env instead of two float32 timestamps.

Tests run locally on this branch (base 09b1d54):
`test_sensor_update_schedule.py`, `test_simulation_render_context.py`,
`test_simulation_context.py`, `test_sensor_base.py`,
`test_outdated_sensor.py`; Newton `test_contact_sensor.py` (including
the #7574 aged-clock cases) / `test_contact_sensor_history.py` /
`test_imu.py` / `test_pva.py` / `test_frame_transformer.py`; PhysX
(Isaac Sim) `test_contact_sensor.py` / `test_imu_pva_recorded_launch.py`
/ `test_joint_wrench_sensor.py`; OVPhysX (`ovphysx==0.6.3`, one run per
device) `test_contact_sensor.py` / `test_contact_sensor_kernels.py` /
`test_frame_transformer.py` / `test_joint_wrench_sensor.py` /
`test_imu.py` / `test_pva.py`. All pass.

## Checklist

Docker and GPU tests run on demand. Push the commits you want tested,
then
comment `run-ci` on the pull request.

- [x] I have read and understood the [contribution
guidelines](https://isaac-sim.github.io/IsaacLab/main/source/refs/contributing.html)
- [x] I have run the [`pre-commit` checks](https://pre-commit.com/) with
`uv run isaaclab --format`
- [ ] I have made corresponding changes to the documentation (no public
API or documented behavior changes; the private-buffer change is
described in the changelog)
- [x] My changes generate no new warnings
- [x] I have validated the changed behavior with focused coverage and
applied the [test-audit
criteria](https://github.com/isaac-sim/IsaacLab/blob/develop/skills/developer/test-audit/SKILL.md)
to any test changes
- [x] I have added a changelog fragment under
`source/<pkg>/changelog.d/` for every touched package (do **not** edit
`CHANGELOG.rst` or bump package versions: CI handles that)
- [x] I have added my name to the `CONTRIBUTORS.md` or my name already
exists there

---------

Signed-off-by: Yusuf Guenena <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working isaac-lab Related to Isaac Lab team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants