Skip to content

[Experimental] Add isaaclab_physicsnemo extension for NeRD and FlashNeRD learned physics - #8472

Closed
yufengsjtu wants to merge 59 commits into
isaac-sim:mainfrom
yufengsjtu:pnr
Closed

yufengsjtu wants to merge 59 commits into
isaac-sim:mainfrom
yufengsjtu:pnr

Conversation

@yufengsjtu

@yufengsjtu yufengsjtu commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

Description

Adds isaaclab_physicsnemo, an experimental extension that uses PhysicsNeMo Robotics NeRD / FlashNeRD learned dynamics as the physics of an Isaac Lab Newton environment. It records Isaac Lab Newton episodes as PhysicsNeMo Robotics trajectory datasets, trains dynamics artifacts on them, and runs an artifact as the Newton solver of the same environment, so an unchanged manager-based task (observations, rewards, terminations, events, RSL-RL training) steps learned physics instead of MuJoCo Warp.

The extension is self-contained under source/isaaclab_physicsnemo/; no other package changes.

Core interface (isaaclab_physicsnemo/)

  • physics.PhysicsNeMoSolverCfg / NewtonPhysicsNeMoManager: a Newton solver manager that validates an artifact against the live scene (model identity, solver, frame time, codec, features) and advances it as the environment's physics, optionally with FP16 projections.
  • isaaclab_model_signature / isaaclab_canonical_view: a solver-, environment-count-, and GPU-independent identity of an Isaac Lab Newton model shared by recordings and artifacts (Isaac Lab prim paths, solver-private attributes, USD round-off, replicated ground planes, and the device rounding of derived inverse inertias).
  • TrajectoryDatasetRecorder: records joint efforts or, with control_targets, the joint-position targets of a control period, with bounded shards for large recordings.
  • train_dynamics_artifact: trains NeRD or ParallelNeRD on GPU-resident windows with FP16 autocast, data-parallel ranks, parallel and cached dataset loading, and resumable checkpoints.
  • preflight_learned_physics, apply_learned_physics, evaluate_rollout_nrmse, HeadingJointStateCodec, RootGravityEncoder, exploration action samplers.

Examples (examples/)

  • Cartpole: record, train, deploy, and PPO. Policies trained only in learned physics balance the MuJoCo Warp Cartpole in all evaluation episodes, with the same return as MuJoCo Warp-trained policies (two seeds).
  • FlashNeRD CartPole benchmark: repeats the protocol of the FlashNeRD main-results study. On the study's own teacher it reproduces Table I of the paper and improves on every reported horizon.
  • ANYmal-C locomotion with joint-position targets, following the FlashNeRD locomotion experiment (20 ms frames, ANYdrive actuator response learned, four foot-sphere probes, ten million task-independent transitions). PPO policies trained only in learned physics keep 90 and 94 % of the MuJoCo Warp policies' return when evaluated in MuJoCo Warp (two seeds). The example differences the joint-acceleration penalty over the control period, because Isaac Lab differences joint velocities over physics steps (5 ms in MuJoCo Warp, 20 ms in the learned model).

docs/README.md documents the workflow, the full-scale commands and their cost, the results, the scene requirements, and every Isaac Lab or PhysicsNeMo Robotics behavior the integration handles.

Dependencies

  • PhysicsNeMo Robotics (FlashNeRD) is not yet on a package index. It is installed next to Isaac Lab without its pins; this package is therefore not part of uv.lock or the Sphinx documentation. All tests importorskip("physicsnemo_robotics").
  • docker/Dockerfile builds a kit-less image with PhysicsNeMo Robotics for cluster jobs.

PhysicsNeMo Robotics feature coverage

Supported through this extension:

