Limits

Limits implemented as inequality constraints in the IK problem.

Kinematic limits derive from the Limit base class. They compute QP inequality constraints 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\).

class pink.limits.AccelerationLimit(model, acceleration_limit)

Subset of acceleration-limited joints in a robot model.

Acceleration limits consists of two parts: the expected \(|a| \leq a_{\mathrm{max}}\), but also the following term accounting for the “breaking distance” to configuration limits. This additional inequality is detailed in [Flacco2015] as well as in [DelPrete2018].

Delta_q_prev

Latest displacement of the robot.

a_max

Maximum acceleration vector for acceleration-limited joints.

indices

Tangent indices corresponding to acceleration-limited joints.

model

Robot model.

projection_matrix

Projection from tangent space to subspace with acceleration-limited joints.

compute_qp_inequalities(q, dt)

Compute inequalities for acceleration limits.

Those limits are defined by two constraints. First, the finite-difference approximation of the acceleration is bounded by the robot’s acceleration-limit vector \(a_{\mathrm{max}} \in {\cal T}_q({\cal C})\) (which belongs to the tangent space at the current configuration \(q \in \mathcal{C}\)):

\[- a_{\mathrm{max}} \leq \frac{\frac{\Delta q}{\mathrm{d} t} - \frac{\Delta q_{\mathrm{prev}}}{\mathrm{d} t}}{\mathrm{d} t} \leq a_{\mathrm{max}}\]

where \(\Delta q \in T_q({\cal C})\) is the displacement computed by the inverse kinematics, and \(\Delta q_{\mathrm{prev}}\) is the displacement from our previous iteration of differential IK.

Second, our new velocity \(\Delta q / \mathrm{d} t\) should not exceed the “braking distance” until configuration limits:

\[-\sqrt{2 a_{\mathrm{max}} (q \ominus q_{\min})} \leq \frac{\Delta q}{\mathrm{d} t} \leq \sqrt{2 a_{\mathrm{max}} (q_{\max} \ominus q)}\]

This additional inequality is detailed in [Flacco2015] as well as in [DelPrete2018].

Parameters:
  • q (ndarray) – Robot configuration.

  • dt (float) – Integration timestep in [s].

Return type:

Optional[Tuple[ndarray, ndarray]]

Returns:

Pair \((G, h)\) representing the inequality constraint as \(G \Delta q \leq h\), or None if there is no limit.

set_last_integration(v_prev, dt)

Set the latest velocity and the duration it was applied for.

The goal of the low-acceleration task is to minimize the difference between the new velocity and the previous one.

Parameters:
  • v_prev (ndarray) – Latest integrated velocity.

  • dt – Integration timestep in [s].

Return type:

None

class pink.limits.ConfigurationLimit(model, config_limit_gain=0.5)

Subspace of the tangent space restricted to joints with position limits.

config_limit_gain

gain between 0 and 1 to steer away from configuration limits. It is described in “Real-time prioritized kinematic control under inequality constraints for redundant manipulators” (Kanoun, 2012). More details in this writeup.

model

Robot model the limit applies to.

joints

Joints with configuration limits.

projection_matrix

Projection from tangent space to subspace with configuration-limited joints.

compute_qp_inequalities(q, dt)

Compute the configuration-dependent velocity limits.

Those limits are returned 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\). These limits correspond to the derivative of \(q_{min} \leq q \leq q_{max}\).

Parameters:
  • q (ndarray) – Robot configuration.

  • dt (float) – Integration timestep in [s].

Return type:

Optional[Tuple[ndarray, ndarray]]

Returns:

Pair \((G, h)\) representing the inequality constraint as \(G \Delta q \leq h\), or None if there is no limit.

class pink.limits.Limit

Abstract base class for kinematic limits.

abstractmethod compute_qp_inequalities(q, dt)

Compute limit as linearized QP inequalities.

Those limits are returned as:

\[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:
  • q (ndarray) – Robot configuration.

  • dt (float) – Integration timestep in [s].

Return type:

Optional[Tuple[ndarray, ndarray]]

Returns:

Pair \((G, h)\) representing the inequality constraint as \(G \Delta q \leq h\), or None if there is no limit.

class pink.limits.VelocityLimit(model)

Subset of velocity-limited joints in a robot model.

indices

Tangent indices corresponding to velocity-limited joints.

joints

List of velocity-limited joints.

model

Robot model.

projection_matrix

Projection from tangent space to subspace with velocity-limited joints.

compute_qp_inequalities(q, dt)

Compute inequalities for velocity limits.

Those limits are defined by:

\[-\mathrm{d}t v_{max} \leq \Delta q \leq \mathrm{d}t v_{max}\]

where \(v_{max} \in {\cal T}\) is the robot’s velocity limit vector and \(\Delta q \in T_q({\cal C})\) is the displacement computed by the inverse kinematics.

Parameters:
  • q (ndarray) – Robot configuration.

  • dt (float) – Integration timestep in [s].

Return type:

Optional[Tuple[ndarray, ndarray]]

Returns:

Pair \((G, h)\) representing the inequality constraint as \(G \Delta q \leq h\), or None if there is no limit.