Qontrol
|
Represents a generic constraint. More...
#include <GenericConstraint.hpp>
Public Member Functions | |
GenericConstraint (std::string name, int constraint_size, int optimization_vector_size) | |
Construct a new GenericConstraint object. More... | |
GenericConstraint (std::string name, int constraint_size, std::shared_ptr< Model::GenericModel > model_ptr) | |
Construct a new Base onstraint object. More... | |
virtual void | update (double dt) |
Update \(A\), \(\boldsymbol{lb}\) and \(\boldsymbol{ub}\) overrided by the considered implementation of the constraint. More... | |
int | getSize () |
Get the constraint size. More... | |
std::string | getName () |
Get the constraint name. More... | |
void | setConstraintMatrix (Eigen::MatrixXd constraint_matrix) |
Set the constraint matrix \( A \). More... | |
void | setUpperBounds (Eigen::VectorXd upper_bound) |
Set the constraint upper bounds \( \boldsymbol{ub}\). More... | |
void | setLowerBounds (Eigen::VectorXd lower_bound) |
Set the constraint lower bounds \( \boldsymbol{lb}\). More... | |
void | resize (int task_size, int constraint_size) |
Resize the constraint matrices and vectors according to the task size and new constraint size. More... | |
Eigen::MatrixXd | getConstraintMatrix () |
Get the constraint matrix \( A \). More... | |
Eigen::VectorXd | getUpperBounds () |
Get the constraint upper bounds \( \boldsymbol{ub}\). More... | |
Eigen::VectorXd | getLowerBounds () |
Get the constraint lower bounds \( \boldsymbol{lb}\). More... | |
Public Attributes | |
Eigen::VectorXd | lower_limit |
Eigen::VectorXd | upper_limit |
Protected Attributes | |
std::shared_ptr< Model::GenericModel > | model_ptr_ |
int | constraint_size_ |
int | optimization_vector_size_ |
Represents a generic constraint.
In a qp problem a constraint is expressed as an inequality linerarly dependent to the optimization vector. Let's consider a constraint constraining \(m\) degrees of freedom of a robot with \(n\) degrees of freedom. The optimization variable will be called \( \boldsymbol{x} \in \mathbb{R}^n \)
The constraint is expressed as \( \boldsymbol{lb} \leq A \boldsymbol{x} \leq \boldsymbol{ub}\). \( \boldsymbol{lb} \in \mathbb{R}^m \) and \( \boldsymbol{ub} \in \mathbb{R}^m \) are respecitvely the lower bound and the upper bound of the constraint. \( A \in \mathbb{R}^{m\times n} \) is the constraint matrix
|
inline |
Construct a new GenericConstraint object.
This constructor is used when creating a custom constraint The constructor resizes the constraint matrices and vector
name | The constraint name |
constraint_size | The dimension of the constraint |
|
inline |
Construct a new Base onstraint object.
This constructor is used when creating an implemented constraint. It uses the model_ptr to automatically update the constraint. The constructor resizes the constraint matrices and vector
name | The constraint name |
model_ptr | A pointer to the model object |
auto Qontrol::Constraint::GenericConstraint::getConstraintMatrix | ( | ) |
Get the constraint matrix \( A \).
auto Qontrol::Constraint::GenericConstraint::getLowerBounds | ( | ) |
Get the constraint lower bounds \( \boldsymbol{lb}\).
auto Qontrol::Constraint::GenericConstraint::getName | ( | ) |
Get the constraint name.
auto Qontrol::Constraint::GenericConstraint::getSize | ( | ) |
Get the constraint size.
auto Qontrol::Constraint::GenericConstraint::getUpperBounds | ( | ) |
Get the constraint upper bounds \( \boldsymbol{ub}\).
void Qontrol::Constraint::GenericConstraint::resize | ( | int | task_size, |
int | constraint_size | ||
) |
Resize the constraint matrices and vectors according to the task size and new constraint size.
task_size | |
constraint_size |
void Qontrol::Constraint::GenericConstraint::setConstraintMatrix | ( | Eigen::MatrixXd | constraint_matrix | ) |
Set the constraint matrix \( A \).
lower_bound | \( \in \mathbb{R}^{m \times n} \) |
void Qontrol::Constraint::GenericConstraint::setLowerBounds | ( | Eigen::VectorXd | lower_bound | ) |
Set the constraint lower bounds \( \boldsymbol{lb}\).
lower_bound | \( \in \mathbb{R}^m \) |
void Qontrol::Constraint::GenericConstraint::setUpperBounds | ( | Eigen::VectorXd | upper_bound | ) |
Set the constraint upper bounds \( \boldsymbol{ub}\).
upper_bound | \( \in \mathbb{R}^m \) |
|
inlinevirtual |
Update \(A\), \(\boldsymbol{lb}\) and \(\boldsymbol{ub}\) overrided by the considered implementation of the constraint.
Reimplemented in Qontrol::Constraint::JointConfiguration< Qontrol::ControlOutput::JointTorque >, Qontrol::Constraint::JointVelocity< Qontrol::ControlOutput::JointTorque >, Qontrol::Constraint::JointConfiguration< Qontrol::ControlOutput::JointVelocity >, Qontrol::Constraint::JointVelocity< Qontrol::ControlOutput::JointVelocity >, and Qontrol::Constraint::JointTorque< Qontrol::ControlOutput::JointTorque >.