Skip to content

[Bug Report] Newton CollisionPipeline produces wrong contact forces that scale with nconmax #5069

@rafaelcathomen

Description

@rafaelcathomen

Describe the bug

When using Newton's CollisionPipeline (use_mujoco_contacts=False), increasing nconmax beyond ~16 causes the robot to experience large spurious contact forces on the base body, triggering immediate termination via the illegal_contact termination term. The same configuration works correctly with use_mujoco_contacts=True.

At low nconmax (≤16), the contact overflow is clipped, which accidentally excludes the spurious contacts and the simulation runs. At higher nconmax, more contacts are included and the spurious ones cause large forces on bodies that shouldn't have ground contact.

Steps to reproduce

Modify PhysicsCfg in the Anymal-C flat velocity env config (Isaac-Velocity-Flat-Anymal-C-v0). Three configs to compare:

  1. Config: Works (but contact overflow warnings):
  newton = NewtonCfg(
      solver_cfg=MJWarpSolverCfg(
          njmax=128, nconmax=16,
          cone="elliptic", impratio=100,
          integrator="implicitfast",
          use_mujoco_contacts=False,
      ),
      num_substeps=1, debug_mode=False,
  )
Runs fine.` Warnings: Number of Newton contacts (3154) exceeded MJWarp limit (2048). Increase nconmax`.
  1. Config 2: Broken (only change: nconmax 16 to 32):
  newton = NewtonCfg(
      solver_cfg=MJWarpSolverCfg(
          njmax=128, nconmax=32,
          cone="elliptic", impratio=100,
          integrator="implicitfast",
          use_mujoco_contacts=False,
      ),
      num_substeps=1, debug_mode=False,
  )

Robot terminates immediately every step. Raising the illegal_contact threshold to 5000 N allows training to proceed, confirming contact forces are orders of magnitude too high.

  1. Config 3: Works (only change from Config 2: use_mujoco_contacts=True):
  newton = NewtonCfg(
      solver_cfg=MJWarpSolverCfg(
          njmax=128, nconmax=32,
          cone="elliptic", impratio=100,
          integrator="implicitfast",
          use_mujoco_contacts=True,
      ),
      num_substeps=1, debug_mode=False,
  )

Runs fine with same nconmax=32.

Run command:
python scripts/reinforcement_learning/rsl_rl/train.py --task Isaac-Velocity-Flat-Anymal-C-v0 presets=newton --num_envs 128 --viz newton

System Info

Describe the characteristic of your environment:

  • Commit: e69dbf4 (on develop branch)
  • Isaac Sim Version: N/A (Newton-only, no Isaac Sim)
  • OS: Ubuntu 24.04 (Linux 6.17.0)
  • GPU: RTX 4090
  • CUDA: 13.0
    -Driver Version: 580.126.09
  • Newton: 1.0.0
  • Warp: 1.12.0

Additional context

Two workarounds allow training to proceed with use_mujoco_contacts=False and higher nconmax:

  1. Raise illegal_contact threshold to 5000 N.
  2. Set margin=0.0 and gap=0.0 on ModelBuilder.default_shape_cfg before add_usd() in source/isaaclab_newton/isaaclab_newton/cloner/newton_replicate.py:
  p = ModelBuilder(up_axis=up_axis)
  solvers.SolverMuJoCo.register_custom_attributes(p)
  p.default_shape_cfg.margin = 0.0
  p.default_shape_cfg.gap = 0.0
  p.add_usd(...)

Checklist

  • I have checked that there is no similar issue in the repo (required)
  • I have checked that the issue is not in running Isaac Sim itself and is related to the repo

Acceptance Criteria

Add the criteria for which this task is considered done. If not known at issue creation time, you can add this once the issue is assigned.

  • Training with CollisionPipeline (use_mujoco_contacts=False) works at nconmax >= 32

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions