Skip to content

Commit 579bd62

Browse files
committed
Defer environment origin tensor creation
1 parent eca3cd2 commit 579bd62

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

source/isaaclab/isaaclab/scene/interactive_scene.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ def __init__(self, cfg: InteractiveSceneCfg):
201201
else:
202202
self.stage.DefinePrim(self.env_prim_paths[0], "Xform")
203203
positions = cloner.grid_transforms(self.num_envs, self.cfg.env_spacing)[0]
204-
self._env_origins = torch.as_tensor(positions, device=self.device)
204+
self._env_origins = positions
205205
self._env_origins_plan = self.sim.get_clone_plan()
206206

207207
# Every sensor exists by now, so all visualizer and camera-renderer requirements are visible.
@@ -384,8 +384,10 @@ def env_origins(self) -> torch.Tensor:
384384
return self._terrain.env_origins
385385
plan = self.sim.get_clone_plan()
386386
if plan is not None and plan is not self._env_origins_plan:
387-
self._env_origins = torch.as_tensor(plan.positions, device=self.device)
387+
self._env_origins = plan.positions
388388
self._env_origins_plan = plan
389+
if not isinstance(self._env_origins, torch.Tensor):
390+
self._env_origins = torch.as_tensor(self._env_origins, device=self.device)
389391
return self._env_origins
390392

391393
@property

0 commit comments

Comments
 (0)