ocra-recipes
Doxygen documentation for the ocra-recipes repository
ContactAvoidanceConstraint.h
Go to the documentation of this file.
1 
8 #ifndef __CONTACTAVOIDANCECONSTRAINT_H__
9 #define __CONTACTAVOIDANCECONSTRAINT_H__
10 
11 
13 
14 namespace ocra
15 {
16 
68 {
69  public:
70  typedef LinearFunction functionType_t; //< alias on the type of the mother class. Needed to duplicate the function tree.
71 
72  ContactAvoidanceFunction(const Model& m, Variable& var);
74 
75  // get/set horizon of prediction
76  double getHorizonOfPrediction() const;
77  void setHorizonOfPrediction(double newHpos);
78  double getMargin() const;
79  void setMargin(double newMargin);
80 
81  void updateContactInformation(const Eigen::MatrixXd& _JObst, const Eigen::VectorXd& _dJdqOst, const Eigen::VectorXd& _distObst, const Eigen::VectorXd& _velObst);
82 
83  private: // Forbid copy
86 
87  protected:
88  void updateJacobian() const;
89  void updateb() const;
90  // void buildA();
91 
92  // virtual void doUpdateInputSizeBegin();
93  // virtual void doUpdateInputSizeEnd();
94 
95  virtual void doUpdateDimensionBegin(int newDimension);
96  virtual void doUpdateDimensionEnd(int oldDimension);
97 
98  protected:
99 // const Model& _model;
100 // Variable& _q_ddot;
101 
102  double hpos; // the horizon of prediction for the future joint position;
103  double margin;
104 
105  Eigen::MatrixXd JObst;
106  Eigen::VectorXd dJdqObst;
107  Eigen::VectorXd distObst;
108  Eigen::VectorXd velObst;
109 
110  void computeFullJacobian(const Eigen::MatrixXd& _JObst, Eigen::MatrixXd& fullJacobian) const;
111  void computeFullb(const Eigen::VectorXd& _dJdqObst, const Eigen::VectorXd& _distObst, const Eigen::VectorXd& _velObst, Eigen::VectorXd& fullb) const;
112 
113 };
114 
115 
116 
117 
118 
119 
125 {
126  public:
127  typedef LinearFunction functionType_t; //< alias on the type of the mother class. Needed to duplicate the function tree.
128 
129  FullContactAvoidanceFunction(const Model& model);
131 
132  protected:
133  virtual void updateJacobian() const;
134  virtual void updateb() const;
135 
136 };
137 
138 
139 
140 
146 {
147  public:
148  typedef LinearFunction functionType_t; //< alias on the type of the mother class. Needed to duplicate the function tree.
149 
150  ReducedContactAvoidanceFunction(const Model& model, const FullDynamicEquationFunction& dynamicEquation);
152 
153  protected:
154  virtual void updateb() const;
155 
156  private:
157  struct Pimpl;
158  boost::shared_ptr<Pimpl> pimpl;
159 
160  virtual void doUpdateInputSizeBegin();
161  virtual void doUpdateInputSizeEnd();
162 };
163 
164 
165 
166 
167 
168 
169 
170 
172 {
173 public:
174  ContactAvoidanceConstraint(const Model& model, double hpos, double margin);
176 
177  double getHorizonOfPrediction() const;
178  void setHorizonOfPrediction(double newHpos);
179 
180  double getMargin() const;
181  void setMargin(double newMargin);
182 
183  void updateContactInformation(const Eigen::MatrixXd& _JObst, const Eigen::VectorXd& _dJdqOst, const Eigen::VectorXd& _distObst, const Eigen::VectorXd& _velObst);
184 
185 protected:
186  virtual void connectToController(const FullDynamicEquationFunction& dynamicEquation, bool useReducedProblem);
187  virtual void disconnectFromController();
188 
189 
190 private:
191  ContactAvoidanceFunction* createFullContactAvoidanceFunction(const Model& model);
192  ContactAvoidanceFunction* createReducedContactAvoidanceFunction(const Model& model, const FullDynamicEquationFunction& dynamicEquation);
193 
194  ContactAvoidanceFunction* _contactAvoidanceFunction;
195  const Model& _model;
196  bool _is_connected;
197 
198  double _hpos;
199  double _margin;
200 };
201 
202  // end group constraint
204 
205 }
206 
207 
208 #endif
virtual void doUpdateInputSizeEnd()
void updateContactInformation(const Eigen::MatrixXd &_JObst, const Eigen::VectorXd &_dJdqOst, const Eigen::VectorXd &_distObst, const Eigen::VectorXd &_velObst)
virtual void doUpdateDimensionBegin(int newDimension)
ContactAvoidanceFunction(const Model &m, Variable &var)
Create a linear function that represents the contact avoidance function for the full formalism...
Model class.
Definition: Model.h:38
LinearFunction class.
Optimization-based Robot Controller namespace. a library of classes to write and solve optimization p...
void computeFullJacobian(const Eigen::MatrixXd &_JObst, Eigen::MatrixXd &fullJacobian) const
Create a linear function that represents the joint limit function.
This class represents a variable in a mathematical sense.
Definition: Variable.h:105
Create a linear function that represents the dynamic equation of motion.
virtual void doUpdateDimensionEnd(int oldDimension)
void computeFullb(const Eigen::VectorXd &_dJdqObst, const Eigen::VectorXd &_distObst, const Eigen::VectorXd &_velObst, Eigen::VectorXd &fullb) const
virtual void doUpdateInputSizeBegin()
Definition: Function.cpp:93
Create a linear function that represents the contact avoidance function for the reduced formalism...
Define base class that can be used as constraints in wOcra controller.