Limits#

Base#

class mink_warp.Limit[source]#

Bases: ABC

Abstract hard kinematic limit.

Limits constrain the tangent step \(\Delta q \in T_q(\mathcal{C})\) and are enforced by ConstrainedSolver. Each limit may expose:

  • box — per-dof bounds \(\ell \leq \Delta q \leq u\)

  • dense rows\(G(q)\, \Delta q \leq h(q)\)

n_inequalities: int = 0#

Number of dense G dq <= h rows this limit contributes (0 = box-only).

box_capable: bool = True#

Whether apply_box() is implemented (False for inequality-only limits).

supports_cuda_graph: bool = True#

False when inequality assembly reads device state on the host each step.

apply_box(configuration: Configuration, dt: float, lo: array, hi: array) None[source]#

Intersect this limit’s bounds into the shared per-world box.

Parameters:
  • configuration – Current batched configuration.

  • dt – Integration timestep [s].

  • lo – Per-world lower bound on dq, shape (nworld, nv), updated in place with lo = max(lo, this_lower).

  • hi – Per-world upper bound on dq, shape (nworld, nv), updated in place with hi = min(hi, this_upper).

scatter_inequalities(configuration: Configuration, dt: float, row_offset: int, G: array, h: array) None[source]#

Write dense inequality rows into shared buffers.

Row \(i\) encodes \(G_i \Delta q \leq h_i\). Buffers have shape (nworld, m, nv) and (nworld, m); only rows owned by this limit are overwritten.

Parameters:
  • configuration – Current batched configuration.

  • dt – Timestep \(\mathrm{d}t\) in [s].

  • row_offset – First row index for this limit.

  • G – Shared inequality matrix.

  • h – Shared bound vector.

Box limits#

class mink_warp.ConfigurationLimit[source]#

Bases: Limit

Box on dq keeping each limited joint inside its range.

apply_box(configuration: Configuration, dt: float, lo: array, hi: array) None[source]#

Intersect this limit’s bounds into the shared per-world box.

Parameters:
  • configuration – Current batched configuration.

  • dt – Integration timestep [s].

  • lo – Per-world lower bound on dq, shape (nworld, nv), updated in place with lo = max(lo, this_lower).

  • hi – Per-world upper bound on dq, shape (nworld, nv), updated in place with hi = min(hi, this_upper).

scatter_inequalities(configuration: Configuration, dt: float, row_offset: int, G: array, h: array) None[source]#

Write dense inequality rows into shared buffers.

Row \(i\) encodes \(G_i \Delta q \leq h_i\). Buffers have shape (nworld, m, nv) and (nworld, m); only rows owned by this limit are overwritten.

Parameters:
  • configuration – Current batched configuration.

  • dt – Timestep \(\mathrm{d}t\) in [s].

  • row_offset – First row index for this limit.

  • G – Shared inequality matrix.

  • h – Shared bound vector.

class mink_warp.VelocityLimit[source]#

Bases: Limit

Box on dq bounding each selected joint’s per-step displacement.

apply_box(configuration: Configuration, dt: float, lo: array, hi: array) None[source]#

Intersect this limit’s bounds into the shared per-world box.

Parameters:
  • configuration – Current batched configuration.

  • dt – Integration timestep [s].

  • lo – Per-world lower bound on dq, shape (nworld, nv), updated in place with lo = max(lo, this_lower).

  • hi – Per-world upper bound on dq, shape (nworld, nv), updated in place with hi = min(hi, this_upper).

scatter_inequalities(configuration: Configuration, dt: float, row_offset: int, G: array, h: array) None[source]#

Write dense inequality rows into shared buffers.

Row \(i\) encodes \(G_i \Delta q \leq h_i\). Buffers have shape (nworld, m, nv) and (nworld, m); only rows owned by this limit are overwritten.

Parameters:
  • configuration – Current batched configuration.

  • dt – Timestep \(\mathrm{d}t\) in [s].

  • row_offset – First row index for this limit.

  • G – Shared inequality matrix.

  • h – Shared bound vector.

class mink_warp.CollisionAvoidanceLimit[source]#

Bases: Limit

Normal-velocity collision avoidance between geom pairs.

For each active pair with signed distance \(d\) (negative when penetrating), unit normal \(n\) (from geom 1 toward geom 2), and witness Jacobian row \(J_n\), the limit contributes:

\[\begin{split}J_n\, \Delta q \leq h, \quad h = \begin{cases} \gamma (d - d_{\min}) / \mathrm{d}t + \varepsilon & d > d_{\min} \\ \varepsilon & \text{otherwise} \end{cases}\end{split}\]

where \(d_{\min}\) is minimum_distance_from_collisions, \(\gamma\) is gain, and \(\varepsilon\) is bound_relaxation. Matches Mink’s CollisionAvoidanceLimit; distances are queried on the host per world, Jacobian rows assembled on device.

box_capable: bool = False#

Whether apply_box() is implemented (False for inequality-only limits).

supports_cuda_graph: bool = False#

False when inequality assembly reads device state on the host each step.

scatter_inequalities(configuration: Configuration, dt: float, row_offset: int, G: array, h: array) None[source]#

Write dense inequality rows into shared buffers.

Row \(i\) encodes \(G_i \Delta q \leq h_i\). Buffers have shape (nworld, m, nv) and (nworld, m); only rows owned by this limit are overwritten.

Parameters:
  • configuration – Current batched configuration.

  • dt – Timestep \(\mathrm{d}t\) in [s].

  • row_offset – First row index for this limit.

  • G – Shared inequality matrix.

  • h – Shared bound vector.

General inequalities#

class mink_warp.LinearInequalityLimit[source]#

Bases: Limit

Constant dense inequality G dq <= h applied to every world.

box_capable: bool = False#

Whether apply_box() is implemented (False for inequality-only limits).

scatter_inequalities(configuration: Configuration, dt: float, row_offset: int, G: array, h: array) None[source]#

Write dense inequality rows into shared buffers.

Row \(i\) encodes \(G_i \Delta q \leq h_i\). Buffers have shape (nworld, m, nv) and (nworld, m); only rows owned by this limit are overwritten.

Parameters:
  • configuration – Current batched configuration.

  • dt – Timestep \(\mathrm{d}t\) in [s].

  • row_offset – First row index for this limit.

  • G – Shared inequality matrix.

  • h – Shared bound vector.