ocra-recipes
Doxygen documentation for the ocra-recipes repository
Classes | Public Types | Public Member Functions | Protected Member Functions | List of all members
ocra::Task Class Reference

#include <Task.h>

Inheritance diagram for ocra::Task:
[legend]
Collaboration diagram for ocra::Task:
[legend]

Classes

struct  Pimpl
 

Public Types

enum  META_TASK_TYPE {
  UNKNOWN, POSITION, ORIENTATION, POSE,
  FORCE, COM, COM_MOMENTUM, PARTIAL_POSTURE,
  FULL_POSTURE, PARTIAL_TORQUE, FULL_TORQUE, POINT_CONTACT
}
 
enum  TYPETASK {
  UNKNOWNTASK, ACCELERATIONTASK, TORQUETASK, FORCETASK,
  COMMOMENTUMTASK
}
 

Public Member Functions

 Task (const std::string &name, std::shared_ptr< Model > model, Feature::Ptr feature, Feature::Ptr featureDes)
 
 Task (const std::string &name, std::shared_ptr< Model > model, Feature::Ptr feature)
 
virtual ~Task ()
 
TaskState getTaskState ()
 
TaskState getDesiredTaskState ()
 
void setDesiredTaskState (const TaskState &newDesiredTaskState)
 
void setDesiredTaskStateDirect (const TaskState &newDesiredTaskState)
 
int getHierarchyLevel ()
 
void setHierarchyLevel (int level)
 
void update ()
 
void setMetaTaskType (Task::META_TASK_TYPE newMetaTaskType)
 
Task::META_TASK_TYPE getMetaTaskType ()
 
std::string getMetaTaskTypeAsString ()
 
void setTaskType (Task::TYPETASK newTaskType)
 
Task::TYPETASK getTaskType ()
 
void activateAsObjective ()
 
void activateAsConstraint ()
 
void deactivate ()
 
bool isActiveAsObjective () const
 
bool isActiveAsConstraint () const
 
void setDesiredMassToActualOne ()
 
void setDesiredMass (double Md)
 
void setDesiredMass (const Eigen::VectorXd &Md)
 
void setDesiredMass (const Eigen::MatrixXd &Md)
 
void setDamping (double B)
 
void setDamping (const Eigen::VectorXd &B)
 
void setDamping (const Eigen::MatrixXd &B)
 
void setStiffness (double K)
 
void setStiffness (const Eigen::VectorXd &K)
 
void setStiffness (const Eigen::MatrixXd &K)
 
void setAutoGains (double freq)
 
void setAutoGains (double freq, double massSaturation)
 
bool isDesiredMassTheActualOne () const
 
const Eigen::MatrixXd & getDesiredMass () const
 
const Eigen::MatrixXd & getDesiredMassInverse () const
 
const Eigen::MatrixXd & getDamping () const
 
const Eigen::MatrixXd & getStiffness () const
 
void activateContactMode ()
 
void deactivateContactMode ()
 
bool isContactModeActive () const
 
bool isBodyContactConstraint () const
 
bool isPointContactTask () const
 
double getFrictionCoeff () const
 
double getMargin () const
 
const Eigen::Vector3d & getFrictionConstraintOffset () const
 
void setFrictionCoeff (double coeff)
 
void setMargin (double margin)
 
void setFrictionConstraintOffset (const Eigen::Vector3d &offset)
 
void setWeight (double weight)
 
void setWeight (const Eigen::VectorXd &weight)
 
const Eigen::VectorXd & getWeight () const
 
int getDimension () const
 
const Eigen::VectorXd & getOutput () const
 
const Eigen::VectorXd & getError () const
 
const Eigen::VectorXd & getErrorDot () const
 
const Eigen::VectorXd & getErrorDdot () const
 
const Eigen::VectorXd & getEffort () const
 
const Eigen::MatrixXd & getJacobian () const
 
const Eigen::VectorXd & getComputedForce () const
 
void disconnectFromController ()
 
void connectToController (std::shared_ptr< OneLevelSolver > _solver, const FullDynamicEquationFunction &dynamicEquation, bool useReducedProblem)
 