PhysicsNeMo Robotics feature How Isaac Lab uses it
Learned dynamics as a Newton solver (DynamicsArtifact.as_solver, LearnedDynamicsSolver) NewtonPhysicsNeMoManager runs it as the physics of an unchanged Isaac Lab Newton environment, with resets, NewtonCfg selection, and preflight checks
Models: NeRD (NewtonNeRDVectorTransformer) and FlashNeRD (ParallelNeRD) Trained by train_dynamics_artifact; deployment uses the PhysicsNeMo Robotics inference session, which streams ParallelNeRD over its bounded key/value cache, optionally with FP16 projections (inference_dtype)
Joint-state codec (newton_state_codec(..., "joint")) Fixed-base and floating-base articulations; HeadingJointStateCodec and RootGravityEncoder add the heading-frame state and base-frame gravity of the FlashNeRD locomotion setup
Control features (ControlFieldEncoder) Joint efforts (joint_f) or the joint-position targets of a control period (joint_target_q)
Fixed contact probes (FixedRigidContactEncoder) Foot or link probes against per-environment ground planes, recorded as RecordedFeature and rebuilt by the manager
Trajectory data (TrajectoryRecorder, NewtonTrajectoryWriter, Zarr reader, TransitionWindowReader) TrajectoryDatasetRecorder records asynchronous resets in bounded shards; training reads them with worker processes and an optional cache
Normalizers and artifact packaging (fit_transition_normalizer, package_dynamics_artifact) Used as is; training itself runs Isaac Lab's GPU-resident loop (FP16 autocast, data parallel, resumable)
Model identity and contracts (NewtonModelSignature, solver, time, execution, and frame specs) Computed on a canonical view of Isaac Lab models, so recording and deployment may differ in solver, environment count, and GPU

Not yet supported (TODO):

PhysicsNeMo Robotics feature What is missing
Variable contact (VariableContactSet, set-based contact encoder) Recording and deploying contact tokens from Newton collision detection, for contacts away from fixed probes such as climbing
Hybrid two-way coupling (coupling: learned robot with analytical objects or particles) A coupled solver manager that lets MuJoCo Warp simulate objects next to the learned robot, for manipulation
Body-state codecs, entity and particle models (BodyStateCodec, NeRD entity and particle variants) Assets that are not joint-backed articulations (free rigid bodies, deformables, MPM); the manager rejects body-state codecs today
Other model families (SeqNeRD, recurrent, residual, PointNet, composed models) Training and deployment wiring beyond NeRD and ParallelNeRD
CUDA-graph execution of the learned step The manager runs eager Torch inference and disables Newton graph capture
Planning with learned dynamics (DIAL-MPC, as in the Go2 example) A batched rollout interface from Isaac Lab environments
Differentiable learned simulation (Newton adjoint) Gradients through the learned solver in Isaac Lab
Calibration and sim-to-real fine-tuning (calibration) Fine-tuning artifacts on real robot data from Isaac Lab
Design and co-design optimization (design, codesign) No Isaac Lab integration
PhysicsNeMo Robotics rendering and sensors Learned scenes render through Isaac Lab visualizers only when visual-only shapes stay out of the model identity
PhysicsNeMo Robotics training engine, TensorStore reader, long-form datasets Isaac Lab uses its own resident training loop and the Zarr reader
Model-changing events, external wrenches, and contact sensors in learned scenes Domain randomization of mass, inertia, or materials and force-based observations need model inputs the artifacts do not have
Artifacts across Newton releases The identity includes the Newton version and model attributes, so artifacts are recorded and trained again for each release

PhysicsNeMo Robotics also ships its own physicsnemo_robotics.isaaclab binding, manager, and preflight; this extension replaces them with Isaac Lab-native implementations and does not use them.

Known limitations (also listed in the README)

  • The manager, binding, and preflight read private NewtonManager attributes; public accessors in isaaclab_newton would remove them.
  • The model signature replaces a few private PhysicsNeMo Robotics canonicalizers with linear-time equivalents (tested against the originals); they can be dropped when PhysicsNeMo Robotics changes upstream.
  • Floating-base artifacts deploy with continuity="off"; visual-only shapes enter the model identity, so a learned scene needs load_visual_shapes=False when a viewer or display is active.
  • An artifact deploys only with the Newton release it was recorded with, because the PhysicsNeMo Robotics model identity includes the Newton version and its model attributes.

Fixes # (no issue)

Type of change

  • New feature (non-breaking change which adds functionality)
  • Documentation update

Release backport

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

Screenshots

ANYmal-C PPO training return in MuJoCo Warp and in learned physics (two seeds; diamonds are the final policies evaluated in MuJoCo Warp):

anymal_c_ppo_reward

Seed 42, left to right: MuJoCo Warp policy in MuJoCo Warp, learned-physics policy in learned physics, learned-physics policy in MuJoCo Warp:

anymal_c_policies_side_by_side

Cartpole policy trained only in learned physics, running in MuJoCo Warp:

cartpole_learned_policy_mjwarp

Checklist

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

  • I have read and understood the contribution guidelines
  • I have run the pre-commit checks with uv run isaaclab --format
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have validated the changed behavior with focused coverage and applied the test-audit criteria to any test changes
  • 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)
  • I have added my name to the CONTRIBUTORS.md or my name already exists there

