Skip to content

Adds Newton sensor simulation interfaces - #4707

Merged
kellyguo11 merged 14 commits into
isaac-sim:developfrom
AntoineRichard:antoiner/newton_sensors
Feb 25, 2026
Merged

kellyguo11 merged 14 commits into
isaac-sim:developfrom
AntoineRichard:antoiner/newton_sensors

Conversation

@AntoineRichard

@AntoineRichard AntoineRichard commented Feb 24, 2026 •

Copy link
Copy Markdown
Collaborator

Description

Adds the simulation interfaces for newton sensors.

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • Breaking change (existing functionality will not work without user modification)

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 updated the changelog and the corresponding version in the extension's config/extension.toml file
  • I have added my name to the CONTRIBUTORS.md or my name already exists there

@github-actions github-actions Bot added documentation Improvements or additions to documentation isaac-lab Related to Isaac Lab team labels Feb 24, 2026
@greptile-apps

greptile-apps Bot commented Feb 24, 2026 •

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR introduces Newton-compatible sensor simulation interfaces by migrating the sensor architecture from torch-based to warp-based computation.

Key architectural changes:

  • SensorBase now uses warp arrays (wp.array) for timestamps and outdated flags, replacing torch tensors
  • New source/isaaclab/isaaclab/sensors/kernels.py provides core warp kernels for timestamp management and reset operations
  • All sensor implementations updated to use env_mask: wp.array parameter instead of env_ids: Sequence[int] for selective environment updates
  • PhysX sensor implementations (contact sensor, IMU, frame transformer) now use dedicated warp kernels for all computations

Sensor-specific updates:

  • Contact sensor uses warp kernels for force updates, contact/air time tracking, and history management
  • IMU uses warp kernels with proper COM correction and numerical differentiation for accelerations
  • Frame transformer uses warp kernels for relative pose computations
  • All base sensor data classes return wp.array instead of torch tensors

