GCC Code Coverage Report


Directory: ./
File: include/tsid/tasks/task-contact-force-equality.hpp
Date: 2024-11-10 01:12:44
Exec Total Coverage
Lines: 0 1 0.0%
Branches: 0 0 -%

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_contact_force_equality_hpp__
19 #define __invdyn_task_contact_force_equality_hpp__
20
21 #include "tsid/math/fwd.hpp"
22 #include "tsid/tasks/task-contact-force.hpp"
23 #include "tsid/trajectories/trajectory-base.hpp"
24 #include "tsid/math/constraint-equality.hpp"
25 #include "tsid/contacts/contact-base.hpp"
26
27 namespace tsid {
28 namespace tasks {
29
30 class TaskContactForceEquality : public TaskContactForce {
31 public:
32 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
33
34 typedef math::Index Index;
35 typedef trajectories::TrajectorySample TrajectorySample;
36 typedef math::Vector Vector;
37 typedef math::Vector6 Vector6;
38 typedef math::Vector3 Vector3;
39 typedef math::ConstraintEquality ConstraintEquality;
40 typedef pinocchio::SE3 SE3;
41
42 TaskContactForceEquality(const std::string& name, RobotWrapper& robot,
43 const double dt, contacts::ContactBase& contact);
44
45 virtual ~TaskContactForceEquality() {}
46
47 int dim() const;
48
49 virtual const std::string& getAssociatedContactName();
50 virtual const contacts::ContactBase& getAssociatedContact();
51 void setAssociatedContact(contacts::ContactBase& contact);
52
53 // Task expressed as a PID between the reference force and the external one
54 const ConstraintBase& compute(const double t, ConstRefVector q,
55 ConstRefVector v, Data& data);
56
57 const ConstraintBase& compute(
58 const double t, ConstRefVector q, ConstRefVector v, Data& data,
59 const std::vector<std::shared_ptr<ContactLevel> >* contacts);
60
61 const ConstraintBase& getConstraint() const;
62
63 void setReference(TrajectorySample& ref);
64 const TrajectorySample& getReference() const;
65
66 void setExternalForce(TrajectorySample& f_ext);
67 const TrajectorySample& getExternalForce() const;
68
69 const Vector& Kp() const;
70 const Vector& Kd() const;
71 const Vector& Ki() const;
72 const double& getLeakRate() const;
73 void Kp(ConstRefVector Kp);
74 void Kd(ConstRefVector Kp);
75 void Ki(ConstRefVector Ki);
76 void setLeakRate(double leak);
77
78 protected:
79 // contact associated to the force task
80 contacts::ContactBase* m_contact;
81 std::string m_contact_name; // the associated contact name or an empty string
82 ConstraintEquality m_constraint;
83 TrajectorySample m_ref; // reference Force 6D to follow
84 TrajectorySample m_fext; // external Force 6D in the same frame than the ref
85 Vector m_forceIntegralError; // Integral error of the PID
86 Vector m_Kp;
87 Vector m_Kd;
88 Vector m_Ki;
89 double m_dt;
90 double m_leak_rate;
91 };
92
93 } // namespace tasks
94 } // namespace tsid
95
96 #endif // ifndef __invdyn_task_contact_force_equality_hpp__
97