Skip to content
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

[Bug Report] JointAction not preserving order when using all joints #1586

Open
2 of 3 tasks
T-K-233 opened this issue Dec 23, 2024 · 0 comments · May be fixed by #1587
Open
2 of 3 tasks

[Bug Report] JointAction not preserving order when using all joints #1586

T-K-233 opened this issue Dec 23, 2024 · 0 comments · May be fixed by #1587

Comments

@T-K-233
Copy link

T-K-233 commented Dec 23, 2024

If you are submitting a bug report, please fill in the following details and use the tag [bug].

Describe the bug

The mdp.JointPositionActionCfg in ActionsCfg allow us to specify the desired joint order by passing joint_names and setting preserve_order=True. However, this is not effective when we specify order for all joints.

Steps to reproduce

Using task "Isaac-Velocity-Flat-Unitree-A1-v0" as example,

when using the following config

@configclass
class ActionsCfg:
    """Action specifications for the MDP."""
    joint_pos = mdp.JointPositionActionCfg(
        asset_name="robot",
        joint_names=[
            "FL_hip_joint", "FL_thigh_joint", "FL_calf_joint",
            "FR_hip_joint", "FR_thigh_joint", "FR_calf_joint",
            "RL_hip_joint", "RL_thigh_joint", "RL_calf_joint", 
            "RR_hip_joint", "RR_thigh_joint", "RR_calf_joint"
        ],
        scale=0.5,
        use_default_offset=True,
        preserve_order=True
    )

we expect the joint orders to be [0, 4, 8, 1, 5, 9, 2, 6, 10, 3, 7, 11]. However, the _joint_ids that the JointAction sees is still a None slice (slice(None, None, None)).

This is due to this logic in JointAction

    def __init__(self, cfg: actions_cfg.JointActionCfg, env: ManagerBasedEnv) -> None:
        ...
        # Avoid indexing across all joints for efficiency
        if self._num_joints == self._asset.num_joints:
            self._joint_ids = slice(None)
        ...

It empties the _joint_ids even if we set preserve_order to be True. A suggested fix is to change the condition to be

self._num_joints == self._asset.num_joints and not self.cfg.preserve_order

which allow users to force a certain joint order of the policy output.

System Info

  • Commit: dd044a4
  • Isaac Sim Version: 4.2
  • OS: Ubuntu 24.04
  • GPU: RTX 4070 Ti Super
  • CUDA: 12.4
  • GPU Driver: 550.120

Additional context

None

Checklist

  • I have checked that there is no similar issue in the repo (required)
  • I have checked that the issue is not in running Isaac Sim itself and is related to the repo

Acceptance Criteria

  • bug fixed
@T-K-233 T-K-233 linked a pull request Dec 23, 2024 that will close this issue
6 tasks
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 a pull request may close this issue.

1 participant