-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Description
Describe the bug
When only a subset of joints is enabled/controlled, EMAJointPositionToLimitsAction.reset()
fails due to a PyTorch advanced-indexing broadcast mismatch. This works when all joints are enabled (no column selection), but crashes when a subset is selected.
This appears related to the class of issues previously addressed in #1207 and seems to have re-emerged (or not covered).
Steps to reproduce
for example, change the ActionsCfg in https://github.com/isaac-sim/IsaacLab/blob/main/source/isaaclab_tasks/isaaclab_tasks/manager_based/manipulation/inhand/inhand_env_cfg.py to ignore joint index_joint_0
of the Allegro hand:
joint_pos = mdp.EMAJointPositionToLimitsActionCfg(
asset_name="robot",
joint_names=[
"(?!index_joint_0).*", # Exclude index_joint_0, include all other joints
],
alpha=0.95,
rescale_to_limits=True,
)
then, if you run the environment with python scripts/reinforcement_learning/rsl_rl/train.py --task=Isaac-Repose-Cube-Allegro-v0 --num_envs 2
the following error shuts down the environment:
Traceback (most recent call last):
File "/home/yasu/IsaacLab/source/isaaclab_tasks/isaaclab_tasks/utils/hydra.py", line 101, in hydra_main
func(env_cfg, agent_cfg, *args, **kwargs)
File "/home/yasu/IsaacLab/scripts/reinforcement_learning/rsl_rl/train.py", line 179, in main
env = RslRlVecEnvWrapper(env, clip_actions=agent_cfg.clip_actions)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/yasu/IsaacLab/source/isaaclab_rl/isaaclab_rl/rsl_rl/vecenv_wrapper.py", line 67, in __init__
self.env.reset()
File "/home/yasu/miniforge3/envs/env_isaaclab/lib/python3.11/site-packages/gymnasium/wrappers/common.py", line 400, in reset
return super().reset(seed=seed, options=options)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/yasu/miniforge3/envs/env_isaaclab/lib/python3.11/site-packages/gymnasium/core.py", line 333, in reset
return self.env.reset(seed=seed, options=options)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/yasu/IsaacLab/source/isaaclab/isaaclab/envs/manager_based_env.py", line 350, in reset
self._reset_idx(env_ids)
File "/home/yasu/IsaacLab/source/isaaclab/isaaclab/envs/manager_based_rl_env.py", line 372, in _reset_idx
info = self.action_manager.reset(env_ids)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/yasu/IsaacLab/source/isaaclab/isaaclab/managers/action_manager.py", line 367, in reset
term.reset(env_ids=env_ids)
File "/home/yasu/IsaacLab/source/isaaclab/isaaclab/envs/mdp/actions/joint_actions_to_limits.py", line 271, in reset
self._prev_applied_actions[env_ids, :] = self._asset.data.joint_pos[env_ids, self._joint_ids]
~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^
RuntimeError: shape mismatch: value tensor of shape [2, 15] cannot be broadcast to indexing result of shape [2, 1, 15]
Set the environment variable HYDRA_FULL_ERROR=1 for a complete stack trace.
System Info
Describe the characteristic of your environment:
- Commit: e06a067
- Isaac Sim Version: 5.0.0
- OS: Ubuntu 24.04
- GPU: RTX 4080
- CUDA: 13.0
- GPU Driver: 580.65.06
Additional context
It seems this was fixed before in #1207 but crept back in. I will prepare a PR
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
Add the criteria for which this task is considered done. If not known at issue creation time, you can add this once the issue is assigned.
- my PR fixing this is merged
- Reset succeeds when only a subset of joints is enabled
- No regression for the “all joints enabled” case.