Skip to content

Fix joint friction/armature set events #2439

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 1 commit 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
1 change: 1 addition & 0 deletions CONTRIBUTORS.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ Guidelines for modifications:

## Contributors

* Akira Suzuki
* Alice Zhou
* Amr Mousa
* Andrej Orsula
Expand Down
4 changes: 2 additions & 2 deletions source/isaaclab/isaaclab/envs/mdp/events.py
Original file line number Diff line number Diff line change
Expand Up @@ -574,7 +574,7 @@ def randomize_joint_parameters(
distribution=distribution,
)
asset.write_joint_friction_coefficient_to_sim(
friction_coeff[env_ids[:, None], joint_ids], joint_ids=joint_ids, env_ids=env_ids
friction_coeff[env_ids, joint_ids], joint_ids=joint_ids, env_ids=env_ids
Copy link
Contributor

@Mayankm96 Mayankm96 May 7, 2025

Choose a reason for hiding this comment

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

This fix won't work if you have a subset of env ids and joint ids over which the term is operating. There is definitely a bug here if joint_ids is a slice.

The way to fix it is to check if one of them is a slice. If yes, we keep the broadcasting. Otherwise we index directly.

)

# joint armature
Expand All @@ -587,7 +587,7 @@ def randomize_joint_parameters(
operation=operation,
distribution=distribution,
)
asset.write_joint_armature_to_sim(armature[env_ids[:, None], joint_ids], joint_ids=joint_ids, env_ids=env_ids)
asset.write_joint_armature_to_sim(armature[env_ids, joint_ids], joint_ids=joint_ids, env_ids=env_ids)

# joint position limits
if lower_limit_distribution_params is not None or upper_limit_distribution_params is not None:
Expand Down
2 changes: 1 addition & 1 deletion source/isaaclab_tasks/config/extension.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]

# Note: Semantic Versioning is used: https://semver.org/
version = "0.10.31"
version = "0.10.32"

# Description
title = "Isaac Lab Environments"
Expand Down
9 changes: 9 additions & 0 deletions source/isaaclab_tasks/docs/CHANGELOG.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
Changelog
---------

0.10.32 (2025-05-07)
~~~~~~~~~~~~~~~~~~~~

Changed
^^^^^^^

* Added a dummy joint randomization event term in ``Isaac-Velocity-Flat-Anymal-C-Direct-v0`` to keep the joint friction/armature randomization tested.


0.10.31 (2025-04-02)
~~~~~~~~~~~~~~~~~~~~

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,16 @@ class EventCfg:
},
)

add_joint_randomization = EventTerm(
func=mdp.randomize_joint_parameters,
mode="startup",
params={
"asset_cfg": SceneEntityCfg("robot", body_names=".*"),
Copy link
Contributor

Choose a reason for hiding this comment

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

Try to make joint_names as a subset of joints to see if the above fix still works.

Copy link
Author

Choose a reason for hiding this comment

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

I see, this seems like an issue because I'm specifying body_names and not joint_names.

I can close this if that is correct

Copy link
Contributor

Choose a reason for hiding this comment

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

randomize_joint_parameters should work with joint_names instead of body_names, since it modifies the joints in the articulations instead of bodies.

"friction_distribution_params": (0.0, 0.0),
"armature_distribution_params": (0.0, 0.0),
},
)


@configclass
class AnymalCFlatEnvCfg(DirectRLEnvCfg):
Expand Down