task-cop-equality.hpp 2.81 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
//
// Copyright (c) 2021 University of Trento
//
// This file is part of tsid
// tsid is free software: you can redistribute it
// and/or modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation, either version
// 3 of the License, or (at your option) any later version.
// tsid is distributed in the hope that it will be
// useful, but WITHOUT ANY WARRANTY; without even the implied warranty
// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Lesser Public License for more details. You should have
// received a copy of the GNU Lesser General Public License along with
// tsid If not, see
// <http://www.gnu.org/licenses/>.
//

#ifndef __invdyn_task_cop_equality_hpp__
#define __invdyn_task_cop_equality_hpp__

#include "tsid/math/fwd.hpp"
#include "tsid/tasks/task-contact-force.hpp"
#include "tsid/trajectories/trajectory-base.hpp"
#include "tsid/math/constraint-equality.hpp"
#include "tsid/formulations/inverse-dynamics-formulation-base.hpp"

namespace tsid
{
  namespace tasks
  {

    class TaskCopEquality : public TaskContactForce
    {
    public:
      EIGEN_MAKE_ALIGNED_OPERATOR_NEW

      typedef math::Index Index;
      typedef trajectories::TrajectorySample TrajectorySample;
      typedef math::Vector Vector;
      typedef math::Vector3 Vector3;
      typedef math::ConstraintEquality ConstraintEquality;
      typedef pinocchio::SE3 SE3;

      TaskCopEquality(const std::string & name,
                      RobotWrapper & robot);

      void setContactList(const std::vector<std::shared_ptr<ContactLevel> >  *contacts);

      int dim() const;

      virtual const std::string& getAssociatedContactName();

      const ConstraintBase & compute(const double t,
                                     ConstRefVector q,
                                     ConstRefVector v,
                                     Data & data);

      const ConstraintBase & compute(const double t,
                                     ConstRefVector q,
                                     ConstRefVector v,
                                     Data & data,
                                     const std::vector<std::shared_ptr<ContactLevel> >  *contacts);

      const ConstraintBase & getConstraint() const;

      void setReference(const Vector3 & ref);
      const Vector3 & getReference() const;

69
70
71
      void setContactNormal(const Vector3 & n);
      const Vector3 & getContactNormal() const;

72
73
74
75
76
77
78
79
80
81
82
83
    protected:
      const std::vector<std::shared_ptr<ContactLevel> > *m_contacts;
      std::string m_contact_name; // an empty string
      Vector3 m_normal;     // normal direction to the ground expressed in world frame
      Vector3 m_ref;        // reference CoP in world frame
      ConstraintEquality m_constraint;
    };

  }
}

#endif // ifndef __invdyn_task_com_equality_hpp__