Struct PositionLimit

Inheritance Relationships

Base Type

Struct Documentation

struct PositionLimit : public roboplan::Constraints

Position limit constraint for inverse kinematics.

Implements joint position constraints by restricting velocities to prevent exceeding joint limits. The constraint is formulated as: l <= G*dq <= u where G is an identity matrix, and the bounds are computed based on the distance to limits.

Public Functions

explicit PositionLimit(const Oink &oink, double gain = 1.0)

Constructor with pre-allocation for optimal performance.

Parameters:
  • oink – The Oink solver this constraint will be used with (provides num_variables and v_indices for selecting the correct joint limits from the full model).

  • gain – Scaling factor for how aggressively to steer away from limits (0 < gain <= 1)

virtual int getNumConstraints(const Scene &scene) const override

Get the number of constraint rows (number_variables)

Parameters:

scene – The scene containing robot state and model

Returns:

Number of constraint rows

virtual tl::expected<void, std::string> computeQpConstraints(const Scene &scene, Eigen::Ref<Eigen::MatrixXd> constraint_matrix, Eigen::Ref<Eigen::VectorXd> lower_bounds, Eigen::Ref<Eigen::VectorXd> upper_bounds) const override

Compute QP constraint matrices for position limits.

Parameters:
  • scene – The scene containing robot state and model

  • constraint_matrix – Output constraint matrix G (number_variables × number_variables)

  • lower_bounds – Output lower bounds vector (number_variables)

  • upper_bounds – Output upper bounds vector (number_variables)

Returns:

void on success, error message on failure

Public Members

double config_limit_gain
int num_variables

Gain parameter for steering away from limits.

Eigen::VectorXi v_indices

Number of group velocity DOFs.

mutable Eigen::VectorXd q_max

Velocity indices of the joint group.

mutable Eigen::VectorXd q_min

Pre-allocated maximum joint position limits.

mutable Eigen::VectorXd delta_q_max

Pre-allocated minimum joint position limits.

mutable Eigen::VectorXd delta_q_min

Pre-allocated workspace for max joint deltas.