Skip to content

Commit a869b46

Browse files
authored
[MISC] Fix max number of constraints. (#2000)
1 parent ab9ee2d commit a869b46

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

‎genesis/engine/solvers/rigid/constraint_solver_decomp.py‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,14 +31,15 @@ def __init__(self, rigid_solver: "RigidSolver"):
3131
self.ls_tolerance = rigid_solver._options.ls_tolerance
3232
self.sparse_solve = rigid_solver._options.sparse_solve
3333

34+
# Note that it must be over-estimated because friction parameters and joint limits may be updated dynamically.
3435
# * 4 constraints per contact
35-
# * 1 constraint per joint limit (upper and lower, if not inf)
36+
# * 1 constraint per 1DoF joint limit (upper and lower, if not inf)
3637
# * 1 constraint per dof frictionloss
3738
# * up to 6 constraints per equality (weld)
3839
self.len_constraints = int(
3940
4 * rigid_solver.collider._collider_info.max_contact_pairs[None]
40-
+ (self._solver.dofs_info.frictionloss.to_numpy() > gs.EPS).sum()
41-
+ (~np.isinf(self._solver.dofs_info.limit.to_numpy()).any(axis=-1)).sum()
41+
+ sum(joint.type in (gs.JOINT_TYPE.REVOLUTE, gs.JOINT_TYPE.PRISMATIC) for joint in self._solver.joints)
42+
+ self._solver.n_dofs
4243
+ self._solver.n_equalities_candidate * 6
4344
)
4445
self.len_constraints_ = max(1, self.len_constraints)

0 commit comments

Comments
 (0)