[FEATURE][BREAKING] Set contact friction for a pair of materials. - #3166
Draft
Milotrince wants to merge 6 commits into
Draft
[FEATURE][BREAKING] Set contact friction for a pair of materials.#3166Milotrince wants to merge 6 commits into
Milotrince wants to merge 6 commits into
Conversation
duburcqa
reviewed
Aug 3, 2026
Collaborator
There was a problem hiding this comment.
I'm not comfortable with modifying array_class. Make sure every single new field is ABSOLUTELY NECESSARY.
Collaborator
There was a problem hiding this comment.
Friction information are geometry level should be removed if some extract material indirection is added.
Milotrince
force-pushed
the
rigid-material-friction-pairs
branch
from
August 3, 2026 21:16
8dece55 to
658b40e
Compare
Milotrince
force-pushed
the
rigid-material-friction-pairs
branch
2 times, most recently
from
August 4, 2026 00:17
a196da7 to
ea69adc
Compare
Milotrince
force-pushed
the
rigid-material-friction-pairs
branch
4 times, most recently
from
August 4, 2026 03:42
c617536 to
b96e75b
Compare
…d cover retuning a pair after build.
Milotrince
force-pushed
the
rigid-material-friction-pairs
branch
from
August 4, 2026 18:56
b96e75b to
9a2c4f8
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
scene.add_material(gs.materials.Rigid(...))returns a handle that entities hold as theirmaterial. Passing onehandle to several
add_entitycalls shares one surface;geom.set_materialgives one entity more than one.rubber.set_friction_pair(steel, sliding_friction=0.4)pins the coefficients for that pair of materials in placeof the maximum over the two geoms. A coefficient left
Nonekeeps following the maximum. Re-declaring the same twomaterials retunes them, before or after build.
reaches a kernel; the override sits on
ColliderInfo, keyed by the dense pair indexcollision_pair_idxalreadyprovides.
friction_ratiois per-coefficient:set_friction_ratio(sliding_ratio=..., torsional_ratio=..., rolling_ratio=...)writes only what is passed. The two new arguments are keyword-only. Coefficients and ratiosread as
<mode>_frictionand<mode>_ratiothroughout.array_class.pyloses three tensor fields. A geom's and a contact's friction coefficients are each packed into onevector, against the one field the override adds.
Breaking:
entity.material.frictionand its torsional and rolling siblings are gone. Readmaterial.options.frictionfor thedeclared value or
geom.frictionfor what a geom carries.get_geoms_friction/set_geoms_friction, the friction-ratio accessors, andRigidSolverState.friction_ratiocarry the three coefficients on a trailing axis.
set_geoms_friction_torsional/_rollingare subsumed by the packed setter.entity.set_friction_ratio's first argument issliding_ratioand scales sliding friction alone, wherefriction_ratioscaled all three.Out of scope:
geom_priority, MJCF<pair>import, anisotropic (5-coefficient) friction,sol_paramsaveraging, andthe couplers' own friction rules.
Related Issue
Addresses #2718. The
geom_priorityfield proposed there is not added; a materialpair subsumes it without making users reason about which surface wins.
Motivation and Context
Friction is a property of a pair of surfaces, so the maximum over two geoms is arbitrary: no per-surface value plus a
symmetric rule reproduces a real table. It also hides single-sided changes, since lowering only a robot's friction
against a default-1.0 ground is a no-op. The issue reports a Go2 sweep that reproduced its own baseline that way.
How Has This Been / Can This Be Tested?
tests/rigid/test_friction.py::test_friction_resolved_from_material_pair, overn_envs=[0, 2], assertsdeceleration == mu * gfor eight boxes on a plane:the two reproduces them
numbered in
It is separate from
test_kinetic_frictionbecause that scene straddles the tipping threshold, where changing any onecoefficient flips an unrelated box between 176 and 0.1 degrees of tilt.
Locally
tests/rigid/is 426 passed andtests/ipc/47 passed.test_physics_parityandtest_robot_grasp_fem[external_articulation]fail identically on the merge-base.Checklist:
Submitting Code Changessection of CONTRIBUTING document.Resolves SIM-329