- Public Member Functions inherited from ocra::NamedInstance
 NamedInstance (const std::string &name)
 
const std::string & getName () const
 
virtual ~NamedInstance ()
 

Protected Member Functions

Feature::Ptr getFeature () const
 
Feature::Ptr getFeatureDes () const
 
void doActivateAsObjective ()
 
void doActivateAsConstraint ()
 
void doActivateContactMode ()
 
void doDeactivateAsObjective ()
 
void doDeactivateAsConstraint ()
 
void doDeactivateContactMode ()
 
void doSetFrictionCoeff ()
 
void doSetMargin ()
 
void doSetWeight ()
 
void doGetOutput (Eigen::VectorXd &output) const
 
void addContactPointInModel ()
 
void removeContactPointInModel ()
 
void updateAccelerationTask ()
 
void updateTorqueTask ()
 
void updateForceTask ()
 
void updateCoMMomentumTask ()
 
void checkIfConnectedToController () const
 

Detailed Description

Definition at line 34 of file Task.h.

Member Enumeration Documentation

Enumerator
UNKNOWN 
POSITION 
ORIENTATION 
POSE 
FORCE 
COM 
COM_MOMENTUM 
PARTIAL_POSTURE 
FULL_POSTURE 
PARTIAL_TORQUE 
FULL_TORQUE 
POINT_CONTACT 

Definition at line 44 of file Task.h.

Enumerator
UNKNOWNTASK 
ACCELERATIONTASK 
TORQUETASK 
FORCETASK 
COMMOMENTUMTASK 

Definition at line 59 of file Task.h.

Constructor & Destructor Documentation

ocra::Task::Task ( const std::string &  name,
std::shared_ptr< Model model,
Feature::Ptr  feature,
Feature::Ptr  featureDes 
)

Definition at line 171 of file Task.cpp.

ocra::Task::Task ( const std::string &  name,
std::shared_ptr< Model model,
Feature::Ptr  feature 
)

Definition at line 177 of file Task.cpp.

ocra::Task::~Task ( )
virtual

Definition at line 183 of file Task.cpp.

Member Function Documentation

void ocra::Task::activateAsConstraint ( )

Definition at line 312 of file Task.cpp.

void ocra::Task::activateAsObjective ( )

Definition at line 298 of file Task.cpp.

void ocra::Task::activateContactMode ( )

Definition at line 476 of file Task.cpp.

void ocra::Task::addContactPointInModel ( )
protected

Definition at line 713 of file Task.cpp.

void ocra::Task::checkIfConnectedToController ( ) const
protected

Definition at line 841 of file Task.cpp.

void ocra::Task::connectToController ( std::shared_ptr< OneLevelSolver _solver,
const FullDynamicEquationFunction dynamicEquation,
bool  useReducedProblem 
)

Definition at line 668 of file Task.cpp.

void ocra::Task::deactivate ( )

Definition at line 326 of file Task.cpp.

void ocra::Task::deactivateContactMode ( )

Definition at line 490 of file Task.cpp.

void ocra::Task::disconnectFromController ( )

Definition at line 644 of file Task.cpp.

void ocra::Task::doActivateAsConstraint ( )
protected

Do activation of task as a constraint.

It means that the task should be full completed and no error may occur. Be aware that stong constraints may lead to system instability (very "sharp" solution that requires lot of energy).

Definition at line 954 of file Task.cpp.

void ocra::Task::doActivateAsObjective ( )
protected

Do activation of task as an objective.

It means that the task is not fully completed and a little error may occur.

Definition at line 916 of file Task.cpp.

void ocra::Task::doActivateContactMode ( )
protected

Do task activation when it is a contact task.

When this function is called, it adds a contact point in the model of contact contained in the Model instance, and it adds in the solver an inequality constraint that represents the limitation of the contact force that must remain inside the cone of friction.

Definition at line 857 of file Task.cpp.

void ocra::Task::doDeactivateAsConstraint ( )
protected

Do deactivation of task as a constraint.

objective is no more considered.

Definition at line 972 of file Task.cpp.