API improvements:

  • Added deprecation warnings for num_bodies (use num_sensors) and find_bodies (use find_sensors)
  • Moved compute_first_contact and compute_first_air implementations from base class to PhysX implementation
  • Removed history_length validation from SensorBase (now in BaseContactSensor where it's actually used)

The refactor maintains backward compatibility while enabling future Newton physics backend integration through a clean warp-based abstraction layer.

Confidence Score: 5/5

  • This PR is safe to merge with no critical issues found
  • The refactoring is well-structured with clear separation between base abstractions and backend implementations. All sensors properly use warp kernels, the new kernels.py file is present, test coverage is updated, and the code follows consistent patterns across all sensor types. Deprecation warnings provide smooth migration path.
  • No files require special attention

Important Files Changed

Filename Overview
source/isaaclab/isaaclab/sensors/sensor_base.py Refactored to use Warp arrays and kernels for timestamp/outdated tracking, replacing torch-based logic
source/isaaclab/isaaclab/sensors/kernels.py New file with warp kernels for timestamp updates, reset, and outdated buffer management
source/isaaclab_physx/isaaclab_physx/sensors/contact_sensor/contact_sensor.py Updated to use warp-based update logic with env_mask parameter for selective environment updates
source/isaaclab_physx/isaaclab_physx/sensors/contact_sensor/kernels.py Refactored kernels to use warp-native operations for force updates, contact tracking, and history management
source/isaaclab_physx/isaaclab_physx/sensors/imu/imu.py Migrated to warp-based update with proper COM correction and sensor offset composition
source/isaaclab_physx/isaaclab_physx/sensors/imu/kernels.py Warp kernels for IMU data computation including numerical differentiation and frame transformations
source/isaaclab_physx/isaaclab_physx/sensors/frame_transformer/frame_transformer.py Updated to use warp kernels for frame transformation computations
source/isaaclab/isaaclab/sensors/contact_sensor/base_contact_sensor.py Refactored base class to use env_mask, moved compute_first_contact/air to implementations, added deprecation warnings

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[SensorBase] -->|inherits| B[BaseContactSensor]
    A -->|inherits| C[BaseImu]
    A -->|inherits| D[BaseFrameTransformer]
    
    B -->|PhysX impl| E[ContactSensor]
    C -->|PhysX impl| F[Imu]
    D -->|PhysX impl| G[FrameTransformer]
    
    A -->|uses| H[base kernels.py]
    E -->|uses| I[contact_sensor/kernels.py]
    F -->|uses| J[imu/kernels.py]
    G -->|uses| K[frame_transformer/kernels.py]
    
    H -->|Warp kernels| L[update_timestamp_kernel]
    H -->|Warp kernels| M[reset_envs_kernel]
    H -->|Warp kernels| N[update_outdated_envs_kernel]
    
    I -->|Warp kernels| O[update_net_forces_kernel]
    I -->|Warp kernels| P[split_flat_pose_to_pos_quat]
    
    J -->|Warp kernels| Q[imu_update_kernel]
    J -->|Warp kernels| R[imu_reset_kernel]
    
    K -->|Warp kernels| S[frame_transformer_update_kernel]
    
    style A fill:#e1f5ff
    style H fill:#ffe1e1
    style I fill:#ffe1e1
    style J fill:#ffe1e1
    style K fill:#ffe1e1
Loading

Last reviewed commit: dd1045c

@greptile-apps greptile-apps 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.

49 files reviewed, 1 comment

Edit Code Review Agent Settings | Greptile

@AntoineRichard
AntoineRichard force-pushed the antoiner/newton_sensors branch from 97812ec to 9d86ea7 Compare February 24, 2026 15:39
@AntoineRichard

Copy link
Copy Markdown
Collaborator Author

@greptile

@greptile-apps greptile-apps 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.

27 files reviewed, no comments

Edit Code Review Agent Settings | Greptile

@kellyguo11 kellyguo11 changed the title Newton sensor simulation interfaces Adds Newton sensor simulation interfaces Feb 24, 2026
@kellyguo11
kellyguo11 merged commit c10d4e9 into isaac-sim:develop Feb 25, 2026
7 of 10 checks passed
@bareya bareya mentioned this pull request Feb 25, 2026
7 tasks
kellyguo11 added a commit that referenced this pull request Feb 25, 2026
# Description

#4707 broke tiled camera

<!-- As a practice, it is recommended to open an issue to have
discussions on the proposed pull request.
This makes it easier for the community to keep track of what is being
developed or added, and if a given feature
is demanded by more than one party. -->

## Type of change

<!-- As you go through the list, delete the ones that are not
applicable. -->

- Bug fix (non-breaking change which fixes an issue)
- New feature (non-breaking change which adds functionality)
- Breaking change (existing functionality will not work without user
modification)
- Documentation update

## Screenshots

Please attach before and after screenshots of the change if applicable.

<!--
Example:

| Before | After |
| ------ | ----- |
| _gif/png before_ | _gif/png after_ |

To upload images to a PR -- simply drag and drop an image while in edit
mode and it should upload the image directly. You can then paste that
source into the above before/after sections.
-->

## Checklist

- [ ] I have read and understood the [contribution
guidelines](https://isaac-sim.github.io/IsaacLab/main/source/refs/contributing.html)
- [ ] I have run the [`pre-commit` checks](https://pre-commit.com/) 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 updated the changelog and the corresponding version in the
extension's `config/extension.toml` file
- [ ] I have added my name to the `CONTRIBUTORS.md` or my name already
exists there

<!--
As you go through the checklist above, you can mark something as done by
putting an x character in it

For example,
- [x] I have done this task
- [ ] I have not done this task
-->

---------

Signed-off-by: Kelly Guo <[email protected]>
Co-authored-by: Kelly Guo <[email protected]>
kellyguo11 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
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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation isaac-lab Related to Isaac Lab team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants