Skip to content

Allow to override joint friction coefficients during parsing #443

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions docs/guide/configuration.rst
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,21 @@ Joint Dynamics
~~~~~~~~~~~~~~
Joint dynamics are configured using environment variables starting with ``JAXSIM_JOINT_``. Available variables include:

- ``JAXSIM_JOINT_FRICTION_STATIC``: Overrides the static friction coefficient for all joints.
Copy link
Contributor

Choose a reason for hiding this comment

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

Why the decision to put them as env variables?

These values should be dependent on the model. I am not convinced of having the default set via env variables.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

They should be dependent on the model, but instead of modifying the URDF, this allows to override them quickly. The default behavior does not change if the variable is not set


*Default:* ``0.0``.

- ``JAXSIM_JOINT_FRICTION_VISCOUS``: Overrides the viscous friction coefficient for all joints.

*Default:* ``0.0``.

- ``JAXSIM_JOINT_POSITION_LIMIT_DAMPER``: Overrides the damper value for joint position limits of the SDF model.

*Default:* ``0.0``.

- ``JAXSIM_JOINT_POSITION_LIMIT_SPRING``: Overrides the spring value for joint position limits of the SDF model.

*Default:* ``0.0``.

Logging and Exceptions
~~~~~~~~~~~~~~~~~~~~~~
Expand Down
4 changes: 2 additions & 2 deletions src/jaxsim/parsers/rod/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -252,14 +252,14 @@ def extract_model_data(
if j.axis is not None
and j.axis.dynamics is not None
and j.axis.dynamics.friction is not None
else 0.0
else os.environ.get("JAXSIM_JOINT_FRICTION_STATIC", 0.0)
),
friction_viscous=float(
j.axis.dynamics.damping
if j.axis is not None
and j.axis.dynamics is not None
and j.axis.dynamics.damping is not None
else 0.0
else os.environ.get("JAXSIM_JOINT_FRICTION_VISCOUS", 0.0)
),
position_limit_damper=float(
j.axis.limit.dissipation
Expand Down