Represents a generic task. More...
#include <mc_tasks/MetaTask.h>
Public Types | |
using | Backend = mc_solver::QPSolver::Backend |
Public Member Functions | |
MetaTask () | |
virtual | ~MetaTask () |
const std::string & | type () const |
virtual void | name (const std::string &name) |
const std::string & | name () const |
virtual void | reset ()=0 |
Reset the task. More... | |
virtual void | dimWeight (const Eigen::VectorXd &dimW)=0 |
Set the task's dimension weight vector. More... | |
virtual Eigen::VectorXd | dimWeight () const =0 |
Get the current task's dim weight vector. More... | |
virtual void | selectActiveJoints (mc_solver::QPSolver &solver, const std::vector< std::string > &activeJointsName, const std::map< std::string, std::vector< std::array< int, 2 >>> &activeDofs={})=0 |
Setup an active joints selector. More... | |
virtual void | selectUnactiveJoints (mc_solver::QPSolver &solver, const std::vector< std::string > &unactiveJointsName, const std::map< std::string, std::vector< std::array< int, 2 >>> &unactiveDofs={})=0 |
Setup an unactive joints selector. More... | |
virtual void | resetJointsSelector (mc_solver::QPSolver &solver)=0 |
Reset active joints selection. More... | |
virtual Eigen::VectorXd | eval () const =0 |
Returns the task error. More... | |
virtual Eigen::VectorXd | speed () const =0 |
Returns the task velocity. More... | |
virtual void | load (mc_solver::QPSolver &solver, const mc_rtc::Configuration &config) |
Load parameters from a Configuration object. More... | |
size_t | iterInSolver () const noexcept |
Get the number of iterations since the task was added to the solver. More... | |
void | resetIterInSolver () noexcept |
Set the number of iterations since the task was added to the solver to zero. More... | |
void | incrementIterInSolver () noexcept |
Increment the number of iterations since the task was added to the solver. More... | |
Backend | backend () const noexcept |
Protected Member Functions | |
virtual void | addToSolver (mc_solver::QPSolver &solver)=0 |
Add the task to a solver. More... | |
virtual void | removeFromSolver (mc_solver::QPSolver &solver)=0 |
Remove the task from a solver. More... | |
virtual void | update (mc_solver::QPSolver &solver)=0 |
Update the task. More... | |
virtual void | addToLogger (mc_rtc::Logger &) |
virtual void | removeFromLogger (mc_rtc::Logger &) |
virtual void | addToGUI (mc_rtc::gui::StateBuilder &) |
virtual void | removeFromGUI (mc_rtc::gui::StateBuilder &) |
virtual std::function< bool(const mc_tasks::MetaTask &task, std::string &)> | buildCompletionCriteria (double dt, const mc_rtc::Configuration &config) const |
Static Protected Member Functions | |
static void | addToSolver (MetaTask &t, mc_solver::QPSolver &solver) |
static void | removeFromSolver (MetaTask &t, mc_solver::QPSolver &solver) |
static void | update (MetaTask &t, mc_solver::QPSolver &solver) |
static void | addToLogger (MetaTask &t, mc_rtc::Logger &logger) |
static void | removeFromLogger (MetaTask &t, mc_rtc::Logger &logger) |
static void | addToGUI (MetaTask &t, mc_rtc::gui::StateBuilder &gui) |
static void | removeFromGUI (MetaTask &t, mc_rtc::gui::StateBuilder &gui) |
static void | ensureHasJoints (const mc_rbdyn::Robot &robot, const std::vector< std::string > &joints, const std::string &prefix) |
Protected Attributes | |
Backend | backend_ |
std::string | type_ |
std::string | name_ |
size_t | iterInSolver_ = 0 |
Friends | |
struct | mc_solver::QPSolver |
struct | mc_solver::TasksQPSolver |
struct | mc_solver::TVMQPSolver |
struct | mc_control::CompletionCriteria |
Represents a generic task.
A meta task may be composed of several tasks that work together to achieve a given goal
Shortcut for implementation
|
inline |
|
virtual |
|
protectedvirtual |
Add elements to the GUI through the helper
This will be called by the solver when the task is added.
The default implementation adds the type of the task under the {"Tasks", name_} category.
Reimplemented in mc_tasks::SplineTrajectoryTask< Derived >, mc_tasks::SplineTrajectoryTask< ExactCubicTrajectoryTask >, mc_tasks::SplineTrajectoryTask< BSplineTrajectoryTask >, mc_tasks::force::ImpedanceTask, mc_tasks::TransformTask, mc_tasks::force::AdmittanceTask, mc_tasks::force::CoPTask, mc_tasks::EndEffectorTask, mc_tasks::PositionTask, mc_tasks::ExactCubicTrajectoryTask, mc_tasks::VectorOrientationTask, mc_tasks::OrientationTask, mc_tasks::RelativeEndEffectorTask, mc_tasks::MomentumTask, mc_tasks::BSplineTrajectoryTask, mc_tasks::lipm_stabilizer::StabilizerTask, mc_tasks::TrajectoryTaskGeneric, mc_tasks::PostureTask, and mc_tasks::CoMTask.
|
inlinestaticprotected |
|
inlineprotectedvirtual |
Add entries to the logger
This will be called by the solver if it holds a valid logger instance when the task is added.
The default implementation adds nothing to the log.
Reimplemented in mc_tasks::SplineTrajectoryTask< Derived >, mc_tasks::SplineTrajectoryTask< ExactCubicTrajectoryTask >, mc_tasks::SplineTrajectoryTask< BSplineTrajectoryTask >, mc_tasks::TrajectoryTaskGeneric, mc_tasks::force::ImpedanceTask, mc_tasks::force::AdmittanceTask, mc_tasks::force::CoPTask, mc_tasks::PostureTask, mc_tasks::TransformTask, mc_tasks::EndEffectorTask, mc_tasks::PositionTask, mc_tasks::VectorOrientationTask, mc_tasks::PositionBasedVisServoTask, mc_tasks::OrientationTask, mc_tasks::CoMTask, mc_tasks::MomentumTask, and mc_tasks::lipm_stabilizer::StabilizerTask.
|
inlinestaticprotected |
|
protectedpure virtual |
Add the task to a solver.
solver | Solver where to add the task |
Implemented in mc_tasks::lipm_stabilizer::StabilizerTask, mc_tasks::TrajectoryTaskGeneric, mc_tasks::force::ImpedanceTask, mc_tasks::force::AdmittanceTask, mc_tasks::PostureTask, and mc_tasks::EndEffectorTask.
|
inlinestaticprotected |
|
inlinenoexcept |
|
protectedvirtual |
Add additional completion criterias to mc_control::CompletionCriteria object
Based on the input data, this should return a function that operates on the task and return true and complete the output if the criteria has been reached. In this function parameter, the output string should be completed by the function and not overwritten. The task passed to this function is always of the MetaTask type you're implementing and thus can be safely casted.
The default implementation is a function that returns true whatever happens.
dt | Timestep of the completion criteria |
config | Configuration for the CompletionCriteria |
Reimplemented in mc_tasks::TrajectoryTaskGeneric, mc_tasks::TransformTask, mc_tasks::force::CoPTask, mc_tasks::SplineTrajectoryTask< Derived >, mc_tasks::SplineTrajectoryTask< ExactCubicTrajectoryTask >, and mc_tasks::SplineTrajectoryTask< BSplineTrajectoryTask >.
|
pure virtual |
Get the current task's dim weight vector.
Implemented in mc_tasks::TrajectoryTaskGeneric, mc_tasks::force::ComplianceTask, mc_tasks::SplineTrajectoryTask< Derived >, mc_tasks::AddRemoveContactTask, mc_tasks::EndEffectorTask, and mc_tasks::PostureTask.
|
pure virtual |
Set the task's dimension weight vector.
It is the caller responsibility to ensure the dimensionality fits the underlying tasks' error function
dimW | The new tasks's dimension weight vector |
Implemented in mc_tasks::TrajectoryTaskGeneric, mc_tasks::force::ComplianceTask, mc_tasks::AddRemoveContactTask, mc_tasks::SplineTrajectoryTask< Derived >, mc_tasks::SplineTrajectoryTask< ExactCubicTrajectoryTask >, mc_tasks::SplineTrajectoryTask< BSplineTrajectoryTask >, mc_tasks::EndEffectorTask, and mc_tasks::PostureTask.
|
inlinestaticprotected |
|
pure virtual |
Returns the task error.
The vector's dimensions depend on the underlying task
Implemented in mc_tasks::SplineTrajectoryTask< Derived >, mc_tasks::TrajectoryTaskGeneric, mc_tasks::force::ComplianceTask, mc_tasks::lipm_stabilizer::StabilizerTask, mc_tasks::AddRemoveContactTask, mc_tasks::EndEffectorTask, and mc_tasks::PostureTask.
|
inlinenoexcept |
Increment the number of iterations since the task was added to the solver.
|
inlinenoexcept |
Get the number of iterations since the task was added to the solver.
|
virtual |
Load parameters from a Configuration object.
Reimplemented in mc_tasks::TrajectoryTaskGeneric, mc_tasks::TransformTask, mc_tasks::force::AdmittanceTask, mc_tasks::force::ImpedanceTask, mc_tasks::force::CoPTask, mc_tasks::EndEffectorTask, mc_tasks::VectorOrientationTask, mc_tasks::LookAtTask, mc_tasks::LookAtFrameTask, mc_tasks::SplineTrajectoryTask< Derived >, mc_tasks::SplineTrajectoryTask< ExactCubicTrajectoryTask >, mc_tasks::SplineTrajectoryTask< BSplineTrajectoryTask >, mc_tasks::MomentumTask, mc_tasks::PostureTask, mc_tasks::lipm_stabilizer::StabilizerTask, and mc_tasks::CoMTask.
|
inline |
Get the name of the task
|
inlinevirtual |
Set a name for the task
This name will be used to identify the task in logs, GUI...
The name should be set before being added to the solver.
Reimplemented in mc_tasks::lipm_stabilizer::StabilizerTask, and mc_tasks::EndEffectorTask.
|
protectedvirtual |
Remove elements from the GUI through the helper
This will be called by the solver when the task is removed.
The default implementation removes the {"Tasks", name_} category.
Reimplemented in mc_tasks::lipm_stabilizer::StabilizerTask.
|
inlinestaticprotected |
|
protectedvirtual |
Remove entries from the logger
This will be called by the solver when the task is removed.
The default implementation removes everything registered with the MetaTask instance as a source, it is likely good enough
Reimplemented in mc_tasks::EndEffectorTask, and mc_tasks::lipm_stabilizer::StabilizerTask.
|
inlinestaticprotected |
|
protectedpure virtual |
Remove the task from a solver.
solver | Solver from which to remove the task |
Implemented in mc_tasks::lipm_stabilizer::StabilizerTask, mc_tasks::TrajectoryTaskGeneric, mc_tasks::PostureTask, and mc_tasks::EndEffectorTask.
|
inlinestaticprotected |
|
pure virtual |
Reset the task.
Implemented in mc_tasks::lipm_stabilizer::StabilizerTask, mc_tasks::force::ComplianceTask, mc_tasks::force::ImpedanceTask, mc_tasks::GazeTask, mc_tasks::force::CoPTask, mc_tasks::force::AdmittanceTask, mc_tasks::PositionBasedVisServoTask, mc_tasks::TrajectoryTaskGeneric, mc_tasks::VectorOrientationTask, mc_tasks::LookAtTask, mc_tasks::RelativeEndEffectorTask, mc_tasks::TransformTask, mc_tasks::EndEffectorTask, mc_tasks::PositionTask, mc_tasks::OrientationTask, mc_tasks::MomentumTask, mc_tasks::CoMTask, and mc_tasks::PostureTask.
|
inlinenoexcept |
Set the number of iterations since the task was added to the solver to zero.
|
pure virtual |
Reset active joints selection.
solver | Solver where the task is involved |
Implemented in mc_tasks::TrajectoryTaskGeneric, mc_tasks::force::ComplianceTask, mc_tasks::EndEffectorTask, and mc_tasks::PostureTask.
|
pure virtual |
Setup an active joints selector.
This function setups a tasks::qp;:JointsSelector for the task. Only the provided joints will be used to solve the task.
solver | Solver where the task is involved |
activeJointsName | Active joints in the task |
activeDofs | Allow to select only part of the dofs of a joint |
Implemented in mc_tasks::TrajectoryTaskGeneric, mc_tasks::force::ComplianceTask, mc_tasks::EndEffectorTask, and mc_tasks::PostureTask.
|
pure virtual |
Setup an unactive joints selector.
This function setups a tasks::qp;:JointsSelector for the task. All joints will be used to realize the task except those provided here.
solver | Solver where the task is involved |
unactiveJointsName | Active joints in the task |
unactiveDofs | Allow to select only part of the dofs of a joint |
Implemented in mc_tasks::TrajectoryTaskGeneric, mc_tasks::force::ComplianceTask, mc_tasks::EndEffectorTask, and mc_tasks::PostureTask.
|
pure virtual |
Returns the task velocity.
The vector's dimensions depend on the underlying task
Implemented in mc_tasks::TrajectoryTaskGeneric, mc_tasks::force::ComplianceTask, mc_tasks::lipm_stabilizer::StabilizerTask, mc_tasks::AddRemoveContactTask, mc_tasks::EndEffectorTask, and mc_tasks::PostureTask.
|
inline |
Get the type of the task
|
protectedpure virtual |
Update the task.
This function (usually) has to be called at every iteration of the solver once it has been added. It should update the state of the task.
solver | Solver in which the task is inserted |
Implemented in mc_tasks::force::ImpedanceTask, mc_tasks::force::FirstOrderImpedanceTask, mc_tasks::lipm_stabilizer::StabilizerTask, mc_tasks::SplineTrajectoryTask< Derived >, mc_tasks::SplineTrajectoryTask< ExactCubicTrajectoryTask >, mc_tasks::SplineTrajectoryTask< BSplineTrajectoryTask >, mc_tasks::TrajectoryTaskGeneric, mc_tasks::force::AdmittanceTask, mc_tasks::PostureTask, mc_tasks::EndEffectorTask, mc_tasks::force::DampingTask, mc_tasks::LookAtTFTask, and mc_tasks::LookAtFrameTask.
|
inlinestaticprotected |
|
friend |
|
friend |
|
friend |
|
friend |
|
protected |
QPSolver backend at creation time
|
protected |
|
protected |
|
protected |