Qontrol
|
Represents a generic task. More...
#include <GenericTask.hpp>
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::GenericModel > | model_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_ |
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.
|
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.
name | The name of the task |
task_dimension | The dimension of the task, \(m\) |
optim_vector_dimension | The dimension of the optimization vector, \(n\) |
|
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.
name | The name of the task |
task_dimension | The dimension of the task, \(m\) |
model_ptr | a pointer toward the robot model |
auto Qontrol::Task::GenericTask::getGradient | ( | ) |
Get the gradient vector.
The gradient is computed as \( -2.0 E^T S W f \)
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 \)
auto Qontrol::Task::GenericTask::getName | ( | ) |
Get the task name.
auto Qontrol::Task::GenericTask::getSelectionMatrix | ( | ) |
Get the selection matrix.
auto Qontrol::Task::GenericTask::getWeightingMatrix | ( | ) |
Get the weighting matrix.
void Qontrol::Task::GenericTask::resize | ( | int | input_size, |
int | output_size | ||
) |
Resize the \(E\) matrix and \(\boldsymbol{f}\) vector according to the task.
input_size | The task size, \(m\) |
output_size | The optimization vector size, \(n\) |
void Qontrol::Task::GenericTask::setE | ( | Eigen::MatrixXd | E | ) |
Set the \(E\) matrix in \( ||E\boldsymbol{x} - \boldsymbol{f}||^2_{SW}\).
E | \(\in \mathbb{R}^{m \times n} \) |
void Qontrol::Task::GenericTask::setf | ( | Eigen::VectorXd | f | ) |
Set the \(f\) vector in \( ||E\boldsymbol{x} - \boldsymbol{f}||^2_{SW}\).
f | \(\in \mathbb{R}^{m} \) |
void Qontrol::Task::GenericTask::setSelectionMatrix | ( | Eigen::MatrixXd | selection_matrix | ) |
Set the task selection matrix.
selection_matrix | \(\in \mathbb{R}^{m \times m} \) |
void Qontrol::Task::GenericTask::setWeightingMatrix | ( | Eigen::MatrixXd | weighting_matrix | ) |
Set the task weighting matrix.
weighting_matrix | \(\in \mathbb{R}^{m \times m} \) |
|
inlinevirtual |
Update \(E\) and \(\boldsymbol{f}\). overrided by the considered implementation of the task.
Reimplemented in Qontrol::Task::CartesianAcceleration< Qontrol::ControlOutput::JointTorque >, Qontrol::Task::CartesianVelocity< Qontrol::ControlOutput::JointVelocity >, Qontrol::Task::JointTorque< Qontrol::ControlOutput::JointTorque >, and Qontrol::Task::JointVelocity< Qontrol::ControlOutput::JointVelocity >.