| Line |
Branch |
Exec |
Source |
| 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" |
| 23 |
|
|
#include "tsid/math/constraint-base.hpp" |
| 24 |
|
|
|
| 25 |
|
|
#include <pinocchio/multibody/fwd.hpp> |
| 26 |
|
|
|
| 27 |
|
|
namespace tsid { |
| 28 |
|
|
namespace tasks { |
| 29 |
|
|
|
| 30 |
|
|
/// |
| 31 |
|
|
/// \brief Base template of a Task. |
| 32 |
|
|
/// Each class is defined according to a constant model of a robot. |
| 33 |
|
|
/// |
| 34 |
|
|
class TaskBase { |
| 35 |
|
|
public: |
| 36 |
|
|
EIGEN_MAKE_ALIGNED_OPERATOR_NEW |
| 37 |
|
|
|
| 38 |
|
|
typedef math::ConstraintBase ConstraintBase; |
| 39 |
|
|
typedef math::ConstRefVector ConstRefVector; |
| 40 |
|
|
typedef pinocchio::Data Data; |
| 41 |
|
|
typedef robots::RobotWrapper RobotWrapper; |
| 42 |
|
|
|
| 43 |
|
|
TaskBase(const std::string& name, RobotWrapper& robot); |
| 44 |
|
|
|
| 45 |
|
32 |
virtual ~TaskBase() = default; |
| 46 |
|
|
|
| 47 |
|
|
const std::string& name() const; |
| 48 |
|
|
|
| 49 |
|
|
void name(const std::string& name); |
| 50 |
|
|
|
| 51 |
|
|
/// \brief Return the dimension of the task. |
| 52 |
|
|
/// \info should be overloaded in the child class. |
| 53 |
|
|
virtual int dim() const = 0; |
| 54 |
|
|
|
| 55 |
|
|
virtual const ConstraintBase& compute(double t, ConstRefVector q, |
| 56 |
|
|
ConstRefVector v, Data& data) = 0; |
| 57 |
|
|
|
| 58 |
|
|
virtual const ConstraintBase& getConstraint() const = 0; |
| 59 |
|
|
|
| 60 |
|
|
protected: |
| 61 |
|
|
std::string m_name; |
| 62 |
|
|
|
| 63 |
|
|
/// \brief Reference on the robot model. |
| 64 |
|
|
RobotWrapper& m_robot; |
| 65 |
|
|
}; |
| 66 |
|
|
|
| 67 |
|
|
} // namespace tasks |
| 68 |
|
|
} // namespace tsid |
| 69 |
|
|
|
| 70 |
|
|
#endif // ifndef __invdyn_task_base_hpp__ |
| 71 |
|
|
|