@@ -58,8 +58,11 @@ def __init__(self,
5858 position ,
5959 quaternion = rotations .IDENTITY_QUATERNION ,
6060 ignore_collisions = False ,
61+ max_qvel_tol = _SETTLE_QVEL_TOL ,
62+ max_qacc_tol = _SETTLE_QACC_TOL ,
6163 max_attempts_per_prop = 20 ,
6264 settle_physics = False ,
65+ min_settle_physics_time = 0. ,
6366 max_settle_physics_time = 2. ,
6467 max_settle_physics_attempts = 1 ,
6568 raise_exception_on_settle_failure = False ):
@@ -77,11 +80,19 @@ def __init__(self,
7780 `variation.deterministic.Sequence`.
7881 ignore_collisions: (optional) If True, ignore collisions between props,
7982 i.e. do not run rejection sampling.
83+ max_qvel_tol: Maximum post-initialization joint velocity for props. If
84+ `settle_physics=True`, the simulation will be run until all prop joint
85+ velocities are less than this threshold.
86+ max_qacc_tol: Maximum post-initialization joint acceleration for props. If
87+ `settle_physics=True`, the simulation will be run until all prop joint
88+ velocities are less than this threshold.
8089 max_attempts_per_prop: The maximum number of rejection sampling attempts
8190 per prop. If a non-colliding pose cannot be found before this limit is
8291 reached, a `RuntimeError` will be raised.
8392 settle_physics: (optional) If True, the physics simulation will be
8493 advanced for a few steps to allow the prop positions to settle.
94+ min_settle_physics_time: (optional) When `settle_physics` is True, lower
95+ bound on time (in seconds) the physics simulation is advanced.
8596 max_settle_physics_time: (optional) When `settle_physics` is True, upper
8697 bound on time (in seconds) the physics simulation is advanced.
8798 max_settle_physics_attempts: (optional) When `settle_physics` is True, the
@@ -102,6 +113,9 @@ def __init__(self,
102113 self ._ignore_collisions = ignore_collisions
103114 self ._max_attempts_per_prop = max_attempts_per_prop
104115 self ._settle_physics = settle_physics
116+ self ._max_qvel_tol = max_qvel_tol
117+ self ._max_qacc_tol = max_qacc_tol
118+ self ._min_settle_physics_time = min_settle_physics_time
105119 self ._max_settle_physics_time = max_settle_physics_time
106120 self ._max_settle_physics_attempts = max_settle_physics_attempts
107121 self ._raise_exception_on_settle_failure = raise_exception_on_settle_failure
@@ -230,7 +244,10 @@ def place_and_settle():
230244 physics .step ()
231245 max_qvel = np .max (np .abs (prop_joints_mj .qvel ))
232246 max_qacc = np .max (np .abs (prop_joints_mj .qacc ))
233- if (max_qvel < _SETTLE_QVEL_TOL and max_qacc < _SETTLE_QACC_TOL ):
247+ if (max_qvel < self ._max_qvel_tol ) and (
248+ max_qacc < self ._max_qacc_tol ) and (
249+ physics .data .time - original_time
250+ ) > self ._min_settle_physics_time :
234251 return True
235252 physics .data .time = original_time
236253
0 commit comments