@@ -921,15 +921,6 @@ def _init_constraint_solver(self):
921921 def substep (self ):
922922 # from genesis.utils.tools import create_timer
923923
924- # Note: ContactIsland param is needed when supporting hibernation. But the attribute does not exist
925- # in the solver when hibernation is disabled. In that case, we create a dummy ContactIsland object
926- # needed for compilation, but not being used in the kernel.
927- if not hasattr (self , "optional_contact_island" ):
928- if hasattr (self , "constraint_solver" ) and hasattr (self .constraint_solver , "contact_island" ):
929- self .optional_contact_island = self .constraint_solver .contact_island
930- else :
931- self .optional_contact_island = ContactIsland (self .collider )
932-
933924 # timer = create_timer("rigid", level=1, ti_sync=True, skip_first_call=True)
934925 kernel_step_1 (
935926 links_state = self .links_state ,
@@ -944,7 +935,7 @@ def substep(self):
944935 entities_info = self .entities_info ,
945936 rigid_global_info = self ._rigid_global_info ,
946937 static_rigid_sim_config = self ._static_rigid_sim_config ,
947- contact_island = self .optional_contact_island ,
938+ contact_island = self .constraint_solver . contact_island ,
948939 )
949940 # timer.stamp("kernel_step_1")
950941 self ._func_constraint_force ()
@@ -963,7 +954,7 @@ def substep(self):
963954 collider_state = self .collider ._collider_state ,
964955 rigid_global_info = self ._rigid_global_info ,
965956 static_rigid_sim_config = self ._static_rigid_sim_config ,
966- contact_island = self .optional_contact_island ,
957+ contact_island = self .constraint_solver . contact_island ,
967958 )
968959 # timer.stamp("kernel_step_2")
969960
@@ -1015,6 +1006,7 @@ def _func_forward_dynamics(self):
10151006 geoms_state = self .geoms_state ,
10161007 rigid_global_info = self ._rigid_global_info ,
10171008 static_rigid_sim_config = self ._static_rigid_sim_config ,
1009+ contact_island = self .constraint_solver .contact_island ,
10181010 )
10191011
10201012 def _func_update_acc (self ):
@@ -3023,6 +3015,7 @@ def kernel_forward_dynamics(
30233015 geoms_state : array_class .GeomsState ,
30243016 rigid_global_info : array_class .RigidGlobalInfo ,
30253017 static_rigid_sim_config : ti .template (),
3018+ contact_island : ti .template (), # ContactIsland
30263019):
30273020 func_forward_dynamics (
30283021 links_state = links_state ,
@@ -3035,6 +3028,7 @@ def kernel_forward_dynamics(
30353028 geoms_state = geoms_state ,
30363029 rigid_global_info = rigid_global_info ,
30373030 static_rigid_sim_config = static_rigid_sim_config ,
3031+ contact_island = contact_island ,
30383032 )
30393033
30403034
0 commit comments