Skip to content

[FEATURE] Add support of torsional and rolling friction to the rigid solver.#3069

Merged
duburcqa merged 18 commits into
Genesis-Embodied-AI:mainfrom
duburcqa:torsional_friction
Jul 20, 2026
Merged

[FEATURE] Add support of torsional and rolling friction to the rigid solver.#3069
duburcqa merged 18 commits into
Genesis-Embodied-AI:mainfrom
duburcqa:torsional_friction

Conversation

@duburcqa

@duburcqa duburcqa commented Jul 17, 2026

Copy link
Copy Markdown
Collaborator

Description

Add opt-in torsional and rolling friction to rigid contacts: every contact can also resist relative spin about its normal (RigidOptions.enable_torsional_friction) and rolling about its tangent axes (RigidOptions.enable_rolling_friction).

  • Per-geom coefficients gs.materials.Rigid.friction_torsional / friction_rolling (meters, the effective contact patch radius), parsed from MJCF geom friction[1] / friction[2] (on condim >= 4 / >= 6 geoms, matching when MuJoCo applies them), combined per contact by elementwise maximum, and settable at runtime at geom/link/entity level.
  • Parsing an MJCF model that relies on the elliptic cone or condim >= 4 friction while the matching option is disabled fires a warning.
  • The pyramidal cone gains one opposing pyramid pair per friction axis (4 -> 6 -> 10 rows per contact); the elliptic cone gains one row per axis (3 -> 4 -> 6) whose regularization carries the squared sliding-to-axis coefficient ratio, with the whole cone machinery made dimension-generic over the cone rows.
  • Row construction matches MuJoCo condim=4 and condim=6 to machine precision.
  • Three examples document the friction models: friction_breakaway.py sweeps constant tangential, torsional, and rolling loads across the analytic Coulomb limits under both cones (documenting the pyramidal cone's limitations at its default impratio of 1), torsional_grasp.py shows in-hand pivoting, and rolling_coast.py a ball coasting to rest.
friction_breakaway.py (pyramidal left, elliptic right) torsional_grasp.py rolling_coast.py
friction breakaway torsional grasp rolling coast

Motivation and Context

Point contacts transmit no spin or rolling torque, so anything relying on them (a grasped object twisting in a gripper, a ball rolling to rest) moves freely forever; the MJCF torsional and rolling coefficients were silently dropped at parsing. With the option off (default), behavior and performance are unchanged (interleaved A/B benchmark on a contact-dense pile: within noise); enabled, the same scene costs ~12% (elliptic) / ~14% (pyramidal) per step on CPU for torsional friction, and ~28% / ~41% with rolling friction on top, from the extra contact rows, with the Cholesky factor unaffected.

Related Issue

Addresses the torsional and rolling friction half of #2718 (the per-geom friction priority field remains open).

How Has This Been / Can This Be Tested?

pytest tests/rigid/test_friction.py tests/rigid/test_mujoco_parity.py --backend cpu covers the new tests: MuJoCo condim=4 and condim=6 consistency through slip, stick, and rest for both cones (60-step slide+spin+roll trajectories match at the suite's 64-bit tolerance of 1e-9), the analytic sphere spin-down rate friction_torsional * g / (0.4 r^2) including a coefficient far below the tangential ones, zero-coefficient inertness, and runtime coefficient updates, and the analytic rolling deceleration (5/7) * friction_rolling * g / r.

Checklist:

  • I read the CONTRIBUTING document.
  • I followed the Submitting Code Changes section of CONTRIBUTING document.
  • I tagged the title correctly (including BUG FIX/FEATURE/MISC/BREAKING)
  • I updated the documentation accordingly or no change is needed.
  • I tested my changes and added instructions on how to test it for reviewers.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

@duburcqa
duburcqa force-pushed the torsional_friction branch from 85a057e to 26f9365 Compare July 20, 2026 05:44
@duburcqa
duburcqa force-pushed the torsional_friction branch from d0f8388 to 256f874 Compare July 20, 2026 07:56
@duburcqa duburcqa changed the title [FEATURE] Add torsional friction support to the rigid solver. [FEATURE] Add torsional and rolling friction support to the rigid solver. Jul 20, 2026
duburcqa added a commit to duburcqa/Genesis that referenced this pull request Jul 20, 2026
@duburcqa
duburcqa marked this pull request as ready for review July 20, 2026 11:14
@duburcqa
duburcqa requested a review from YilingQiao as a code owner July 20, 2026 11:14
@duburcqa duburcqa changed the title [FEATURE] Add torsional and rolling friction support to the rigid solver. [FEATURE] Add support of torsional and rolling friction to the rigid solver. Jul 20, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: ae17fb23db

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread genesis/utils/array_class.py
Comment thread genesis/utils/mjcf.py Outdated
…parsed friction coefficients on MJCF condim.
@duburcqa

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Can't wait for the next one!

Reviewed commit: 5edc874032

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

@duburcqa
duburcqa merged commit eeb91f8 into Genesis-Embodied-AI:main Jul 20, 2026
20 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant