task-base.hpp
Go to the documentation of this file.
1 //
2 // Copyright (c) 2017 CNRS
3 //
4 // This file is part of tsid
5 // tsid is free software: you can redistribute it
6 // and/or modify it under the terms of the GNU Lesser General Public
7 // License as published by the Free Software Foundation, either version
8 // 3 of the License, or (at your option) any later version.
9 // tsid is distributed in the hope that it will be
10 // useful, but WITHOUT ANY WARRANTY; without even the implied warranty
11 // of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 // General Lesser Public License for more details. You should have
13 // received a copy of the GNU Lesser General Public License along with
14 // tsid If not, see
15 // <http://www.gnu.org/licenses/>.
16 //
17 
18 #ifndef __invdyn_task_base_hpp__
19 #define __invdyn_task_base_hpp__
20 
21 #include "tsid/math/fwd.hpp"
22 #include "tsid/robots/fwd.hpp"
24 
25 #include <pinocchio/multibody/fwd.hpp>
26 
27 namespace tsid
28 {
29  namespace tasks
30  {
31 
36  class TaskBase
37  {
38  public:
39  EIGEN_MAKE_ALIGNED_OPERATOR_NEW
40 
45 
46  TaskBase(const std::string & name,
47  RobotWrapper & robot);
48 
49  const std::string & name() const;
50 
51  void name(const std::string & name);
52 
55  virtual int dim() const = 0;
56 
57  virtual const ConstraintBase & compute(const double t,
58  ConstRefVector q,
59  ConstRefVector v,
60  Data & data) = 0;
61 
62  virtual const ConstraintBase & getConstraint() const = 0;
63 
64  protected:
65  std::string m_name;
66 
68  RobotWrapper & m_robot;
69  };
70 
71  }
72 }
73 
74 #endif // ifndef __invdyn_task_base_hpp__
virtual const ConstraintBase & getConstraint() const =0
pinocchio::Data Data
Definition: task-base.hpp:43
Base template of a Task. Each class is defined according to a constant model of a robot...
Definition: task-base.hpp:36
const std::string & name() const
Definition: task-base.cpp:30
virtual int dim() const =0
Return the dimension of the task. should be overloaded in the child class.
RobotWrapper & m_robot
Reference on the robot model.
Definition: task-base.hpp:68
robots::RobotWrapper RobotWrapper
Definition: task-base.hpp:44
virtual const ConstraintBase & compute(const double t, ConstRefVector q, ConstRefVector v, Data &data)=0
TaskBase(const std::string &name, RobotWrapper &robot)
Definition: task-base.cpp:24
math::ConstRefVector ConstRefVector
Definition: task-base.hpp:42
const Eigen::Ref< const Vector > ConstRefVector
Definition: fwd.hpp:50
Wrapper for a robot based on pinocchio.
Definition: robot-wrapper.hpp:40
std::string m_name
Definition: task-base.hpp:65
Definition: constraint-bound.hpp:26
EIGEN_MAKE_ALIGNED_OPERATOR_NEW typedef math::ConstraintBase ConstraintBase
Definition: task-base.hpp:41
Abstract class representing a linear equality/inequality constraint. Equality constraints are represe...
Definition: constraint-base.hpp:36
pinocchio::Data Data
Definition: inverse-dynamics-formulation-acc-force.cpp:29