Limits
Definition
All kinematic limits derive from the Limit
base class.
- class mink.limits.limit.Constraint
Linear inequality constraint of the form \(G(q) \Delta q \leq h(q)\).
Inactive if G and h are None.
- G: ndarray | None
Alias for field number 0
- h: ndarray | None
Alias for field number 1
- property inactive: bool
Returns True if the constraint is inactive.
- class mink.limits.limit.Limit
Abstract base class for kinematic limits.
Subclasses must implement the
compute_qp_inequalities()
method which takes in the current robot configuration and integration time step and returns an instance ofConstraint
.- abstract compute_qp_inequalities(configuration: Configuration, dt: float) Constraint
Compute limit as linearized QP inequalities of the form:
\[G(q) \Delta q \leq h(q)\]where \(q \in {\cal C}\) is the robot’s configuration and \(\Delta q \in T_q({\cal C})\) is the displacement in the tangent space at \(q\).
- Parameters:
configuration (Configuration) – Robot configuration \(q\).
dt (float) – Integration time step in [s].
- Returns:
Pair \((G, h)\).
- Return type:
Configuration limits
Joint position limit.
- class mink.limits.configuration_limit.ConfigurationLimit
Inequality constraint on joint positions in a robot model.
Floating base joints are ignored.
- compute_qp_inequalities(configuration: Configuration, dt: float) Constraint
Compute the configuration-dependent joint position limits.
The limits are defined as:
\[{q \ominus q_{min}} \leq \Delta q \leq {q_{max} \ominus q}\]where \(q \in {\cal C}\) is the robot’s configuration and \(\Delta q \in T_q({\cal C})\) is the displacement in the tangent space at \(q\). See the Derivations section for more information.
- Parameters:
configuration (Configuration) – Robot configuration \(q\).
dt (float) – Integration timestep in [s].
- Returns:
Pair \((G, h)\) representing the inequality constraint as \(G \Delta q \leq h\), or
None
if there is no limit.- Return type:
Velocity limits
Joint velocity limit.
- class mink.limits.velocity_limit.VelocityLimit
Inequality constraint on joint velocities in a robot model.
Floating base joints are ignored.
- indices
Tangent indices corresponding to velocity-limited joints. Shape (nb,).
- Type:
numpy.ndarray
- limit
Maximum allowed velocity magnitude for velocity-limited joints, in [m]/[s] for slide joints and [rad]/[s] for hinge joints. Shape (nb,).
- Type:
numpy.ndarray
- projection_matrix
Projection from tangent space to subspace with velocity-limited joints. Shape (nb, nv) where nb is the dimension of the velocity-limited subspace and nv is the dimension of the tangent space.
- Type:
numpy.ndarray
- compute_qp_inequalities(configuration: Configuration, dt: float) Constraint
Compute the configuration-dependent joint velocity limits.
The limits are defined as:
\[-v_{\text{max}} \cdot dt \leq \Delta q \leq v_{\text{max}} \cdot dt\]where \(v_{max} \in {\cal T}\) is the robot’s velocity limit vector and \(\Delta q \in T_q({\cal C})\) is the displacement in the tangent space at \(q\). See the Derivations section for more information.
- Parameters:
configuration (Configuration) – Robot configuration \(q\).
dt (float) – Integration timestep in [s].
- Returns:
Pair \((G, h)\) representing the inequality constraint as \(G \Delta q \leq h\), or
None
if there is no limit. G has shape (2nb, nv) and h has shape (2nb,).- Return type:
Collision avoidance limits
Collision avoidance limit.
- class mink.limits.collision_avoidance_limit.Contact
Struct to store contact information between two geoms.
- dist
Smallest signed distance between geom1 and geom2. If no collision of distance smaller than distmax is found, this value is equal to distmax [1].
- Type:
float
- fromto
Segment connecting the closest points on geom1 and geom2. The first three elements are the coordinates of the closest point on geom1, and the last three elements are the coordinates of the closest point on geom2.
- Type:
numpy.ndarray
- geom1
ID of geom1.
- Type:
int
- geom2
ID of geom2.
- Type:
int
- distmax
Maximum distance between geom1 and geom2.
- Type:
float
References
- [1] MuJoCo API documentation. mj_geomDistance function.
https://mujoco.readthedocs.io/en/latest/APIreference/APIfunctions.html
- property normal: ndarray
Contact normal pointing from geom1 to geom2.
- property inactive: bool
Returns True if no distance smaller than distmax is detected between geom1 and geom2.
- class mink.limits.collision_avoidance_limit.CollisionAvoidanceLimit
Normal velocity limit between geom pairs.
- model
MuJoCo model.
- geom_pairs
Set of collision pairs in which to perform active collision avoidance. A collision pair is defined as a pair of geom groups. A geom group is a set of geom names. For each geom pair, the solver will attempt to compute joint velocities that avoid collisions between every geom in the first geom group with every geom in the second geom group. Self collision is achieved by adding a collision pair with the same geom group in both pair fields.
- gain
Gain factor in (0, 1] that determines how fast the geoms are allowed to move towards each other at each iteration. Smaller values are safer but may make the geoms move slower towards each other.
- minimum_distance_from_collisions
The minimum distance to leave between any two geoms. A negative distance allows the geoms to penetrate by the specified amount.
- collision_detection_distance
The distance between two geoms at which the active collision avoidance limit will be active. A large value will cause collisions to be detected early, but may incur high computational cost. A negative value will cause the geoms to be detected only after they penetrate by the specified amount.
- bound_relaxation
An offset on the upper bound of each collision avoidance constraint.
- compute_qp_inequalities(configuration: Configuration, dt: float) Constraint
Compute limit as linearized QP inequalities of the form:
\[G(q) \Delta q \leq h(q)\]where \(q \in {\cal C}\) is the robot’s configuration and \(\Delta q \in T_q({\cal C})\) is the displacement in the tangent space at \(q\).
- Parameters:
configuration (Configuration) – Robot configuration \(q\).
dt (float) – Integration time step in [s].
- Returns:
Pair \((G, h)\).
- Return type: