gs.options.RigidOptions#

class genesis.options.solvers.RigidOptions(*, contact_resolve_time: float | None = None, dt: float | None = None, gravity: tuple[typing.Annotated[float, FieldInfo(annotation=NoneType, required=True, metadata=[Strict(strict=False), _PydanticGeneralMetadata(allow_inf_nan=False)])], typing.Annotated[float, FieldInfo(annotation=NoneType, required=True, metadata=[Strict(strict=False), _PydanticGeneralMetadata(allow_inf_nan=False)])], typing.Annotated[float, FieldInfo(annotation=NoneType, required=True, metadata=[Strict(strict=False), _PydanticGeneralMetadata(allow_inf_nan=False)])]] | None = None, enable_collision: bool = True, enable_joint_limit: bool = True, enable_self_collision: bool = True, enable_neutral_collision: bool = False, enable_adjacent_collision: bool = False, disable_constraint: bool = False, max_collision_pairs: int = 150, max_contacts: int | None = None, multiplier_collision_broad_phase: int = 8, integrator: integrator = integrator.approximate_implicitfast, IK_max_targets: int = 6, batch_links_info: bool = False, batch_joints_info: bool = False, batch_dofs_info: bool = False, constraint_solver: constraint_solver = constraint_solver.Newton, iterations: int = 50, tolerance: float | None = None, ls_iterations: int = 50, ls_tolerance: float = 0.01, noslip_iterations: int = 0, noslip_tolerance: float = 1e-06, contact_pruning_tolerance: float | None = 0.02, sparse_solve: bool | None = None, constraint_timeconst: float = 0.01, use_contact_island: bool = True, box_box_detection: bool = False, use_hibernation: bool = False, hibernation_thresh_vel: float | None = None, max_dynamic_constraints: int = 8, enable_multi_contact: bool = True, enable_mujoco_compatibility: bool = False, use_gjk_collision: bool | None = None, broadphase_traversal: broadphase_traversal | None = None)[source]#

Options configuring the RigidSolver.

