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

Conversation

asuzukii
Copy link

@asuzukii asuzukii commented May 7, 2025

Description

Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context.
List any dependencies that are required for this change.

Fixes #2440, which was a bug that passed in a wrong dim tensor into the joint friction/armature attribute

Adds a dummy joint rand event in anymalc env cfg to make sure this doesn't break again.

Type of change

  • Bug fix (non-breaking change which fixes an issue)

Screenshots

Please attach before and after screenshots of the change if applicable.

Checklist

  • I have run the pre-commit checks with ./isaaclab.sh --format
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • I have updated the changelog and the corresponding version in the extension's config/extension.toml file
  • I have added my name to the CONTRIBUTORS.md or my name already exists there

@asuzukii asuzukii marked this pull request as ready for review May 7, 2025 18:28
@@ -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.

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.

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.

[Bug Report] Joint Friction/Armature Randomization Fails with Error
3 participants