Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions genesis/engine/solvers/rigid/rigid_solver.py
Original file line number Diff line number Diff line change
Expand Up @@ -337,6 +337,10 @@ def build(self):
self.n_fixed_verts_ = max(1, self.n_fixed_verts)
self.n_candidate_equalities_ = max(1, self.n_equalities + self._options.max_dynamic_constraints)

# Resolve precision-dependent tolerance default
if self._options.tolerance is None:
self._options.tolerance = 1e-5 if gs.qd_float == qd.f32 else 1e-8
Comment thread
duburcqa marked this conversation as resolved.
Comment thread
duburcqa marked this conversation as resolved.

super().build()

self._init_mass_mat()
Expand Down
6 changes: 4 additions & 2 deletions genesis/options/solvers.py
Original file line number Diff line number Diff line change
Expand Up @@ -435,7 +435,9 @@ class RigidOptions(Options):
iterations : int, optional
Number of iterations for the constraint solver. Defaults to 50.
tolerance : float, optional
Tolerance for the constraint solver. Defaults to 1e-6.
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
Expand Down Expand Up @@ -500,7 +502,7 @@ class RigidOptions(Options):
# constraint solver
constraint_solver: gs.constraint_solver = gs.constraint_solver.Newton
iterations: PositiveInt = 50
tolerance: PositiveFloat = 1e-6
tolerance: PositiveFloat | None = None
Comment thread
duburcqa marked this conversation as resolved.
ls_iterations: PositiveInt = 50
ls_tolerance: PositiveFloat = 1e-2
noslip_iterations: NonNegativeInt = 0
Expand Down
Loading