ocra-recipes
Doxygen documentation for the ocra-recipes repository
ControlFrame.h
Go to the documentation of this file.
1 
14 #ifndef _OCRA_CONTROL_FRAME_H_
15 #define _OCRA_CONTROL_FRAME_H_
16 
18 #include <ocra/util/MathTypes.h>
19 #include <ocra/util/Macros.h>
20 #include "Eigen/Lgsm"
21 #include <boost/shared_ptr.hpp>
22 #include <boost/noncopyable.hpp>
23 #include <yarp/os/Semaphore.h>
24 
25 namespace ocra
26 {
27  class Model;
28 }
29 
30 namespace ocra
31 {
32  // --- ABSTRACT -----------------------------------------------
33 
35 
44  : public NamedInstance
45  , boost::noncopyable
46  {
48 
49  protected:
50  ControlFrame(const std::string& name);
51 
52  public:
53  virtual ~ControlFrame() = 0;
54 
55  virtual Eigen::Displacementd getPosition() const = 0;
56  virtual Eigen::Twistd getVelocity() const = 0;
57  virtual Eigen::Twistd getAcceleration() const = 0;
58  virtual Eigen::Wrenchd getWrench() const = 0;
59  virtual Eigen::Matrix<double,6,Eigen::Dynamic> getJacobian() const = 0;
60  virtual bool dependsOnModelConfiguration() const = 0;
61  virtual const Model& getModel() const = 0;
62  };
63 
64 
65  // --- EXTERNAL INPUT -----------------------------------------
66 
68 
76  : public ControlFrame
77  {
79  public:
80  TargetFrame(const std::string& name, const Model& model);
81 
82  Eigen::Displacementd getPosition() const;
83  Eigen::Twistd getVelocity() const;
84  Eigen::Twistd getAcceleration() const;
85  Eigen::Wrenchd getWrench() const;
86  Eigen::Matrix<double,6,Eigen::Dynamic> getJacobian() const;
87  bool dependsOnModelConfiguration() const;
88  const Model& getModel() const;
89 
90  void setPosition(const Eigen::Displacementd& H);
91  void setVelocity(const Eigen::Twistd& T);
92  void setAcceleration(const Eigen::Twistd& gamma);
93  void setWrench(const Eigen::Wrenchd& W);
94 
95  private:
96  struct Pimpl;
97  boost::shared_ptr<Pimpl> pimpl;
98  };
99 
100 
101  // --- ATTACHED TO A SEGMENT ----------------------------------
102 
105  : public ControlFrame
106  {
108  public:
109  SegmentFrame(const std::string& name, const Model& model, const std::string& segname);
110  SegmentFrame(const std::string& name, const Model& model, const std::string& segname, const Eigen::Displacementd& H_local);
111  SegmentFrame(const std::string& name, const Model& model, int segmentId);
112  SegmentFrame(const std::string& name, const Model& model, int segmentId, const Eigen::Displacementd& H_local);
113 
114  Eigen::Displacementd getPosition() const;
115  Eigen::Twistd getVelocity() const;
116  Eigen::Twistd getAcceleration() const;
117  Eigen::Wrenchd getWrench() const;
118  Eigen::Matrix<double,6,Eigen::Dynamic> getJacobian() const;
119  bool dependsOnModelConfiguration() const;
120  const Model& getModel() const;
121  int getSegmentIndex() const;
122 
123  private:
124  struct Pimpl;
125  boost::shared_ptr<Pimpl> pimpl;
126  };
127 
128 
129  // --- ATTACHED TO THE COM ------------------------------------
130 
132  class CoMFrame
133  : public ControlFrame
134  {
136  public:
137  CoMFrame(const std::string& name, const Model& model);
138 
139  Eigen::Displacementd getPosition() const;
140  Eigen::Twistd getVelocity() const;
141  Eigen::Twistd getAcceleration() const;
142  Eigen::Wrenchd getWrench() const;
143  Eigen::Matrix<double,6,Eigen::Dynamic> getJacobian() const;
144  bool dependsOnModelConfiguration() const;
145  const Model& getModel() const;
146 
147  private:
148  struct Pimpl;
149  boost::shared_ptr<Pimpl> pimpl;
150  };
151 }
152 
153 #endif
154 
155 // cmake:sourcegroup=Api
virtual Eigen::Twistd getAcceleration() const =0
virtual ~ControlFrame()=0
Model class.
Definition: Model.h:38
#define DEFINE_CLASS_POINTER_TYPEDEFS(Class)
Definition: Macros.h:8
Optimization-based Robot Controller namespace. a library of classes to write and solve optimization p...
A frame attached to a segment of a model.
Definition: ControlFrame.h:104
virtual Eigen::Matrix< double, 6, Eigen::Dynamic > getJacobian() const =0
virtual Eigen::Twistd getVelocity() const =0
virtual bool dependsOnModelConfiguration() const =0
ControlFrame(const std::string &name)
virtual const Model & getModel() const =0
virtual Eigen::Displacementd getPosition() const =0
Declaration file of the OptimizationVariable class.
Creates a frame whose center is at the CoM of the model and whose axes are parallel to the axes of th...
Definition: ControlFrame.h:132
virtual Eigen::Wrenchd getWrench() const =0
Represents a &#39;target&#39;, i.e. something that does not depend on a model but must match with another fra...
Definition: ControlFrame.h:75
Generic representation of a frame: gives access to its position, velocity, jacobian...
Definition: ControlFrame.h:43