Qontrol
Qontrol::Task::GenericTask Class Reference

Represents a generic task. More...

#include <GenericTask.hpp>

Inheritance diagram for Qontrol::Task::GenericTask:

Public Member Functions

 GenericTask (std::string name, int task_dimension, int optim_vector_dimension)
 Construct a new GenericTask object. More...
 
 GenericTask (std::string name, int task_dimension, std::shared_ptr< Model::GenericModel > model_ptr)
 Construct a new Base Task object. More...
 
std::string getName ()
 Get the task name. More...
 
void resize (int input_size, int output_size)
 Resize the \(E\) matrix and \(\boldsymbol{f}\) vector according to the task. More...
 
void setE (Eigen::MatrixXd E)
 Set the \(E\) matrix in \( ||E\boldsymbol{x} - \boldsymbol{f}||^2_{SW}\). More...
 
void setf (Eigen::VectorXd f)
 Set the \(f\) vector in \( ||E\boldsymbol{x} - \boldsymbol{f}||^2_{SW}\). More...
 
virtual void update (double dt)
 Update \(E\) and \(\boldsymbol{f}\). overrided by the considered implementation of the task. More...
 
Eigen::MatrixXd getHessian ()
 Get the hessian matrix related to the task. More...
 
Eigen::VectorXd getGradient ()
 Get the gradient vector. More...
 
void setSelectionMatrix (Eigen::MatrixXd selection_matrix)
 Set the task selection matrix. More...
 
void setWeightingMatrix (Eigen::MatrixXd weighting_matrix)
 Set the task weighting matrix. More...
 
Eigen::MatrixXd getSelectionMatrix ()
 Get the selection matrix. More...
 
Eigen::MatrixXd getWeightingMatrix ()
 Get the weighting matrix. More...
 

Protected Attributes

std::shared_ptr< Model::GenericModelmodel_ptr_
 
std::string name_
 
Eigen::MatrixXd E_
 
Eigen::VectorXd f_
 
Eigen::MatrixXd selection_matrix_
 
Eigen::MatrixXd weighting_matrix_
 
int task_dimension_
 
int optim_vector_dimension_
 

Detailed Description

Represents a generic task.

Let's consider a task using \(m\) degrees of freedom of a robot with \(n\) degrees of freedom. The optimization variable will be called \( \boldsymbol{x} \in \mathbb{R}^n \)

This task is expressed as \( ||E\boldsymbol{x} - \boldsymbol{f}||^2_{SW}\). where \(E \in \mathbb{R}^{m \times n}\) and \(\boldsymbol{f} \in \mathbb{R}^{m}\), \(S \in \mathbb{R}^{m \times m}\) is a selection matrix and \(W \in \mathbb{R}^{m \times m}\) is weighting matrix.

Constructor & Destructor Documentation

◆ GenericTask() [1/2]

Qontrol::Task::GenericTask::GenericTask ( std::string  name,
int  task_dimension,
int  optim_vector_dimension 
)
inline

Construct a new GenericTask object.

This constructor is used when creating a custom task The constructor resizes the problem and sets the selection and weighting matrices to the identity.

Parameters
nameThe name of the task
task_dimensionThe dimension of the task, \(m\)
optim_vector_dimensionThe dimension of the optimization vector, \(n\)

◆ GenericTask() [2/2]

Qontrol::Task::GenericTask::GenericTask ( std::string  name,
int  task_dimension,
std::shared_ptr< Model::GenericModel model_ptr 
)
inline

Construct a new Base Task object.

This constructor is used when creating an implemented task. It uses the model_ptr to automatically update the task. The constructor resizes the problem and set the selection and weighting matrices to the identity.

Parameters
nameThe name of the task
task_dimensionThe dimension of the task, \(m\)
model_ptra pointer toward the robot model

Member Function Documentation

◆ getGradient()

auto Qontrol::Task::GenericTask::getGradient ( )

Get the gradient vector.

The gradient is computed as \( -2.0 E^T S W f \)

Warning
Strictly speaking the weighting matrix \(W\) used is the square root of the one given in setWeightingMatrix()
Returns
Eigen::VectorXd \(\in \mathbb{R}^{m} \)

◆ getHessian()

auto Qontrol::Task::GenericTask::getHessian ( )

Get the hessian matrix related to the task.

The hessian is computed as \( 2.0 E^T S W E^t \)

Warning
Strictly speaking the weighting matrix \(W\) used is the square root of the one given in setWeightingMatrix()
Returns
Eigen::MatrixXd \(\in \mathbb{R}^{n \times n} \)

◆ getName()

auto Qontrol::Task::GenericTask::getName ( )

Get the task name.

Returns
std::string

◆ getSelectionMatrix()

auto Qontrol::Task::GenericTask::getSelectionMatrix ( )

Get the selection matrix.

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

◆ getWeightingMatrix()

auto Qontrol::Task::GenericTask::getWeightingMatrix ( )

Get the weighting matrix.

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

◆ resize()

void Qontrol::Task::GenericTask::resize ( int  input_size,
int  output_size 
)

Resize the \(E\) matrix and \(\boldsymbol{f}\) vector according to the task.

Parameters
input_sizeThe task size, \(m\)
output_sizeThe optimization vector size, \(n\)

◆ setE()

void Qontrol::Task::GenericTask::setE ( Eigen::MatrixXd  E)

Set the \(E\) matrix in \( ||E\boldsymbol{x} - \boldsymbol{f}||^2_{SW}\).

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

◆ setf()

void Qontrol::Task::GenericTask::setf ( Eigen::VectorXd  f)

Set the \(f\) vector in \( ||E\boldsymbol{x} - \boldsymbol{f}||^2_{SW}\).

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

◆ setSelectionMatrix()

void Qontrol::Task::GenericTask::setSelectionMatrix ( Eigen::MatrixXd  selection_matrix)

Set the task selection matrix.

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

◆ setWeightingMatrix()

void Qontrol::Task::GenericTask::setWeightingMatrix ( Eigen::MatrixXd  weighting_matrix)

Set the task weighting matrix.

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

◆ update()

virtual void Qontrol::Task::GenericTask::update ( double  dt)
inlinevirtual

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