Limits#
Base#
- class mink_warp.Limit[source]#
Bases:
ABCAbstract 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)\)
- 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 withlo = max(lo, this_lower).hi – Per-world upper bound on
dq, shape(nworld, nv), updated in place withhi = 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:
LimitBox on
dqkeeping 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 withlo = max(lo, this_lower).hi – Per-world upper bound on
dq, shape(nworld, nv), updated in place withhi = 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:
LimitBox on
dqbounding 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 withlo = max(lo, this_lower).hi – Per-world upper bound on
dq, shape(nworld, nv), updated in place withhi = 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:
LimitNormal-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\) isgain, and \(\varepsilon\) isbound_relaxation. Matches Mink’sCollisionAvoidanceLimit; distances are queried on the host per world, Jacobian rows assembled on device.- 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:
LimitConstant dense inequality
G dq <= happlied to every world.- 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.