Qontrol
Qontrol::Constraint::GenericConstraint Class Reference

Represents a generic constraint. More...

#include <GenericConstraint.hpp>

Inheritance diagram for Qontrol::Constraint::GenericConstraint:

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::GenericModelmodel_ptr_
 
int constraint_size_
 
int optimization_vector_size_
 

Detailed Description

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

Constructor & Destructor Documentation

◆ GenericConstraint() [1/2]

Qontrol::Constraint::GenericConstraint::GenericConstraint ( std::string  name,
int  constraint_size,
int  optimization_vector_size 
)
inline

Construct a new GenericConstraint object.

This constructor is used when creating a custom constraint The constructor resizes the constraint matrices and vector

Parameters
nameThe constraint name
constraint_sizeThe dimension of the constraint

◆ GenericConstraint() [2/2]

Qontrol::Constraint::GenericConstraint::GenericConstraint ( std::string  name,
int  constraint_size,
std::shared_ptr< Model::GenericModel model_ptr 
)
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

Parameters
nameThe constraint name
model_ptrA pointer to the model object

Member Function Documentation

◆ getConstraintMatrix()

auto Qontrol::Constraint::GenericConstraint::getConstraintMatrix ( )

Get the constraint matrix \( A \).

Returns
Eigen::VectorXd \( \in \mathbb{R}^{m \times n} \)

◆ getLowerBounds()

auto Qontrol::Constraint::GenericConstraint::getLowerBounds ( )

Get the constraint lower bounds \( \boldsymbol{lb}\).

Returns
Eigen::VectorXd \( \in \mathbb{R}^m \)

◆ getName()

auto Qontrol::Constraint::GenericConstraint::getName ( )

Get the constraint name.

Returns
std::string

◆ getSize()

auto Qontrol::Constraint::GenericConstraint::getSize ( )

Get the constraint size.

Returns
int

◆ getUpperBounds()

auto Qontrol::Constraint::GenericConstraint::getUpperBounds ( )

Get the constraint upper bounds \( \boldsymbol{ub}\).

Returns
Eigen::VectorXd \( \in \mathbb{R}^m \)

◆ resize()

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.

Parameters
task_size
constraint_size

◆ setConstraintMatrix()

void Qontrol::Constraint::GenericConstraint::setConstraintMatrix ( Eigen::MatrixXd  constraint_matrix)

Set the constraint matrix \( A \).

Parameters
lower_bound\( \in \mathbb{R}^{m \times n} \)

◆ setLowerBounds()

void Qontrol::Constraint::GenericConstraint::setLowerBounds ( Eigen::VectorXd  lower_bound)

Set the constraint lower bounds \( \boldsymbol{lb}\).

Parameters
lower_bound\( \in \mathbb{R}^m \)

◆ setUpperBounds()

void Qontrol::Constraint::GenericConstraint::setUpperBounds ( Eigen::VectorXd  upper_bound)

Set the constraint upper bounds \( \boldsymbol{ub}\).

Parameters
upper_bound\( \in \mathbb{R}^m \)

◆ update()


The documentation for this class was generated from the following files: