-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Description
If you are submitting a bug report, please fill in the following details and use the tag [bug].
Describe the bug
Several functions in the Articulation
class and InteractiveScene
class are expecting the wrong types for env_ids, or converting them to slices wrongfully.
Issue 1: None passed in as env id
joint ids got wrongfully converted to slice(None)
while in fact it should have type Sequence[int] | None
.
IsaacLab/source/isaaclab/isaaclab/scene/interactive_scene.py:
class InteractiveScene:
...
def reset_to(
self,
state: dict[str, dict[str, dict[str, torch.Tensor]]],
env_ids: Sequence[int] | None = None,
is_relative: bool = False,
):
# resolve env_ids
if env_ids is None:
env_ids = slice(None)
which gives the following error when env_ids=None
:
File ".../IsaacLab/IsaacLab/source/isaaclab/isaaclab/scene/interactive_scene.py", line 454, in reset_to
articulation.write_root_pose_to_sim(root_pose, env_ids=env_ids)
File ".../IsaacLab/source/isaaclab/isaaclab/assets/articulation/articulation.py", line 322, in write_root_pose_to_sim
self.write_root_link_pose_to_sim(root_pose, env_ids=env_ids)
File ".../IsaacLab/source/isaaclab/isaaclab/assets/articulation/articulation.py", line 360, in write_root_link_pose_to_sim
self.root_physx_view.set_root_transforms(root_poses_xyzw, indices=physx_env_ids)
File "...../envs/env_isaaclab/lib/python3.10/site-packages/isaacsim/extsPhysics/omni.physics.tensors/omni/physics/tensors/impl/api.py", line 1344, in set_root_transforms
indices = self._frontend.as_contiguous_uint32(indices)
File "...../envs/env_isaaclab/lib/python3.10/site-packages/isaacsim/extsPhysics/omni.physics.tensors/omni/physics/tensors/impl/frontend_torch.py", line 88, in as_contiguous_uint32
return tensor.to(torch.int32).contiguous()
AttributeError: 'slice' object has no attribute 'to'
Issue 2:
For example, see the following function set_joint_position_target
and its signature
IsaacLab/source/isaaclab/isaaclab/assets/articulation/articulation.py
def set_joint_position_target(
self, target: torch.Tensor, joint_ids: Sequence[int] | slice | None = None, env_ids: Sequence[int] | None = None
):
if joint_ids is None:
joint_ids = slice(None)
# broadcast env_ids if needed to allow double indexing
if env_ids != slice(None) and joint_ids != slice(None):
env_ids = env_ids[:, None]
# set targets
self._data.joint_pos_target[env_ids, joint_ids] = target
List[int]
is also considered as Sequence[int]. However, if env_ids is a list of int, the code env_ids = env_ids[:, None]
will fail with the following traceback:
File "isaac_lab_test.py", line 385, in main
robot.set_joint_position_target(pos_target, joint_ids=arm_joint_ids, env_ids=[env_idx])
File "....../IsaacLab/source/isaaclab/isaaclab/assets/articulation/articulation.py", line 910, in set_joint_position_target
env_ids = env_ids[:, None]
TypeError: list indices must be integers or slices, not NoneType
System Info
Describe the characteristic of your environment:
- Commit: db5c1c3
- Isaac Sim Version: 4.5
- OS: Debian 13 (trixie)
- GPU: RTX 4090
- CUDA: 12.1
- GPU Driver: 570.158.01
- Python 3.10.18
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.
- Fix all type issues regarding env_ids in all of the functions in InteractiveScene and Articulation.