Skip to content

Smooth joint friction: tanh model with first and second derivatives - #16

Merged
plancherb1 merged 3 commits into
mainfrom
friction-model
Oct 21, 2026
Merged

plancherb1 merged 3 commits into
mainfrom
friction-model

Conversation

@plancherb1

Copy link
Copy Markdown
Member

RBDReference(robot, use_joint_dynamics=True, friction_model="tanh", friction_width=w) replaces the Coulomb term friction*sign(qd) by the smooth friction*tanh(qd/w). The default friction_model="sign" is unchanged.

The inverse-dynamics gradient carries the slope (friction/w) sech^2(qd/w) on the velocity diagonal, so forward_dynamics_gradient follows by composition. Both second-order inverse-dynamics references add -(2 friction/w^2) tanh(qd/w) sech^2(qd/w) to the qd-qd triple diagonal of the reduced output after the mimic fold, so fdsva_so follows as well. The width is one scalar or one value per velocity slot, 0.03 rad/s by default.

inverse_dynamics_gradient_bpass_dqd takes qd as a keyword argument because the tanh slope depends on it; the only caller passes it.

Tests (tests/test_joint_dynamics_friction_model.py) check the closed forms of the bias and both derivatives against the per-body fold, the gradient against central differences of inverse and forward dynamics, and the second order against central differences of the gradients, at rest, inside the width, at the width and outside it, on fr3 (friction and a mimic joint) and floating iiwa14 (root skipped). The sign model's bias, slope and zero curvature are pinned.

This is item 1 of the GRiD 0.5.4 batch (GATO issue A2R-Lab/GATO#20).

🤖 Generated with Claude Code

@plancherb1
plancherb1 merged commit 137562e into main Oct 21, 2026
1 check passed
@plancherb1
plancherb1 deleted the friction-model branch October 21, 2026 18:58
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