Skip to content

Commit 85917aa

Browse files
committed
Resolve replication templates against the active backend
The {backend} placeholder follows the user's backend choice via the factory's existing resolution instead of a class-pinned name; an unavailable backend fails naturally at import. This also lets SurfaceGripperCfg use the template like every other cfg.
1 parent bef41ad commit 85917aa

2 files changed

Lines changed: 8 additions & 4 deletions

File tree

source/isaaclab/isaaclab/assets/asset_base.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
from isaaclab.physics import PhysicsEvent, PhysicsManager
2121
from isaaclab.sim.simulation_context import SimulationContext
2222
from isaaclab.sim.utils.stage import get_current_stage
23+
from isaaclab.utils.backend_utils import FactoryBase
2324
from isaaclab.utils.string import string_to_callable
2425

2526
if TYPE_CHECKING:
@@ -121,11 +122,11 @@ def _queue_replication(self, cfg: AssetBaseCfg) -> None:
121122
"""Queue the replication contexts directed by ``cfg``.
122123
123124
The cfg's :attr:`~isaaclab.assets.AssetBaseCfg.replication` field is the source of
124-
truth; a string reference resolves through the class's ``__backend_name__``.
125+
truth; a string reference resolves against the active physics backend.
125126
"""
126127
replication = cfg.replication
127128
if isinstance(replication, str):
128-
mod_name, attr_name = replication.format(backend=self.__backend_name__).rsplit(":", 1)
129+
mod_name, attr_name = replication.format(backend=FactoryBase._get_backend()).rsplit(":", 1)
129130
replication = getattr(importlib.import_module(mod_name), attr_name)
130131
if replication:
131132
contexts = [string_to_callable(c) if isinstance(c, str) else c for c in replication]

source/isaaclab_physx/isaaclab_physx/assets/surface_gripper/surface_gripper_cfg.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,11 @@
1717
class SurfaceGripperCfg(AssetBaseCfg):
1818
"""Configuration parameters for a surface gripper actuator."""
1919

20-
replication = ("isaaclab.cloner:UsdReplicateContext", "isaaclab_physx.cloner:PhysxReplicateContext")
21-
"""Replication contexts for the gripper. See :attr:`~isaaclab.assets.AssetBaseCfg.replication`."""
20+
replication = "isaaclab_{backend}.cloner:REPLICATION"
21+
"""Replication directed by the active backend's default stack.
22+
23+
See :attr:`~isaaclab.assets.AssetBaseCfg.replication`.
24+
"""
2225

2326
prim_path: str = MISSING
2427
"""The expression to find the grippers in the stage."""

0 commit comments

Comments
 (0)