intermediate-qp-matrices.hh
Go to the documentation of this file.
1 /*
2  * Copyright 2011,
3  *
4  * Olivier Stasse
5  * Andrei Herdt
6  *
7  * JRL, CNRS/AIST
8  *
9  * This file is part of walkGenJrl.
10  * walkGenJrl is free software: you can redistribute it and/or modify
11  * it under the terms of the GNU Lesser General Public License as published by
12  * the Free Software Foundation, either version 3 of the License, or
13  * (at your option) any later version.
14  *
15  * walkGenJrl is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18  * GNU General Lesser Public License for more details.
19  * You should have received a copy of the GNU Lesser General Public License
20  * along with walkGenJrl. If not, see <http://www.gnu.org/licenses/>.
21  *
22  * Research carried out within the scope of the
23  * Joint Japanese-French Robotics Laboratory (JRL)
24  */
25 
26 #ifndef INTERMEDQPMAT_HH_
27 #define INTERMEDQPMAT_HH_
28 
29 #include <privatepgtypes.hh>
30 
31 #include <fstream>
32 #include <iostream>
33 
35 
36 namespace PatternGeneratorJRL {
40  //
41  // Public types
42  //
43 public:
46  struct state_variant_s {
48 
50  reference_t Ref;
51 
53  com_t CoM;
54 
56  trunk_t Trunk;
57 
59  Eigen::MatrixXd V;
61  Eigen::MatrixXd Vshift;
63  Eigen::MatrixXd VT;
65  Eigen::VectorXd VcX, VcY;
68  Eigen::VectorXd VcshiftX, VcshiftY;
70  Eigen::VectorXd Vc_fX, Vc_fY;
72  Eigen::MatrixXd V_f;
74  support_state_t SupportState;
75  };
78 
83  double weight;
84 
86  objective_e type;
87 
88  std::ostream &print(std::ostream &o) const;
89  void dump(const char *filename) const;
90  };
93 
94  //
95  // Public methods
96  //
97 public:
100  IntermedQPMat();
101  ~IntermedQPMat();
103 
106  inline state_variant_t const &State() const { return StateMatrices_; };
107  inline state_variant_t &State() { return StateMatrices_; };
108 
109  objective_variant_t const &Objective(objective_e type) const;
110  objective_variant_t &Objective(objective_e type);
111 
112  linear_inequality_t const &Inequalities(ineq_e type) const;
113  linear_inequality_t &Inequalities(ineq_e type);
114 
115  inline com_t const &CoM() const { return StateMatrices_.CoM; };
116  inline void CoM(const com_t &CoM) { StateMatrices_.CoM = CoM; };
117 
118  inline trunk_t const &Trunk() const { return StateMatrices_.Trunk; }
119  inline void Trunk(const trunk_t &Trunk) { StateMatrices_.Trunk = Trunk; }
120 
121  inline reference_t const &Reference() const { return StateMatrices_.Ref; };
122  inline reference_t &Reference() { return StateMatrices_.Ref; };
123  inline void Reference(const reference_t &Ref) { StateMatrices_.Ref = Ref; };
124 
125  inline support_state_t const &SupportState() const {
126  return StateMatrices_.SupportState;
127  };
128  inline support_state_t &SupportState() {
129  return StateMatrices_.SupportState;
130  };
131  inline void SupportState(const support_state_t &SupportState) {
132  StateMatrices_.SupportState = SupportState;
133  };
135 
139  void dump_objective(objective_e type, std::ostream &aos);
140  void dump_state(std::ostream &aos);
141  void dump_objective(const char *filename, objective_e type);
142  void dump_state(const char *filename);
144 
145  //
146  // Private members
147  //
148 private:
149  objective_variant_t MeanVelocity_, InstantVelocity_, COPCentering_, JerkMin_;
150 
151  state_variant_t StateMatrices_;
152 
153  linear_inequality_t IneqCoP_, IneqCoM_, IneqFeet_;
154 };
155 
156 std::ostream &operator<<(std::ostream &o,
157  const IntermedQPMat::objective_variant_s &r);
158 } // namespace PatternGeneratorJRL
159 
160 #endif /* INTERMEDQPMAT_HH_ */
PatternGeneratorJRL::IntermedQPMat::state_variant_s::Ref
reference_t Ref
Objective independent QP elements.
Definition: intermediate-qp-matrices.hh:50
PatternGeneratorJRL::IntermedQPMat::objective_variant_s::print
std::ostream & print(std::ostream &o) const
Definition: intermediate-qp-matrices.cpp:140
PatternGeneratorJRL::IntermedQPMat::state_variant_s::V_f
Eigen::MatrixXd V_f
Selection matrix for relative feet positions.
Definition: intermediate-qp-matrices.hh:72
PatternGeneratorJRL::IntermedQPMat::state_variant_s::VcY
Eigen::VectorXd VcY
Definition: intermediate-qp-matrices.hh:65
PatternGeneratorJRL::IntermedQPMat
Custom (value based) container providing intermediate elements for the construction of a QP.
Definition: intermediate-qp-matrices.hh:39
PatternGeneratorJRL::IntermedQPMat::Reference
const reference_t & Reference() const
Definition: intermediate-qp-matrices.hh:121
PatternGeneratorJRL::IntermedQPMat::State
const state_variant_t & State() const
Definition: intermediate-qp-matrices.hh:106
PatternGeneratorJRL::IntermedQPMat::SupportState
support_state_t & SupportState()
Definition: intermediate-qp-matrices.hh:128
PatternGeneratorJRL::IntermedQPMat::state_variant_t
state_variant_s state_variant_t
Definition: intermediate-qp-matrices.hh:76
PatternGeneratorJRL::IntermedQPMat::objective_variant_s::type
objective_e type
Minimization objective type.
Definition: intermediate-qp-matrices.hh:86
PatternGeneratorJRL::IntermedQPMat::objective_variant_s
Definition: intermediate-qp-matrices.hh:81
PatternGeneratorJRL::IntermedQPMat::objective_variant_t
objective_variant_s objective_variant_t
Definition: intermediate-qp-matrices.hh:91
PatternGeneratorJRL::IntermedQPMat::SupportState
void SupportState(const support_state_t &SupportState)
Definition: intermediate-qp-matrices.hh:131
PatternGeneratorJRL::IntermedQPMat::state_variant_s::VT
Eigen::MatrixXd VT
Transpose of V.
Definition: intermediate-qp-matrices.hh:63
PatternGeneratorJRL::IntermedQPMat::state_variant_s::VcX
Eigen::VectorXd VcX
Selection matrix multiplied with the current foot position.
Definition: intermediate-qp-matrices.hh:65
PatternGeneratorJRL::IntermedQPMat::State
state_variant_t & State()
Definition: intermediate-qp-matrices.hh:107
PatternGeneratorJRL::operator<<
std::ostream & operator<<(std::ostream &os, const COMPosition_s &aCp)
Definition: pgtypes.hh:63
PatternGeneratorJRL::IntermedQPMat::Trunk
const trunk_t & Trunk() const
Definition: intermediate-qp-matrices.hh:118
PatternGeneratorJRL::IntermedQPMat::state_variant_s::Vc_fX
Eigen::VectorXd Vc_fX
Selection matrix for the current foot position.
Definition: intermediate-qp-matrices.hh:70
PatternGeneratorJRL::IntermedQPMat::~IntermedQPMat
~IntermedQPMat()
Definition: intermediate-qp-matrices.cpp:45
PatternGeneratorJRL::IntermedQPMat::dump_state
void dump_state(std::ostream &aos)
Definition: intermediate-qp-matrices.cpp:121
PatternGeneratorJRL::IntermedQPMat::Reference
void Reference(const reference_t &Ref)
Definition: intermediate-qp-matrices.hh:123
PatternGeneratorJRL::IntermedQPMat::state_variant_s::Vshift
Eigen::MatrixXd Vshift
Shifted selection matrix for the previewed feet positions.
Definition: intermediate-qp-matrices.hh:61
PatternGeneratorJRL::IntermedQPMat::SupportState
const support_state_t & SupportState() const
Definition: intermediate-qp-matrices.hh:125
PatternGeneratorJRL::IntermedQPMat::CoM
const com_t & CoM() const
Definition: intermediate-qp-matrices.hh:115
PatternGeneratorJRL::IntermedQPMat::Objective
const objective_variant_t & Objective(objective_e type) const
Definition: intermediate-qp-matrices.cpp:48
PatternGeneratorJRL::IntermedQPMat::IntermedQPMat
IntermedQPMat()
Definition: intermediate-qp-matrices.cpp:34
PatternGeneratorJRL::IntermedQPMat::Inequalities
const linear_inequality_t & Inequalities(ineq_e type) const
Definition: intermediate-qp-matrices.cpp:74
PatternGeneratorJRL::IntermedQPMat::state_variant_s::Trunk
trunk_t Trunk
TrunkState.
Definition: intermediate-qp-matrices.hh:56
PatternGeneratorJRL::IntermedQPMat::CoM
void CoM(const com_t &CoM)
Definition: intermediate-qp-matrices.hh:116
PatternGeneratorJRL::IntermedQPMat::Trunk
void Trunk(const trunk_t &Trunk)
Definition: intermediate-qp-matrices.hh:119
PatternGeneratorJRL::IntermedQPMat::state_variant_s::VcshiftX
Eigen::VectorXd VcshiftX
Shifted selection matrix multiplied with the current feet position.
Definition: intermediate-qp-matrices.hh:68
PatternGeneratorJRL::IntermedQPMat::state_variant_s::V
Eigen::MatrixXd V
Selection matrix for the previewed feet positions.
Definition: intermediate-qp-matrices.hh:59
PatternGeneratorJRL
\doc Simulate a rigid body
Definition: patterngeneratorinterface.hh:41
PatternGeneratorJRL::IntermedQPMat::state_variant_s::Vc_fY
Eigen::VectorXd Vc_fY
Definition: intermediate-qp-matrices.hh:70
PatternGeneratorJRL::IntermedQPMat::state_variant_s::VcshiftY
Eigen::VectorXd VcshiftY
Definition: intermediate-qp-matrices.hh:68
PatternGeneratorJRL::IntermedQPMat::state_variant_s
Definition: intermediate-qp-matrices.hh:46
PatternGeneratorJRL::IntermedQPMat::Reference
reference_t & Reference()
Definition: intermediate-qp-matrices.hh:122
PatternGeneratorJRL::IntermedQPMat::state_variant_s::CoM
com_t CoM
State of the Center of Mass.
Definition: intermediate-qp-matrices.hh:53
PatternGeneratorJRL::IntermedQPMat::state_variant_s::SupportState
support_state_t SupportState
Current support state.
Definition: intermediate-qp-matrices.hh:74
rigid-body-system.hh
PatternGeneratorJRL::IntermedQPMat::dump_objective
void dump_objective(objective_e type, std::ostream &aos)
Definition: intermediate-qp-matrices.cpp:104
PatternGeneratorJRL::IntermedQPMat::objective_variant_s::dump
void dump(const char *filename) const
Definition: intermediate-qp-matrices.cpp:146
PatternGeneratorJRL::IntermedQPMat::objective_variant_s::weight
double weight
Ponderation.
Definition: intermediate-qp-matrices.hh:83