Validation: the 35 CPU and CUDA tests pass on an RTX PRO 5000 with PhysicsNeMo Robotics installed, on the current develop (Newton 1.7.0.dev0, MuJoCo 3.14, Torch 2.11), and skip without it. All reported results were retrained from scratch on these versions: Cartpole on the RTX PRO 5000, and ANYmal-C and both 5,000,000-update CartPole benchmarks on L40S GPUs in the kit-less container. uv run isaaclab --format and the changelog gate (tools/changelog/cli.py check) pass. The tests emit no warnings from this package; the remaining warnings come from Isaac Lab core, the Cartpole task, Newton, Torch, and PhysicsNeMo.

Records Isaac Lab Newton episodes as PhysicsNeMo Robotics trajectory datasets, trains NeRD dynamics artifacts, and runs them through an Isaac Lab-owned Newton solver manager that validates the artifact against the live scene.
Each task records MuJoCo Warp teacher episodes, trains a dynamics artifact, and deploys it with a teacher comparison.
Covers model identity, state ownership, effort control, rollout comparison, exploration, and a CUDA record-train-deploy round trip.
Adds the prefix-averaged recursive-rollout error of the FlashNeRD evaluation and reports it with the trajectory split in TrainingSummary.
Replays recorded transitions on MuJoCo Warp, compares every deployed learned step with the offline artifact operator across resets, and checks that a memorized model tracks its training episodes.
A scale range lets recorded data cover gentle and saturating commands, so learned models stay accurate for controllers that use the full actuator range.
Cartpole recording starts episodes from task-independent states with per-episode action scales. The PPO example trains in MuJoCo Warp or learned physics and evaluates the policy in MuJoCo Warp.
Records the FlashNeRD-scale Cartpole recipe, its held-out rollout errors, the PPO transfer result, and the data-semantics tests.
evaluate_rollout_nrmse accepted any TrajectoryReader but indexed it like a dataset; read_slice works for every reader.
Static planes are placed at their point closest to the origin, only transforms are rounded so threshold-derived semantics such as continuous joints stay exact, and the learned manager rebuilds artifact inputs in the canonical view so fixed-probe geometry fingerprints match across environment counts.
Recording stores additional transition inputs such as fixed contact probes, training accepts a feature encoder and the FlashNeRD ParallelNeRD geometry of the PhysicsNeMo G1 application, and uniform held targets reproduce the FlashNeRD joint-target protocol.
ANYmal-D keeps Isaac Lab's 5 ms physics step so the actuator network runs at its rate, gets a per-environment ground plane for the four foot-sphere probes, and collects task-independent data. A PPO example trains in learned or MuJoCo Warp physics and evaluates in MuJoCo Warp.
Records the fixed-probe ParallelNeRD recipe, why the learned frame stays at the 5 ms physics step, and the PPO transfer results against MuJoCo Warp training.
A heading-frame joint codec and base-frame gravity encoder follow the PhysicsNeMo Robotics G1 input recipe and rebuild from artifacts by default. Recording and training accept the codec, and E_H is pooled over trajectories, steps, and channels on one finite cohort as in the FlashNeRD main-results study.
A CartPole benchmark records, trains, and evaluates with the frozen protocol and geometry of the FlashNeRD main-results study. ANYmal-D uses the heading codec, base-frame gravity, and the study's G1 ParallelNeRD geometry.
Records the protocol differences from the FlashNeRD main-results study, the CartPole E_H after 20,000 updates, and the ANYmal-D fidelity and PPO transfer with the heading and gravity inputs.
train_policy.py evaluates an existing checkpoint with --checkpoint and also in learned physics with --eval-artifact, reporting command tracking with the reward and falls.
Adds the current status and known limitations, the validated PhysicsNeMo Robotics checkout and hardware, the commands behind every reference result, pooled Cartpole E_H, and the updated task-adaptation rules.
…rk tag

