@@ -23,9 +23,7 @@ class NoelObstacleSet:
2323
2424def load_noel_c4_obstacles () -> NoelObstacleSet :
2525 obstacle_path = (
26- Path (__file__ ).resolve ().parents [3 ]
27- / "externals"
28- / "noel-c4-obstacles-aug.npz"
26+ Path (__file__ ).resolve ().parents [3 ] / "externals" / "noel-c4-obstacles-aug.npz"
2927 # / "noel-c4-obstacles.npz"
3028 )
3129 data = np .load (obstacle_path , allow_pickle = True )
@@ -107,7 +105,7 @@ def load_noel_c4_obstacles() -> NoelObstacleSet:
107105 ends = starts + directions * lengths [:, None ]
108106 center = np .vstack ([starts , ends ]).mean (axis = 0 )
109107 starts [:, 0 ] -= 0.10
110- starts [:, 1 ] += 1.0 - center [1 ] + 0.25
108+ starts [:, 1 ] += 1.0 - center [1 ] + 0.15
111109 starts [:, 2 ] -= 0.75
112110
113111 return NoelObstacleSet (
@@ -123,9 +121,7 @@ def load_noel_c4_obstacles() -> NoelObstacleSet:
123121class NoelC4Simulation (DualArmSimulationBase ):
124122 tip_haptic_max_penetration : float = 0.01
125123 _obstacles : NoelObstacleSet = field (init = False )
126- _tip_penetration_by_arm : dict [str , float ] = field (
127- init = False , default_factory = dict
128- )
124+ _tip_penetration_by_arm : dict [str , float ] = field (init = False , default_factory = dict )
129125 _haptic_events : list [HapticEvent ] = field (init = False , default_factory = list )
130126
131127 def build_simulation (self ) -> None :
@@ -138,8 +134,8 @@ def build_simulation(self) -> None:
138134 # from virtual_field.runtime.spirob_elastica.constraints import (
139135 # _SpirobBendConstraint,
140136 # )
141- from virtual_field .runtime .spirob_elastica .sdf_objects import (
142- SDFObstacleCylinders ,
137+ from virtual_field .runtime .spirob_elastica .sdf_objects_hash import (
138+ SDFObstacleCylindersHash ,
143139 )
144140
145141 self ._obstacles = load_noel_c4_obstacles ()
@@ -193,7 +189,7 @@ class _Simulator(
193189 self .simulator .append (self .left_rod )
194190 self .simulator .append (self .right_rod )
195191
196- p_linear = 200 .0
192+ p_linear = 500 .0
197193 p_angular = 5.0
198194
199195 self .simulator .add_forcing_to (self .left_rod ).using (
@@ -226,24 +222,25 @@ class _Simulator(
226222 constrained_director_idx = (0 ,),
227223 )
228224
229- self .simulator .detect_contact_between (
230- self .left_rod , self .right_rod
231- ).using (ea .RodRodContact , k = 1e4 , nu = 3 )
232- self .simulator .detect_contact_between (
233- self .right_rod , self .right_rod
234- ).using (ea .RodSelfContact , k = 1e4 , nu = 3 )
225+ self .simulator .detect_contact_between (self .left_rod , self .right_rod ).using (
226+ ea .RodRodContact , k = 1e4 , nu = 3
227+ )
228+ self .simulator .detect_contact_between (self .right_rod , self .right_rod ).using (
229+ ea .RodSelfContact , k = 1e4 , nu = 3
230+ )
231+ self .simulator .detect_contact_between (self .left_rod , self .left_rod ).using (
232+ ea .RodSelfContact , k = 1e4 , nu = 3
233+ )
235234 # self.simulator.add_forcing_to(self.left_rod).using(
236235 # _SpirobBendConstraint,
237236 # kt=0,
238237 # allowed_angle_in_deg=30,
239238 # )
240239
241240 for rod in (self .left_rod , self .right_rod ):
242- arm_id = (
243- self .arm_ids [0 ] if rod is self .left_rod else self .arm_ids [1 ]
244- )
241+ arm_id = self .arm_ids [0 ] if rod is self .left_rod else self .arm_ids [1 ]
245242 self .simulator .add_forcing_to (rod ).using (
246- SDFObstacleCylinders ,
243+ SDFObstacleCylindersHash ,
247244 starts = self ._obstacles .starts ,
248245 directions = self ._obstacles .directions ,
249246 lengths = self ._obstacles .lengths ,
@@ -293,7 +290,7 @@ def haptic_events(self) -> list[HapticEvent]:
293290 arm_id = event .arm_id
294291 penetration = self ._tip_penetration_by_arm .get (arm_id , 0.0 )
295292 intensity = penetration / self .tip_haptic_max_penetration
296- intensity = max (0.0 , min (1.0 , intensity ))
293+ intensity = max (0.0 , min (0.5 , intensity )) # cap at 50%
297294 event .active = intensity > 0.0
298295 event .intensity = intensity
299296 return self ._haptic_events
0 commit comments