Generic Task API

class XBot::Cartesian::TaskDescription

Base class for task descriptions, which contains properties that are shared among all tasks.

Subclassed by XBot::Cartesian::CartesianTask, XBot::Cartesian::ClientApi::TaskRos, XBot::Cartesian::ConstraintDescription, XBot::Cartesian::MinJointVelTask, XBot::Cartesian::PosturalTask, XBot::Cartesian::Subtask, XBot::Cartesian::TaskDescriptionImpl, XBot::Cartesian::TaskRt

Public Functions

virtual bool validate() = 0

validate performs a consistency check over the task internal data

Returns

true if the test has been passed successfully, false otherwise

virtual const std::string &getName() const = 0

getName returns the task name, i.e. its literal identifier

virtual const std::string &getType() const = 0

getType returns the task type, which is used to find additional modules/plugins implementing addon functionalities

virtual int getSize() const = 0

getSize returns the task size in terms of involved degrees of freedom. The task weight must respect this size, and the task indices must lie in the range [0, .., size - 1]

virtual ActivationState getActivationState() const = 0

getActivationState returns an enum specifiying whether or not the task is active

virtual bool setActivationState(const ActivationState &value) = 0

setActivationState allows to enable/disable a task

virtual const std::string &getLibName() const = 0

getLibName returns the library name where task-related plugins can be found

virtual const Eigen::MatrixXd &getWeight() const = 0

getWeight returns the task weight, i.e. a size x size symmetric, positive definite matrix

virtual bool setWeight(const Eigen::MatrixXd &value) = 0

setWeight allows to set the task weight, i.e. a size x size symmetric, positive definite matrix

virtual const std::vector<int> &getIndices() const = 0

getIndices returns the indices of the active task dofs, ranging from 0 to size - 1

virtual void setIndices(const std::vector<int> &value) = 0

setIndices allows to set the indices of the active task dofs, as a vector of integers ranging from 0 to size - 1, without repetitions

virtual double getLambda() const = 0

getLambda returns a generic feedback gain which is used by implementations to tune error feedback level. The lambda gain should respect 0 <= lam <= 1.

virtual void setLambda(double value) = 0

setLambda allows to set the generic feedback gain which is used by implementations to tune error feedback level. The lambda gain should respect 0 <= lam <= 1.

virtual double getLambda2() const = 0

getLambda2 returns a generic velocity feedback gain which is used by implementations to tune the velocity feedback level. The lambda2 gain should respect 0 <= lam2 <= 1.

virtual bool setLambda2(double value) = 0

setLambda2 allows to set the generic feedback gain which is used by implementations to tune error feedback level. The lambda2 gain should respect 0 <= lam2 <= 1.

virtual const std::vector<std::string> &getDisabledJoints() const = 0

getDisabledJoints returns the list of disabled joints for this task

virtual void setDisabledJoints(const std::vector<std::string> &value) = 0

setDisabledJoints gives a hint to the solver to ignore the given set of joints in the execution of the current task

virtual bool getTaskError(Eigen::VectorXd &e) const

getTaskError returns an implementation-defined metric of task execution error

Parameters

e – is the method output

Returns

true if the functionality is supported

virtual void update(double time, double period) = 0

update is a loop function which is called at each control iteration

Parameters
  • time – is the value of the current controller time

  • period – is the difference between to consecutive time values

virtual void reset() = 0

reset updates the task references so that they match their actual value

virtual void registerObserver(TaskObserver::WeakPtr obs) = 0

registerObserver adds a TaskObserver to the list of observers It keeps a weak pointer to the observer object, such that its lifetime is not extended

virtual void log(MatLogger2::Ptr logger, bool init_logger = false, int buf_size = 1e5) = 0

the log function dumps a log of all relevant task quantities to the provided logger.

Parameters
  • logger

  • init_logger – if true, the user should only pre-allocate the logged variables

  • buf_size – if init_logger is true, this is the buffer size to be pre-allocated

Public Static Functions

template<typename TaskDerivedType>
static bool HasType(ConstPtr task)

HasType is an utility funcion to check if a given task has a given task type.

Friends

friend friend TaskDescription::Ptr operator* (Eigen::Ref< const Eigen::MatrixXd > weight, TaskDescription::Ptr task)

Apply a weight matrix to a task.

Parameters
  • weight – Symmetric positive definite matrix that is applied on the left to the task weight

  • task – Task that we want to modify the weight of

Returns

The same pointer that was provided as input

friend friend TaskDescription::Ptr operator% (std::vector< int > indices, TaskDescription::Ptr task)

Apply a subtask selection to a task. The function also adjusts the task weight matrix.