The FlashNeRD and PhysicsNeMo Robotics recipes use AdamW without weight decay. The extension is now validated with PhysicsNeMo Robotics mnabian/flashnerd-benchmark-v1, which adds the ParallelNeRD FP16 safeguards.
Normalized windows stay on the GPU and are sampled uniformly with replacement, as in the FlashNeRD study, with FP16 autocast and overflow retries, data-parallel ranks under torchrun, resumable checkpoints, and per-checkpoint artifacts. It matches the streaming pipeline's validation error at 8 to 15 times its throughput.
The benchmark trains with resident FP16 windows, records E_H at every checkpoint, resumes when rerun, and can train on the study's own Featherstone CartPole. Packaging now replaces an existing artifact, which PhysicsNeMo Robotics refuses to overwrite.
The image layers the PhysicsNeMo Robotics checkout and this extension on the kit-less Isaac Lab image, installed as in the README, and passes the extension's tests.
The FlashNeRD CartPole model trains at about twice the update rate with torch.compile, with validation error within seed variation of the uncompiled step.
With control_targets, a recorded frame is one environment step of any decimation and its transition stores the articulation's joint-position targets in the layout of Newton's control.joint_target_q, so a model can learn the actuator response within the control period as FlashNeRD does. Rollout evaluation without horizons no longer reads effort fields.
ANYmal-C records task-independent 20 ms control periods with its actuator network and deploys in a scene whose zero-gain implicit actuators forward targets, leaving the Newton model identical. The model uses a 13-frame receptive field, resident FP16 training, and PPO with 16,384 environments.
Triton compiles ParallelNeRD inference kernels and torch.compile graphs at run time, and the kit-less runtime image has no compiler.
Pyright does not see GradScaler as exported from torch.amp; the object is the same.
…ining

ParallelNeRD casts attention queries and keys to FP32, but autocast runs the logit matmul in FP16, where logits of trained models exceed 65,504 and the softmax returns NaN. Full-budget FlashNeRD runs failed this way after 14,000 to 90,000 updates. Resident training now runs the attention logits without autocast and stops at a non-finite loss instead of exhausting loss-scale retries.
…rol-period reward

Document the overfitting at 2.46 million transitions, the reward mismatch between physics steps, the PPO comparison with its training curves and side-by-side clips, and the known limits of rendering learned scenes and of deploying artifacts across machines.
Two seeds of PPO trained only in learned physics keep 97 and 93 % of the MuJoCo Warp return in MuJoCo Warp, against 89 % with the 60,000-update model. Replace the training curves and the side-by-side clips with these runs and add the update count to the large-scale training command.
Newton derives inverse masses and inertias in a Warp kernel when it finalizes a model, and the last bit of a float32 inverse inertia depends on the GPU and driver, so an ANYmal-C artifact recorded on an L40S failed the identity check on an RTX PRO 5000. The signature now recomputes them in double precision from the masses and inertias it already hashes exactly and rounds them like transforms.
Dataset workers start from a forkserver instead of forking the multi-threaded caller, which Python warns can deadlock; state ownership uses the current name of the rod joint type; and the test models give their links valid inertias, so Newton no longer corrects them at finalization.
The live-model test owns the restoration of the derived inertials, and the accepted joint codec becomes the positive control of the body-state rejection instead of a separate assertion-free test.
The signature no longer reads deprecated Newton attributes such as the joint twist limits, which warn in Newton 1.7 and hold no transforms. Document that the tests pass with Newton 1.7.0.dev0, MuJoCo 3.14, and Torch 2.11, and that artifacts deploy only with the Newton release they were recorded with.
@yufengsjtu
yufengsjtu requested a review from a team October 12, 2026 05:14
@github-actions github-actions Bot added documentation Improvements or additions to documentation isaac-lab Related to Isaac Lab team labels Oct 12, 2026

@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

Needs attention: Design and architecture (2), Scope and over-engineering (1), API (2), Implementation (10), Style consistency (6), Test quality (5). Other reviewed categories look good.

  • PR description: The title and scope match the diff; performance claims include hardware and workload measurements, but the body duplicates README matrices and limitations, so retain only behavior, dependencies, validation, and headline results.
  • Design and architecture: Heading and gravity code passes Newton xyzw quaternions to Isaac Lab wxyz operators, producing incorrect rotations; convert conventions at the boundary or use xyzw-native operations.
  • Scope and over-engineering: Minimal implementation: extend NewtonManager and PhysicsNeMo Robotics contracts; keep exports, binding, deployment, evaluation, exploration, heading, recording, signature, training, physics configuration, manager, and ownership; merge datasets and resident_training into training; reduce preflight to post-construction checks. Keep configuration and record/train/deploy scripts; defer policy scripts, benchmark, Docker, and media. Suggested PR breakdown: solver/deployment; recording/training; heading/ANYmal; benchmarks, PPO, container, and documentation, each with focused tests.
  • API: Target-control recording applies effort-only validation and rejects visible position-drive targets; validate effort control only for effort recordings and accurately type accepted manager strings.
  • Compatibility and deprecation: No breaking changes identified.
  • Implementation: Rollout evaluation uses longest-horizon finiteness for every prefix, biasing shorter E_H results; compute each horizon’s mask from that horizon alone.
  • Style consistency: Several modules violate required constants/functions/classes ordering, entry points bypass repository logging, and deployment imports a private training helper; restore established structure and boundaries.
  • Test quality: The 4,000-update memorization test duplicates exact transition and window checks, while FP16 equality is incorrectly forbidden; remove both unnecessary requirements and strengthen restoration assertions.

