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_contact_base_hpp__ |
19 |
|
|
#define __invdyn_contact_base_hpp__ |
20 |
|
|
|
21 |
|
|
#include "tsid/math/fwd.hpp" |
22 |
|
|
#include "tsid/robots/fwd.hpp" |
23 |
|
|
#include "tsid/tasks/task-se3-equality.hpp" |
24 |
|
|
|
25 |
|
|
namespace tsid { |
26 |
|
|
namespace contacts { |
27 |
|
|
|
28 |
|
|
/// |
29 |
|
|
/// \brief Base template of a Contact. |
30 |
|
|
/// |
31 |
|
|
class ContactBase { |
32 |
|
|
public: |
33 |
|
|
EIGEN_MAKE_ALIGNED_OPERATOR_NEW |
34 |
|
|
|
35 |
|
|
typedef math::ConstraintBase ConstraintBase; |
36 |
|
|
typedef math::ConstraintInequality ConstraintInequality; |
37 |
|
|
typedef math::ConstraintEquality ConstraintEquality; |
38 |
|
|
typedef math::ConstRefVector ConstRefVector; |
39 |
|
|
typedef math::Matrix Matrix; |
40 |
|
|
typedef math::Matrix3x Matrix3x; |
41 |
|
|
typedef tasks::TaskSE3Equality TaskSE3Equality; |
42 |
|
|
typedef tasks::TaskMotion TaskMotion; |
43 |
|
|
typedef pinocchio::Data Data; |
44 |
|
|
typedef robots::RobotWrapper RobotWrapper; |
45 |
|
|
|
46 |
|
|
ContactBase(const std::string& name, RobotWrapper& robot); |
47 |
|
|
|
48 |
|
6 |
virtual ~ContactBase() {} |
49 |
|
|
|
50 |
|
|
const std::string& name() const; |
51 |
|
|
|
52 |
|
|
void name(const std::string& name); |
53 |
|
|
|
54 |
|
|
/// Return the number of motion constraints |
55 |
|
|
virtual unsigned int n_motion() const = 0; |
56 |
|
|
|
57 |
|
|
/// Return the number of force variables |
58 |
|
|
virtual unsigned int n_force() const = 0; |
59 |
|
|
|
60 |
|
|
virtual const ConstraintBase& computeMotionTask(const double t, |
61 |
|
|
ConstRefVector q, |
62 |
|
|
ConstRefVector v, |
63 |
|
|
Data& data) = 0; |
64 |
|
|
|
65 |
|
|
virtual const ConstraintInequality& computeForceTask(const double t, |
66 |
|
|
ConstRefVector q, |
67 |
|
|
ConstRefVector v, |
68 |
|
|
const Data& data) = 0; |
69 |
|
|
|
70 |
|
|
virtual const Matrix& getForceGeneratorMatrix() = 0; |
71 |
|
|
|
72 |
|
|
virtual const ConstraintEquality& computeForceRegularizationTask( |
73 |
|
|
const double t, ConstRefVector q, ConstRefVector v, const Data& data) = 0; |
74 |
|
|
|
75 |
|
|
virtual const TaskMotion& getMotionTask() const = 0; |
76 |
|
|
virtual const ConstraintBase& getMotionConstraint() const = 0; |
77 |
|
|
virtual const ConstraintInequality& getForceConstraint() const = 0; |
78 |
|
|
virtual const ConstraintEquality& getForceRegularizationTask() const = 0; |
79 |
|
|
|
80 |
|
|
virtual double getMinNormalForce() const = 0; |
81 |
|
|
virtual double getMaxNormalForce() const = 0; |
82 |
|
|
virtual bool setMinNormalForce(const double minNormalForce) = 0; |
83 |
|
|
virtual bool setMaxNormalForce(const double maxNormalForce) = 0; |
84 |
|
|
virtual double getNormalForce(ConstRefVector f) const = 0; |
85 |
|
|
virtual const Matrix3x& getContactPoints() const = 0; |
86 |
|
|
|
87 |
|
|
protected: |
88 |
|
|
std::string m_name; |
89 |
|
|
/// \brief Reference on the robot model. |
90 |
|
|
RobotWrapper& m_robot; |
91 |
|
|
}; |
92 |
|
|
|
93 |
|
|
} // namespace contacts |
94 |
|
|
} // namespace tsid |
95 |
|
|
|
96 |
|
|
#endif // ifndef __invdyn_contact_base_hpp__ |