You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
has error if EMA control is applied for just part of the robot (e.g. arm + hand setup)
Steps to reproduce
I don't find any current robot that's using the arm + hand setup so reproducing the error would be hard. But I do have a one line fix for this issue which I will describe latter.
In some cases, we want to move certain joints instead of all the joints when we train an agent. This is enable by passing argument env.actions.joint_pos.joint_names. This will cause an indexing error in pytorch.
Steps to reproduce
For example, we want to only move the index finger of the Allegro hand for the cube reposing task:
Error executing job with overrides: ['env.actions.joint_pos.joint_names=["index_joint.*"]']
Traceback (most recent call last):
File "/home/weiy/Projects/code/IsaacLab/source/extensions/omni.isaac.lab_tasks/omni/isaac/lab_tasks/utils/hydra.py", line 91, in hydra_main
func(env_cfg, agent_cfg, *args, **kwargs)
File "/home/weiy/Projects/code/IsaacLab/source/standalone/workflows/rsl_rl/train.py", line 119, in main
env = RslRlVecEnvWrapper(env)
File "/home/weiy/Projects/code/IsaacLab/source/extensions/omni.isaac.lab_tasks/omni/isaac/lab_tasks/utils/wrappers/rsl_rl/vecenv_wrapper.py", line 89, in __init__
self.env.reset()
File "/home/weiy/miniconda3/envs/isaaclab/lib/python3.10/site-packages/gymnasium/wrappers/order_enforcing.py", line 61, in reset
return self.env.reset(**kwargs)
File "/home/weiy/Projects/code/IsaacLab/source/extensions/omni.isaac.lab/omni/isaac/lab/envs/manager_based_env.py", line 252, in reset
self._reset_idx(indices)
File "/home/weiy/Projects/code/IsaacLab/source/extensions/omni.isaac.lab/omni/isaac/lab/envs/manager_based_rl_env.py", line 339, in _reset_idx
info = self.action_manager.reset(env_ids)
File "/home/weiy/Projects/code/IsaacLab/source/extensions/omni.isaac.lab/omni/isaac/lab/managers/action_manager.py", line 285, in reset
term.reset(env_ids=env_ids)
File "/home/weiy/Projects/code/IsaacLab/source/extensions/omni.isaac.lab/omni/isaac/lab/envs/mdp/actions/joint_actions_to_limits.py", line 188, in reset
self._prev_applied_actions[env_ids, :] = self._asset.data.joint_pos[env_ids, self._joint_ids]
IndexError: shape mismatch: indexing tensors could not be broadcast together with shapes [12], [4]
This bug seems to have resurfaced in Isaac Sim Version: 4.5 (now on line 206).
206: self._prev_applied_actions[env_ids, :] = self._asset.data.joint_pos[env_ids, self._joint_ids]
Steps to reproduce
If I define EMAJointPositionToLimitsAction joints=[".*"] it works fine (self._joint_ids = slice(None,None,None)), but if the joints are explicitly set, then self._joint_ids = list[int], causing self._asset.data.joint_pos[env_ids, self._joint_ids] to have two dimensions instead of three.
Fixing the error
self._prev_applied_actions[env_ids, :] = self._asset.data.joint_pos[env_ids][:,:,self._joint_ids]
or self._prev_applied_actions[env_ids, :] = self._asset.data.joint_pos[env_ids][...,self._joint_ids]
Activity
Mayankm96 commentedon Oct 1, 2024
This seems like a broadcasting issue. A better fix probably is:
Can you try if that works? If yes, can you make an MR? Thanks!
bearpaw commentedon Oct 10, 2024
I got the same error with the following setting:
Describe the bug
In some cases, we want to move certain joints instead of all the joints when we train an agent. This is enable by passing argument
env.actions.joint_pos.joint_names. This will cause an indexing error in pytorch.Steps to reproduce
For example, we want to only move the index finger of the Allegro hand for the cube reposing task:
python source/standalone/workflows/rsl_rl/train.py \ --task Isaac-Repose-Cube-Allegro-v0 \ --num_env 12 \ env.actions.joint_pos.joint_names='["index_joint.*"]'We will get the following error:
System Info
Describe the characteristic of your environment:
Additional context
NA
Checklist
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.
Fixes pytorch broadcasting issue in `EMAJointPositionToLimitsAction` (#…
Fixes pytorch broadcasting issue in `EMAJointPositionToLimitsAction` (i…
benrichardson28 commentedon Aug 22, 2025
This bug seems to have resurfaced in Isaac Sim Version: 4.5 (now on line 206).
206: self._prev_applied_actions[env_ids, :] = self._asset.data.joint_pos[env_ids, self._joint_ids]
Steps to reproduce
If I define EMAJointPositionToLimitsAction joints=[".*"] it works fine (self._joint_ids = slice(None,None,None)), but if the joints are explicitly set, then self._joint_ids = list[int], causing self._asset.data.joint_pos[env_ids, self._joint_ids] to have two dimensions instead of three.
Fixing the error
self._prev_applied_actions[env_ids, :] = self._asset.data.joint_pos[env_ids][:,:,self._joint_ids]or
self._prev_applied_actions[env_ids, :] = self._asset.data.joint_pos[env_ids][...,self._joint_ids]These seem to work for both cases at least.
System Info
Describe the characteristic of your environment:
Yasu31 commentedon Oct 17, 2025
I submitted a bug report about the newly resurfaced error here: #3753
and a PR that fixes it here: #3754
Fixes pytorch broadcasting issue in `EMAJointPositionToLimitsAction` (i…