void ocra::Task::doDeactivateAsObjective ( )
protected

Do deactivation of task as an objective.

objective is no more considered.

Definition at line 935 of file Task.cpp.

void ocra::Task::doDeactivateContactMode ( )
protected

Do task deactivation when it is a contact task.

When this function is called, it removes the contact point in the model of contact, and it removes from the solver the friction cone inequality constraint.

Definition at line 874 of file Task.cpp.

void ocra::Task::doGetOutput ( Eigen::VectorXd &  output) const
protected

I don't really know, I suppose it is for a direct output.

Parameters
outputThe vector instance where to write the output.

This output is set to zero.

Definition at line 633 of file Task.cpp.

void ocra::Task::doSetFrictionCoeff ( )
protected

For contact task, do the setting of the coefficient of friction.

The cone of friction constraint is modified to represent a cone with this new coefficient of friction.

Definition at line 890 of file Task.cpp.

void ocra::Task::doSetMargin ( )
protected

For contact task, do the setting of the friction margin.

The cone of friction constraint is modified to represent a friction cone with this new margin.

Definition at line 899 of file Task.cpp.

void ocra::Task::doSetWeight ( )
protected

Do set the weight of the task.

The weight in the objective function is modified.

Definition at line 993 of file Task.cpp.

const Eigen::VectorXd & ocra::Task::getComputedForce ( ) const

Definition at line 639 of file Task.cpp.

const MatrixXd & ocra::Task::getDamping ( ) const

Definition at line 466 of file Task.cpp.

const MatrixXd & ocra::Task::getDesiredMass ( ) const

Definition at line 441 of file Task.cpp.

const MatrixXd & ocra::Task::getDesiredMassInverse ( ) const

Definition at line 453 of file Task.cpp.

TaskState ocra::Task::getDesiredTaskState ( )

Definition at line 1009 of file Task.cpp.

int ocra::Task::getDimension ( ) const

Definition at line 565 of file Task.cpp.

const VectorXd & ocra::Task::getEffort ( ) const

Definition at line 594 of file Task.cpp.

const VectorXd & ocra::Task::getError ( ) const

Definition at line 576 of file Task.cpp.

const VectorXd & ocra::Task::getErrorDdot ( ) const

Definition at line 588 of file Task.cpp.

const VectorXd & ocra::Task::getErrorDot ( ) const

Definition at line 582 of file Task.cpp.

Feature::Ptr ocra::Task::getFeature ( ) const
protected

Definition at line 606 of file Task.cpp.

Feature::Ptr ocra::Task::getFeatureDes ( ) const
protected

Definition at line 611 of file Task.cpp.

double ocra::Task::getFrictionCoeff ( ) const

Definition at line 522 of file Task.cpp.

const Vector3d & ocra::Task::getFrictionConstraintOffset ( ) const

Definition at line 532 of file Task.cpp.

int ocra::Task::getHierarchyLevel ( )

Definition at line 195 of file Task.cpp.

const MatrixXd & ocra::Task::getJacobian ( ) const

Definition at line 600 of file Task.cpp.

double ocra::Task::getMargin ( ) const

Definition at line 527 of file Task.cpp.

Task::META_TASK_TYPE ocra::Task::getMetaTaskType ( )

Definition at line 230 of file Task.cpp.

std::string ocra::Task::getMetaTaskTypeAsString ( )

Definition at line 235 of file Task.cpp.

const VectorXd & ocra::Task::getOutput ( ) const

Definition at line 570 of file Task.cpp.

const MatrixXd & ocra::Task::getStiffness ( ) const

Definition at line 471 of file Task.cpp.

TaskState ocra::Task::getTaskState ( )

Definition at line 1004 of file Task.cpp.

Task::TYPETASK ocra::Task::getTaskType ( )

Definition at line 216 of file Task.cpp.

const VectorXd & ocra::Task::getWeight ( ) const

Definition at line 560 of file Task.cpp.

bool ocra::Task::isActiveAsConstraint ( ) const

Definition at line 348 of file Task.cpp.

bool ocra::Task::isActiveAsObjective ( ) const

