@@ -262,10 +262,9 @@ def __init__(
262262 self , cfg : EventTermCfg , env : ManagerBasedEnv , asset : RigidObject | Articulation , asset_cfg : SceneEntityCfg
263263 ):
264264 import isaaclab_newton .physics .newton_manager as newton_manager_module # noqa: PLC0415
265+ from isaaclab_newton .assets import Articulation as NewtonArticulation # noqa: PLC0415
265266 from newton .solvers import SolverNotifyFlags # noqa: PLC0415
266267
267- from isaaclab .assets import BaseArticulation
268-
269268 self .asset = asset
270269 self .asset_cfg = asset_cfg
271270 self ._newton_manager = newton_manager_module .NewtonManager
@@ -275,8 +274,13 @@ def __init__(
275274 self ._static_friction_range = cfg .params .get ("static_friction_range" , (1.0 , 1.0 ))
276275 self ._restitution_range = cfg .params .get ("restitution_range" , (0.0 , 0.0 ))
277276
277+ # get friction/restitution view-level bindings
278+ model = self ._newton_manager .get_model ()
279+ self ._friction_binding = asset ._root_view .get_attribute ("shape_material_mu" , model )[:, 0 ] # type: ignore
280+ self ._restitution_binding = asset ._root_view .get_attribute ("shape_material_restitution" , model )[:, 0 ] # type: ignore
281+
278282 # compute shape indices for body-specific randomization
279- if isinstance (asset , BaseArticulation ) and asset_cfg .body_ids != slice (None ):
283+ if isinstance (asset , NewtonArticulation ) and asset_cfg .body_ids != slice (None ):
280284 num_shapes_per_body = asset .num_shapes_per_body
281285 shape_indices_list = []
282286 for body_id in asset_cfg .body_ids :
@@ -285,13 +289,7 @@ def __init__(
285289 shape_indices_list .extend (range (start_idx , end_idx ))
286290 self ._shape_indices = torch .tensor (shape_indices_list , dtype = torch .long )
287291 else :
288- total_shapes = sum (asset .num_shapes_per_body )
289- self ._shape_indices = torch .arange (total_shapes , dtype = torch .long )
290-
291- # get friction/restitution view-level bindings
292- model = self ._newton_manager .get_model ()
293- self ._friction_binding = asset ._root_view .get_attribute ("shape_material_mu" , model )[:, 0 ] # type: ignore
294- self ._restitution_binding = asset ._root_view .get_attribute ("shape_material_restitution" , model )[:, 0 ] # type: ignore
292+ self ._shape_indices = torch .arange (self ._friction_binding .shape [1 ], dtype = torch .long )
295293
296294 def __call__ (
297295 self ,
0 commit comments