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_am_equality_hpp__ |
19 |
|
|
#define __invdyn_task_am_equality_hpp__ |
20 |
|
|
|
21 |
|
|
#include "tsid/math/fwd.hpp" |
22 |
|
|
#include "tsid/tasks/task-motion.hpp" |
23 |
|
|
#include "tsid/trajectories/trajectory-base.hpp" |
24 |
|
|
#include "tsid/math/constraint-equality.hpp" |
25 |
|
|
|
26 |
|
|
#include <pinocchio/multibody/model.hpp> |
27 |
|
|
#include <pinocchio/multibody/data.hpp> |
28 |
|
|
|
29 |
|
|
namespace tsid { |
30 |
|
|
namespace tasks { |
31 |
|
|
|
32 |
|
|
class TaskAMEquality : public TaskMotion { |
33 |
|
|
public: |
34 |
|
|
EIGEN_MAKE_ALIGNED_OPERATOR_NEW |
35 |
|
|
|
36 |
|
|
typedef math::Index Index; |
37 |
|
|
typedef trajectories::TrajectorySample TrajectorySample; |
38 |
|
|
typedef math::Vector Vector; |
39 |
|
|
typedef math::Vector3 Vector3; |
40 |
|
|
typedef math::ConstraintEquality ConstraintEquality; |
41 |
|
|
typedef pinocchio::Data::Matrix6x Matrix6x; |
42 |
|
|
|
43 |
|
|
TaskAMEquality(const std::string& name, RobotWrapper& robot); |
44 |
|
|
|
45 |
|
2 |
virtual ~TaskAMEquality() {} |
46 |
|
|
|
47 |
|
|
int dim() const; |
48 |
|
|
|
49 |
|
|
const ConstraintBase& compute(const double t, ConstRefVector q, |
50 |
|
|
ConstRefVector v, Data& data); |
51 |
|
|
|
52 |
|
|
const ConstraintBase& getConstraint() const; |
53 |
|
|
|
54 |
|
|
void setReference(const TrajectorySample& ref); |
55 |
|
|
const TrajectorySample& getReference() const; |
56 |
|
|
|
57 |
|
|
const Vector3& getDesiredMomentumDerivative() const; |
58 |
|
|
Vector3 getdMomentum(ConstRefVector dv) const; |
59 |
|
|
|
60 |
|
|
const Vector3& momentum_error() const; |
61 |
|
|
const Vector3& momentum() const; |
62 |
|
|
const Vector& momentum_ref() const; |
63 |
|
|
const Vector& dmomentum_ref() const; |
64 |
|
|
|
65 |
|
|
const Vector3& Kp(); |
66 |
|
|
const Vector3& Kd(); |
67 |
|
|
void Kp(ConstRefVector Kp); |
68 |
|
|
void Kd(ConstRefVector Kp); |
69 |
|
|
|
70 |
|
|
protected: |
71 |
|
|
Vector3 m_Kp; |
72 |
|
|
Vector3 m_Kd; |
73 |
|
|
Vector3 m_L_error, m_dL_error; |
74 |
|
|
Vector3 m_dL_des; |
75 |
|
|
|
76 |
|
|
Vector3 m_drift; |
77 |
|
|
Vector3 m_L, m_dL; |
78 |
|
|
TrajectorySample m_ref; |
79 |
|
|
ConstraintEquality m_constraint; |
80 |
|
|
}; |
81 |
|
|
|
82 |
|
|
} // namespace tasks |
83 |
|
|
} // namespace tsid |
84 |
|
|
|
85 |
|
|
#endif // ifndef __invdyn_task_am_equality_hpp__ |