Needs rework. Posted 26 inline findings.

Automated review; human maintainers own approval decisions.

recorded = states[:, history:].flatten(end_dim=1)
predicted = rollout.states[:, 1:].to(device).flatten(end_dim=1)
normalized = (codec.state_to_delta(recorded, predicted) / spread).reshape(len(cohort), steps, -1)
finite = normalized.isfinite().all(dim=(1, 2))

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.

🔴 Critical · Implementation — Short horizons exclude later failures

Finiteness is computed across the longest rollout, so later divergence removes trajectories from every shorter E_H. Compute each horizon’s finite mask from only its prefix.

q, qd = state[..., :dof_q], state[..., dof_q:]
local = torch.cat(
(
quat_apply_inverse(heading, q[..., :3] - origin),

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.

🔴 Critical · Design Architecture — Convert quaternion basis at boundary

Newton states use xyzw, but Isaac Lab quaternion operators use wxyz. Heading transforms and root gravity therefore use the wrong rotations. Convert conventions at the boundary or use xyzw operators.

f" physics dt={manager.get_dt()}. Set decimation to 1, or record control targets."
)
self.binding = NewtonBinding(manager)
validate_effort_control(self.binding.model)

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.

🔴 Critical · Api — Target recording rejects valid drives

Effort-control validation also runs for control_targets, rejecting implicit position drives whose targets are recorded inputs. Run validate_effort_control only for effort recordings and validate target visibility separately.

temporary = checkpoint_path.with_suffix(".tmp")
torch.save(payload, temporary)
os.replace(temporary, checkpoint_path)
if on_checkpoint is not None:

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.

🔴 Critical · Implementation — Checkpoint callback deadlocks peers

If on_checkpoint raises on rank zero, other ranks block forever at the barrier. Broadcast callback failure and make every rank leave the checkpoint path with the same error.

key: value for key, value in frequencies.items() if not str(key).startswith(SOLVER_ATTRIBUTE_NAMESPACES)
}
saved_canonicalizers = (_spec._canonical_labels, _spec._canonical_shape_pairs, _spec._world_ids)
_spec._canonical_labels, _spec._canonical_shape_pairs, _spec._world_ids = (

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.

🔴 Critical · Implementation — Guard canonicalization mutations

Global canonicalizers and model fields are mutated before the try block. Any setup failure leaves process-wide functions or the live model modified. Put every mutation inside the restoration guard.

env.close()
SimulationContext.clear_instance()
torch.testing.assert_close(states["float16"], states["float32"], atol=1.0e-2, rtol=1.0e-2)
assert not torch.equal(states["float16"], states["float32"])

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.

🟡 Warning · Test Quality — Allow identical FP16 results

The FP16 contract permits exactly representable outputs, so a valid artifact can produce equal states and fail this test. Keep the closeness assertion and remove the inequality probe.

assert resets > _NUM_ENVS, "the comparison should cover environments restarted after a reset"


def test_memorized_trajectories_track_the_teacher(device: str, tmp_path: Path):

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.

🟡 Warning · Test Quality — Drop redundant memorization training

The named late-effort regression is already caught exactly by transition replay and resident-window parity. Remove this 4,000-update accuracy-threshold test.

assert isaaclab_model_signature(teacher_model) == isaaclab_model_signature(learned_model)


@pytest.mark.parametrize("offset", [1.0e-3, 1.0e-7], ids=["millimeter", "sub-micrometer"])

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.

🟡 Warning · Test Quality — Drop redundant rounding row

Both offsets exercise the same branch and repeat three model builds. Keep the tighter sub-micrometer boundary, which already proves physical changes remain significant.


assert list(model.articulation_label) == labels
assert model.attribute_frequency is frequencies
assert model.joint_X_p is joint_parent_transforms

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.

🟡 Warning · Test Quality — Verify restored array values

Object identity alone misses in-place mutation of transforms or inverse inertias. Snapshot their values and assert both value equality and reference restoration.

# Newton stores contact pairs as an array and collision filter pairs as a set of tuples.
for value in (types.SimpleNamespace(numpy=lambda rows=rows: rows), {tuple(map(int, row)) for row in rows}):
assert outcome(signature._canonical_shape_pairs, model, "shape_contact_pairs", value) == outcome(
signature._ORIGINAL_CANONICAL_SHAPE_PAIRS, model, "shape_contact_pairs", value

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.

🟡 Warning · Test Quality — Remove test-only production oracle

This test requires _ORIGINAL_CANONICAL_SHAPE_PAIRS, a production global with no non-test caller. Capture spec._canonical_shape_pairs locally before invoking the replacement and delete the alias.

@greptile-apps

greptile-apps Bot commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 4/5

[Medium impact] Adds a new experimental extension for learned physics simulation.

The checkpoint reuse issue from the previous review still needs a complete fix before merging.

Findings

  1. P1 New data reuses old training ▶

Summary

Adds the experimental isaaclab_physicsnemo extension to record Newton trajectories, train learned dynamics, and run them as an Isaac Lab solver.

Since the previous review:

  • Newton episodes can be recorded and trained into learned dynamics.
  • Learned dynamics artifacts can step Isaac Lab Newton environments.
  • Learned artifacts share a stable identity across matching Isaac Lab Newton scenes.
  • Floating-base models use heading-relative state and base-frame gravity.
  • Cartpole and ANYmal-C examples show the recording-to-policy workflow.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart LR
    Teacher["Newton teacher environment"] --> Recorder["TrajectoryDatasetRecorder"]
    Recorder --> Dataset["Trajectory datasets"]
    Dataset --> Training["train_dynamics_artifact"]
    Training --> Artifact["Dynamics artifact"]
    Artifact --> Manager["NewtonPhysicsNeMoManager"]
    Manager --> Learned["Learned-physics environment"]
Loading

Reviews (2) · Last reviewed commit: "Clean up failed policy evaluations and h..." · Reviewed by Greptile

Comment on lines +118 to +123
driven = np.flatnonzero(model.joint_target_ke.numpy())
if driven.size:
raise ValueError(
f"Joint DOFs {driven.tolist()} use implicit position drives, whose targets are not part of the applied"
" joint efforts. Use explicit actuators or effort control."
)

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 Velocity commands disappear

validate_effort_control allows an implicit velocity drive when joint_target_ke is zero and joint_target_kd is nonzero. A JointVelocityAction writes its command to joint_target_qd, but effort recordings and the default learned model only read joint_f. The teacher responds to a command the learned model never sees, so recording and deployment can pass checks while using different actuation.

Reject nonzero velocity targets on damped joints during recording and stepping, or include them in the model inputs.

Knowledge Base Used: Newton backend

Comment on lines +293 to +297
identity |= {
"dataset": [str(path) for path in dataset_paths],
"train_windows": resident_train.targets.shape[0],
"world_size": manager.world_size,
}

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 New data reuses old training

The checkpoint identity uses dataset paths and a window count, but not the data, codec, features, or fitted normalizer. Replacing a recording at the same path with the same number of windows resumes the old model and optimizer with newly fitted normalization. If the checkpoint already reached max_updates, no training runs at all; the old model is packaged with the new normalizer.

Include the data and input contracts in the identity, and save or verify the normalizer before resuming.

Comment on lines +138 to +144
setattr(model, name, wp.array(_round_significant(values), dtype=array.dtype, device=array.device))
if model.body_count:
for name, values in zip(DERIVED_INERTIAL_FIELDS, _host_inverse_inertials(model)):
array = getattr(model, name)
saved_arrays[name] = array
setattr(model, name, wp.array(_round_significant(values), dtype=array.dtype, device=array.device))
try:

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.

P2 Failed checks leave changes behind

isaaclab_canonical_view changes model fields and global functions before entering its try block. If a temporary wp.array allocation fails, such as when GPU memory runs out, cleanup never runs. The live model stays partly rewritten and the global functions stay replaced, so code that catches the error cannot safely retry or keep using the scene.

Start the cleanup guard before the first change and add a test that raises during setup.

…tory

The repository is not public yet, so the link checker reports it as broken.
The canonical view replaced PhysicsNeMo Robotics canonicalizers and rewrote model fields before its cleanup guard, so a failure such as an out-of-memory allocation left the live model and the global functions modified. Every change is now recorded before it is made and undone in the same guard.
…itten for

The checkpoint identity held the dataset paths and the window count, so a dataset written again at the same path resumed the old optimization with a newly fitted normalizer. The identity now holds each dataset's modification time, the dataset schema, and the codec and feature signatures.
Implicit damping drives a joint toward control.joint_target_qd inside the solver, so a joint velocity action acted without appearing in the recorded or modeled control. The recorder and the manager now fail on the device when a damped joint receives a nonzero velocity target.
A failure in rank zero's checkpoint write or callback left the other ranks waiting at a barrier. Rank zero now broadcasts whether it failed, and every rank raises.
…ished episodes

Both evaluations now close the environment and clear the simulation context in a finally block, and the Cartpole evaluation reports NaN metrics instead of failing when no episode finishes.
@yufengsjtu

Copy link
Copy Markdown
Contributor Author

@greptileai review

Cartpole, ANYmal-C, and both 5,000,000-update CartPole benchmarks were retrained from scratch on the merged develop. The Cartpole recording is unchanged from Newton 1.6.1, and its model errors are reported over two training seeds because GPU training varies between runs; ANYmal-C, the benchmark tables, their training times, and the media now come from these runs.

@AntoineRichard AntoineRichard left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thanks @yufengsjtu for the PR!

Could you break it down into smaller bits?

Highlevel feedback:
As of now this PR looks like it doesn't belong in IsaacLab. It's adding things next to IsaacLab but barely integrates with its component. Please modify this PR so that it's properly integrated in IsaacLab. Here are a couple things to look at:

  • why is docs in source/isaaclab_physicsnemo and not the actual doc?
  • why are the examples not tasks? Ideally we want something that runs like isaaclab. So either tasks or demos.
  • add a demo.
  • move the docker to where the other dockers are. Make sure it does not redefine things that are already defined.
  • rework the tests to avoid overlapps
  • keep the code to be a minimal set of changes required to enable this feature.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Record a video and ask Sheikh on slack to upload these to our media server.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

ask Sheikh on slack to upload these to our media server.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

ask Sheikh on slack to upload these to our media server.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

ask Sheikh on slack to upload these to our media server.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Generate a dark theme variant!

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Generate a dark theme variant!

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

How much of this belongs to isaaclab and how much could be a link to PhysicsNeMo like: follow the instructions there...

Comment on lines +9 to +12
```text
teacher env (MuJoCo Warp) ──record──▶ Zarr dataset ──train──▶ DynamicsArtifact ──deploy──▶ learned env
TrajectoryDatasetRecorder train_dynamics_artifact PhysicsNeMoSolverCfg
```

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

A nice figure?

@AntoineRichard AntoineRichard self-assigned this Oct 13, 2026
@yufengsjtu

Copy link
Copy Markdown
Contributor Author

Thanks a lot for the review @AntoineRichard ! That makes sense. Before reworking, I'd like to check the direction with you.

Proposed split

  1. isaaclab_newton accessors: small public accessors on NewtonManager (solver, single-state mode, substeps, model-change notifications) so the extension no longer reads private attributes.
  2. Learned-physics solver: PhysicsNeMoSolverCfg / NewtonPhysicsNeMoManager, the model-identity checks, and the preflight, selectable through NewtonCfg like any other Newton solver, plus a Cartpole task variant that runs it and a demo under scripts/demos/.
  3. Recording and training: the trajectory recorder and the training entry point, kept as thin as possible on top of PhysicsNeMo Robotics.
  4. ANYmal-C: the locomotion task variant (target control, heading codec, foot probes) with its RL config.
    Benchmarks, the large-scale recording/training optimizations, and the cluster tooling would either come later or move to PhysicsNeMo Robotics, to keep each PR to the minimal set of changes.

Your other points

  1. Docs: move them into source (a page under the physics/simulation section). Keep only the Isaac Lab integration there and link to PhysicsNeMo Robotics for its own concepts, installation, and training details. Replace the ASCII diagram with a proper figure.
  2. Examples → tasks / demo: register the teacher and learned-physics scenes as tasks so they train with the standard scripts/reinforcement_learning/rsl_rl/train.py, and add a demo.
  3. Docker: move it to docker as a thin layer on the existing kit-less image, without redefining anything that image already defines.
  4. Tests: rework them to remove overlaps, one owner test per contract.
  5. Media: I'll ask Sheikh to upload the videos to the media server and remove the binaries from the repo. I'll also add dark-theme variants of the plots.

A few questions

  1. Where should the tasks live? Would you prefer learned physics as a physics preset of the existing Cartpole / ANYmal tasks in isaaclab_tasks (for example presets=physicsnemo), or separate task IDs registered by isaaclab_physicsnemo? The preset feels like the most integrated option, but it would make isaaclab_tasks reference an optional dependency.
  2. Docs for a not-yet-public dependency: PhysicsNeMo Robotics is not on a package index yet. Is a docs page with the API mocked for autodoc, and installation pointing to PhysicsNeMo Robotics, acceptable until it is released, or should the docs wait for the release?
  3. Order: is it fine to start with the isaaclab_newton accessor PR, then the solver + Cartpole task + demo?

I'll convert this PR to a draft and keep it as the reference while the smaller PRs come in. Thanks again!

@AntoineRichard

Copy link
Copy Markdown
Collaborator

Thanks a lot for the review @AntoineRichard ! That makes sense. Before reworking, I'd like to check the direction with you.

Proposed split

  1. isaaclab_newton accessors: small public accessors on NewtonManager (solver, single-state mode, substeps, model-change notifications) so the extension no longer reads private attributes.

Or you could create a manager for Nerd only like we do for other solvers?

  1. Learned-physics solver: PhysicsNeMoSolverCfg / NewtonPhysicsNeMoManager, the model-identity checks, and the preflight, selectable through NewtonCfg like any other Newton solver, plus a Cartpole task variant that runs it and a demo under scripts/demos/.

Yeah I would put the accessors you mentioned above in the PhysicsNeMoSolverManager

  1. Recording and training: the trajectory recorder and the training entry point, kept as thin as possible on top of PhysicsNeMo Robotics.

Hum, we can try, see how it looks. It's a bit too broad to give you an opinion on this.

  1. ANYmal-C: the locomotion task variant (target control, heading codec, foot probes) with its RL config.
    Benchmarks, the large-scale recording/training optimizations, and the cluster tooling would either come later or move to PhysicsNeMo Robotics, to keep each PR to the minimal set of changes.

I don't think we want cluster tooling. Is there something that doesn't work with our current benchmarking scripts? For the comparison / tooling to make plots or dispatch to OSMO this would not make it to lab.

General question, is this different from a regular newton solver? If not why do we need a custom package for it? My understand is that if it uses nerd then it should just be a solver in which case it should be in isaaclab_newton?

Your other points

  1. Docs: move them into source (a page under the physics/simulation section). Keep only the Isaac Lab integration there and link to PhysicsNeMo Robotics for its own concepts, installation, and training details. Replace the ASCII diagram with a proper figure.

Yeah, in general follow the other newton solver documentation and the way pages are organized.

  1. Examples → tasks / demo: register the teacher and learned-physics scenes as tasks so they train with the standard scripts/reinforcement_learning/rsl_rl/train.py, and add a demo.

yup

  1. Docker: move it to docker as a thin layer on the existing kit-less image, without redefining anything that image already defines.

yup

  1. Tests: rework them to remove overlaps, one owner test per contract.

Yes we have a skill for this ask your agents. It will help figure out which tests are duplicated or overlapping.

  1. Media: I'll ask Sheikh to upload the videos to the media server and remove the binaries from the repo. I'll also add dark-theme variants of the plots.

Yes

A few questions

  1. Where should the tasks live? Would you prefer learned physics as a physics preset of the existing Cartpole / ANYmal tasks in isaaclab_tasks (for example presets=physicsnemo), or separate task IDs registered by isaaclab_physicsnemo? The preset feels like the most integrated option, but it would make isaaclab_tasks reference an optional dependency.

presets would be great. You can check how we do things for OvPhysX for instance. It's the same issue where we need to reference backends the users may not have installed.

  1. Docs for a not-yet-public dependency: PhysicsNeMo Robotics is not on a package index yet. Is a docs page with the API mocked for autodoc, and installation pointing to PhysicsNeMo Robotics, acceptable until it is released, or should the docs wait for the release?

We'll keep the PR draft until the package is released

  1. Order: is it fine to start with the isaaclab_newton accessor PR, then the solver + Cartpole task + demo?

I'll convert this PR to a draft and keep it as the reference while the smaller PRs come in. Thanks again!

We can try like this yes!

@AntoineRichard

Copy link
Copy Markdown
Collaborator

Ping!

@AntoineRichard

Copy link
Copy Markdown
Collaborator

Closing since we're moving to newton neural.

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.

2 participants