Definition at line 343 of file Task.cpp.

bool ocra::Task::isBodyContactConstraint ( ) const

Definition at line 512 of file Task.cpp.

bool ocra::Task::isContactModeActive ( ) const

Definition at line 507 of file Task.cpp.

bool ocra::Task::isDesiredMassTheActualOne ( ) const

Definition at line 436 of file Task.cpp.

bool ocra::Task::isPointContactTask ( ) const

Definition at line 517 of file Task.cpp.

void ocra::Task::removeContactPointInModel ( )
protected

Definition at line 729 of file Task.cpp.

void ocra::Task::setAutoGains ( double  freq)

Definition at line 412 of file Task.cpp.

void ocra::Task::setAutoGains ( double  freq,
double  massSaturation 
)

Definition at line 417 of file Task.cpp.

void ocra::Task::setDamping ( double  B)

Definition at line 378 of file Task.cpp.

void ocra::Task::setDamping ( const Eigen::VectorXd &  B)
void ocra::Task::setDamping ( const Eigen::MatrixXd &  B)
void ocra::Task::setDesiredMass ( double  Md)

Definition at line 358 of file Task.cpp.

void ocra::Task::setDesiredMass ( const Eigen::VectorXd &  Md)
void ocra::Task::setDesiredMass ( const Eigen::MatrixXd &  Md)
void ocra::Task::setDesiredMassToActualOne ( )

Definition at line 353 of file Task.cpp.

void ocra::Task::setDesiredTaskState ( const TaskState newDesiredTaskState)

Definition at line 1014 of file Task.cpp.

void ocra::Task::setDesiredTaskStateDirect ( const TaskState newDesiredTaskState)

Definition at line 1019 of file Task.cpp.

void ocra::Task::setFrictionCoeff ( double  coeff)

Definition at line 537 of file Task.cpp.

void ocra::Task::setFrictionConstraintOffset ( const Eigen::Vector3d &  offset)

Definition at line 555 of file Task.cpp.

void ocra::Task::setHierarchyLevel ( int  level)

Definition at line 199 of file Task.cpp.

void ocra::Task::setMargin ( double  margin)

Definition at line 543 of file Task.cpp.

void ocra::Task::setMetaTaskType ( Task::META_TASK_TYPE  newMetaTaskType)

Definition at line 221 of file Task.cpp.

void ocra::Task::setStiffness ( double  K)

Definition at line 395 of file Task.cpp.

void ocra::Task::setStiffness ( const Eigen::VectorXd &  K)
void ocra::Task::setStiffness ( const Eigen::MatrixXd &  K)
void ocra::Task::setTaskType ( Task::TYPETASK  newTaskType)

Definition at line 187 of file Task.cpp.

void ocra::Task::setWeight ( double  weight)

Definition at line 501 of file Task.cpp.

void ocra::Task::setWeight ( const Eigen::VectorXd &  weight)
void ocra::Task::update ( )

Definition at line 259 of file Task.cpp.

void ocra::Task::updateAccelerationTask ( )
protected

Update linear function of the task for the full formalism.

It computes a desired acceleration $ \vec{a}^{des} = - \left( \vec{a}_{ref} + K_p (\vec{p}^{des} - \vec{p}) + K_d (\vec{v}^{des} - \vec{v}) \right) $ . Then The linear function is set as follows:

  • if it use the reduced problem:

    \begin{align*} \A &= J_{task} . \left( \M^{-1} \J_{\tav}\tp \right) & \b &= \vec{a}^{des} - \left( J_{task} \M^{-1} ( \g - \n) \right) \end{align*}

see sec_transform_formalism for more information.

  • else:

    \begin{align*} \A &= J_{task} & \b &= \vec{a}^{des} \end{align*}

Definition at line 766 of file Task.cpp.

void ocra::Task::updateCoMMomentumTask ( )
protected

Definition at line 817 of file Task.cpp.

void ocra::Task::updateForceTask ( )
protected

Definition at line 807 of file Task.cpp.

void ocra::Task::updateTorqueTask ( )
protected

Definition at line 797 of file Task.cpp.


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