Parameters:
  • dt (float, optional) – Time duration for each simulation step in seconds. If none, it will inherit from SimOptions. Defaults to None.

  • gravity (tuple, optional) – Gravity force in N/kg. If none, it will inherit from SimOptions. Defaults to None.

  • enable_collision (bool, optional) – Whether to enable collision detection. Defaults to True.

  • enable_joint_limit (bool, optional) – Whether to enable joint limit. Defaults to True.

  • enable_self_collision (bool, optional) – Whether to enable self collision within each entity. Defaults to True.

  • enable_neutral_collision (bool, optional) – Whether to enable self collision occurring in neutral configuration (qpos0) within each entity. Defaults to False.

  • enable_adjacent_collision (bool, optional) – Whether to enable collision between successive parent-child body pairs within each entity. Defaults to False.

  • disable_constraint (bool, optional) – Whether to disable all constraints. Defaults to False.

  • max_collision_pairs (int, optional) – Maximum number of collision pairs. Defaults to 100.

  • max_contacts (int, optional) –

    Maximum number of simultaneous contact points per environment that the constraint solver can handle, which determines the size of the contact constraint buffers (4 constraints per contact point). Defaults to None.

    This limit applies to the final contact points after pruning, not to the candidate contact points that collision detection can emit (see ‘max_collision_pairs’). Exceeding it at runtime halts the simulation with an error. None resolves it automatically: the pre-pruning worst case or, when contact pruning is enabled (see ‘contact_pruning_tolerance’), 32 contact points per candidate link pair but no less than 512, whichever is smaller.

  • integrator (gs.integrator, optional) – Integrator type. Current supported integrators are ‘gs.integrator.Euler’, ‘gs.integrator.implicitfast’ and ‘gs.integrator.approximate_implicitfast’. ‘Euler’ and ‘implicitfast’ are consistent with their Mujoco counterpart. ‘approximate_implicitfast’ is an even faster approximation of ‘implicitfast’, which avoid computing the inverse mass matrix twice by considering the first order correction terms of the implicit integration scheme systematically, including for computing the acceleration resulting from the constraints and external forces. Although this approximation is wrong in theory, it works reasonably well in practice. Defaults to ‘approximate_implicitfast’.

  • IK_max_targets (int, optional) – Maximum number of IK targets. Increasing this doesn’t affect IK solving speed, but will increase memory usage. Defaults to 6.

  • constraint_solver (gs.constraint_solver, optional) – Constraint solver type. Current supported constraint solvers are ‘gs.constraint_solver.CG’ (conjugate gradient) and ‘gs.constraint_solver.Newton’ (Newton’s method). Defaults to ‘Newton’.

  • iterations (int, optional) – Number of iterations for the constraint solver. Defaults to 50.

  • tolerance (float, optional) – Tolerance for the constraint solver. If None, resolved based on the floating-point precision selected via gs.init(precision=…): 1e-5 for single precision (“32”) and 1e-8 for double precision (“64”). Defaults to None.

  • ls_iterations (int, optional) – Number of line search iterations for the constraint solver. Defaults to 50.

  • ls_tolerance (float, optional) – Tolerance for the line search. Defaults to 1e-2.

  • noslip_iterations (int, optional) – Number of iterations for the noslip solver. Defaults to 0 (disabled). noslip is a post-processing step after the main solver to suppress slip/drift. Recommended to set this value to 5 for manipulation tasks or when slip/drift is a big problem. This option should only be enabled if necessary because it is experimental and will slow down the simulation.

  • noslip_tolerance (float, optional) – Tolerance for the noslip solver. Defaults to 1e-6.

  • sparse_solve (bool, optional) –

    Whether to exploit sparsity (skyline-envelope Cholesky) in the constraint solver.

    Defaults to None, which resolves automatically: enabled on the CPU backend (and not under MuJoCo compatibility) when the scene has block structure - at least two DOF-carrying bodies or at least two free joints - so the Hessian band stays much tighter than its dimension. Never enabled on GPU, where the dense tiled factorization is faster. Set True or False to override the automatic choice; True is ignored with a warning on GPU.

  • contact_resolve_time (float, optional) – Please note that this option will be deprecated in a future version. Use ‘constraint_timeconst’ instead.

  • constraint_timeconst (float) – Lower-bound of the default time to resolve the constraint (2*dt). The smaller the value, the more stiff the constraint. This parameter is called ‘timeconst’ in Mujoco (https://mujoco.readthedocs.io/en/latest/modeling.html#solver-parameters). Defaults to 0.01.

  • use_contact_island (bool, optional) – Whether to partition the constraint solve into independent per-island blocks. It has no effect on a scene that is a single dense-coupled tree (one island) or is differentiable, where the dense whole-scene solve is used regardless. Defaults to True.

  • use_hibernation (bool, optional) – Whether to put bodies that have come to rest to sleep, so the solver skips them until they are disturbed. It quietly has no effect on a body that is differentiable, prunable, or under no-slip friction. Defaults to False.

  • hibernation_thresh_vel (float, optional) – Velocity tolerance for hibernation, in meters per second: a body sleeps once its maximum DOF speed stays below this for a few consecutive steps, and a whole island sleeps once all its bodies are ready. Each rotational DOF is weighted by the body’s swept radius, so the tolerance is a single linear speed that applies uniformly to translation and rotation. If None, it is set to 1e-4 when MuJoCo compatibility is enabled (matching MuJoCo’s default) and 2e-3 otherwise. Defaults to None.

  • max_dynamic_constraints (int, optional) – Maximum number of dynamic constraints (like suction cup). Defaults to 8.

  • use_gjk_collision (bool, optional) – Whether to use GJK for collision detection instead of MPR. More stable but much slower. Defaults to sim_options.requires_grad.

  • broadphase_traversal (gs.broadphase_traversal, optional) – Broadphase traversal strategy. SAP (sweep-and-prune) or ALL_VS_ALL (parallel pair iteration). Defaults to None (auto: SAP on CPU or when hibernation/heterogeneous entities are enabled, ALL_VS_ALL on GPU otherwise). See gs.broadphase_traversal for details on each strategy.

Warning

Hibernation hasn’t been robustly tested and will be fully supported soon.