task-joint-posture.hpp 2.79 KB
Newer Older
1
2
3
//
// Copyright (c) 2017 CNRS
//
jcarpent's avatar
jcarpent committed
4
5
// This file is part of tsid
// tsid is free software: you can redistribute it
6
7
8
// 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.
jcarpent's avatar
jcarpent committed
9
// tsid is distributed in the hope that it will be
10
11
12
13
// 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
jcarpent's avatar
jcarpent committed
14
// tsid If not, see
15
16
17
18
19
20
// <http://www.gnu.org/licenses/>.
//

#ifndef __invdyn_task_joint_posture_hpp__
#define __invdyn_task_joint_posture_hpp__

jcarpent's avatar
jcarpent committed
21
22
23
#include <tsid/tasks/task-motion.hpp>
#include <tsid/trajectories/trajectory-base.hpp>
#include <tsid/math/constraint-equality.hpp>
24
#include <tsid/deprecation.hpp>
25

jcarpent's avatar
jcarpent committed
26
namespace tsid
27
28
29
30
{
  namespace tasks
  {

jcarpent's avatar
jcarpent committed
31
    class TaskJointPosture : public TaskMotion
32
33
    {
    public:
34
35
      EIGEN_MAKE_ALIGNED_OPERATOR_NEW
      
36
37
38
39
40
      typedef math::Index Index;
      typedef trajectories::TrajectorySample TrajectorySample;
      typedef math::Vector Vector;
      typedef math::VectorXi VectorXi;
      typedef math::ConstraintEquality ConstraintEquality;
41
      typedef pinocchio::Data Data;
42
43
44
45
46
47
48
49
50

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

      int dim() const;

      const ConstraintBase & compute(const double t,
                                     ConstRefVector q,
                                     ConstRefVector v,
51
                                     Data & data);
52
53
54
55

      const ConstraintBase & getConstraint() const;

      void setReference(const TrajectorySample & ref);
andreadelprete's avatar
andreadelprete committed
56
57
58
59
      const TrajectorySample & getReference() const;

      const Vector & getDesiredAcceleration() const;
      Vector getAcceleration(ConstRefVector dv) const;
60

61
62
63
      DEPRECATED const Vector & mask() const; // deprecated
      DEPRECATED void mask(const Vector & mask); // deprecated
      virtual void setMask(math::ConstRefVector mask);
64

65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
      const Vector & position_error() const;
      const Vector & velocity_error() const;
      const Vector & position() const;
      const Vector & velocity() const;
      const Vector & position_ref() const;
      const Vector & velocity_ref() const;

      const Vector & Kp();
      const Vector & Kd();
      void Kp(ConstRefVector Kp);
      void Kd(ConstRefVector Kp);

    protected:
      Vector m_Kp;
      Vector m_Kd;
      Vector m_p_error, m_v_error;
      Vector m_p, m_v;
andreadelprete's avatar
andreadelprete committed
82
      Vector m_a_des;
83
84
      Vector m_mask;
      VectorXi m_activeAxes;
85
86
87
88
89
90
91
92
      TrajectorySample m_ref;
      ConstraintEquality m_constraint;
    };
    
  }
}

#endif // ifndef __invdyn_task_joint_posture_hpp__