Apply the contact cfm_factor to normal rows only, not friction tangents - #26
Open
haixuanTao wants to merge 1 commit into
Open
Apply the contact cfm_factor to normal rows only, not friction tangents#26haixuanTao wants to merge 1 commit into
haixuanTao wants to merge 1 commit into
Conversation
The PGS sweep multiplied every contact row by cfm_factor, including the friction tangents. Rapier applies the soft-constraint cfm only to the normal part (ContactConstraintTangentPart::solve takes no cfm_factor); softening the tangents multiplies the effective friction coefficient by cfm_factor. At an overdamped contact config (natural_frequency 30 Hz, damping_ratio 5, dt 1.25 ms) cfm_factor is ~0.02, so mu=1.0 colliders behaved like mu~0.03: statically loaded feet on a humanoid slid steadily and a passive stand toppled. Measured (G1 passive stand): tangential slide insensitive to contact stiffness before the fix, reduced ~15% by this change in isolation, and the effective mu returned to the collider value (verified via a per-row impulse dump: tangent impulses reach mu*N instead of ~0.02*N). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01B7NC7U2wDx2tSmT9mkeF9h
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.
Bug
The multibody contact PGS sweep applies
cfm_factorto every row:Rapier applies the soft-contact cfm to the normal part only —
ContactConstraintTangentPart::solvetakes nocfm_factor(seecontact_constraint_element.rs; onlyNormalPart::solve/generic_solveand the MLCP path receive it). Softening the tangents effectively multiplies the friction coefficient bycfm_factor.Impact
At an overdamped contact config (
contact_natural_frequency = 30 Hz,damping_ratio = 5, substep dt 1.25 ms),cfm_factor ≈ 0.02— so μ = 1.0 colliders behave like μ ≈ 0.03. Measured on a G1 humanoid passive stand: the loaded feet slid steadily regardless of contact stiffness (the slide was insensitive tonatural_frequencyacross a 16× range — the signature that friction, not the normal stack, was leaking), and the robot toppled. A per-row impulse dump showed tangent impulses saturating at ~0.02·N instead of μ·N; after the fix they reach the true cone.Fix
Solve tangent rows without the cfm factor; normal rows unchanged. One site, a few lines.
🤖 Generated with Claude Code
https://claude.ai/code/session_01B7NC7U2wDx2tSmT9mkeF9h