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 
30 #include <fstream>
31 #include <iostream>
32 #include <privatepgtypes.hh>
33 
34 namespace PatternGeneratorJRL {
38  //
39  // Public types
40  //
41  public:
44  struct state_variant_s {
46 
48  reference_t Ref;
49 
51  com_t CoM;
52 
54  trunk_t Trunk;
55 
57  Eigen::MatrixXd V;
59  Eigen::MatrixXd Vshift;
61  Eigen::MatrixXd VT;
63  Eigen::VectorXd VcX, VcY;
66  Eigen::VectorXd VcshiftX, VcshiftY;
68  Eigen::VectorXd Vc_fX, Vc_fY;
70  Eigen::MatrixXd V_f;
72  support_state_t SupportState;
73  };
76 
81  double weight;
82 
84  objective_e type;
85 
86  std::ostream &print(std::ostream &o) const;
87  void dump(const char *filename) const;
88  };
91 
92  //
93  // Public methods
94  //
95  public:
98  IntermedQPMat();
101 
104  inline state_variant_t const &State() const { return StateMatrices_; };
105  inline state_variant_t &State() { return StateMatrices_; };
106 
107  objective_variant_t const &Objective(objective_e type) const;
108  objective_variant_t &Objective(objective_e type);
109 
110  linear_inequality_t const &Inequalities(ineq_e type) const;
111  linear_inequality_t &Inequalities(ineq_e type);
112 
113  inline com_t const &CoM() const { return StateMatrices_.CoM; };
114  inline void CoM(const com_t &CoM) { StateMatrices_.CoM = CoM; };
115 
116  inline trunk_t const &Trunk() const { return StateMatrices_.Trunk; }
117  inline void Trunk(const trunk_t &Trunk) { StateMatrices_.Trunk = Trunk; }
118 
119  inline reference_t const &Reference() const { return StateMatrices_.Ref; };
120  inline reference_t &Reference() { return StateMatrices_.Ref; };
121  inline void Reference(const reference_t &Ref) { StateMatrices_.Ref = Ref; };
122 
123  inline support_state_t const &SupportState() const {
124  return StateMatrices_.SupportState;
125  };
126  inline support_state_t &SupportState() {
127  return StateMatrices_.SupportState;
128  };
129  inline void SupportState(const support_state_t &SupportState) {
130  StateMatrices_.SupportState = SupportState;
131  };
133 
137  void dump_objective(objective_e type, std::ostream &aos);
138  void dump_state(std::ostream &aos);
139  void dump_objective(const char *filename, objective_e type);
140  void dump_state(const char *filename);
142 
143  //
144  // Private members
145  //
146  private:
147  objective_variant_t MeanVelocity_, InstantVelocity_, COPCentering_, JerkMin_;
148 
149  state_variant_t StateMatrices_;
150 
151  linear_inequality_t IneqCoP_, IneqCoM_, IneqFeet_;
152 };
153 
154 std::ostream &operator<<(std::ostream &o,
155  const IntermedQPMat::objective_variant_s &r);
156 } // namespace PatternGeneratorJRL
157 
158 #endif /* INTERMEDQPMAT_HH_ */
PatternGeneratorJRL::IntermedQPMat::state_variant_s::Ref
reference_t Ref
Objective independent QP elements.
Definition: intermediate-qp-matrices.hh:48
PatternGeneratorJRL::IntermedQPMat::objective_variant_s::print
std::ostream & print(std::ostream &o) const
Definition: intermediate-qp-matrices.cpp:138
PatternGeneratorJRL::IntermedQPMat::state_variant_s::V_f
Eigen::MatrixXd V_f
Selection matrix for relative feet positions.
Definition: intermediate-qp-matrices.hh:70
PatternGeneratorJRL::IntermedQPMat::state_variant_s::VcY
Eigen::VectorXd VcY
Definition: intermediate-qp-matrices.hh:63
PatternGeneratorJRL::IntermedQPMat
Custom (value based) container providing intermediate elements for the construction of a QP.
Definition: intermediate-qp-matrices.hh:37
PatternGeneratorJRL::IntermedQPMat::Reference
const reference_t & Reference() const
Definition: intermediate-qp-matrices.hh:119
PatternGeneratorJRL::IntermedQPMat::State
const state_variant_t & State() const
Definition: intermediate-qp-matrices.hh:104
PatternGeneratorJRL::IntermedQPMat::SupportState
support_state_t & SupportState()
Definition: intermediate-qp-matrices.hh:126
PatternGeneratorJRL::IntermedQPMat::state_variant_t
state_variant_s state_variant_t
Definition: intermediate-qp-matrices.hh:74
PatternGeneratorJRL::IntermedQPMat::objective_variant_s::type
objective_e type
Minimization objective type.
Definition: intermediate-qp-matrices.hh:84
PatternGeneratorJRL::IntermedQPMat::objective_variant_s
Definition: intermediate-qp-matrices.hh:79
PatternGeneratorJRL::IntermedQPMat::objective_variant_t
objective_variant_s objective_variant_t
Definition: intermediate-qp-matrices.hh:89
PatternGeneratorJRL::IntermedQPMat::SupportState
void SupportState(const support_state_t &SupportState)
Definition: intermediate-qp-matrices.hh:129
PatternGeneratorJRL::IntermedQPMat::state_variant_s::VT
Eigen::MatrixXd VT
Transpose of V.
Definition: intermediate-qp-matrices.hh:61
PatternGeneratorJRL::IntermedQPMat::state_variant_s::VcX
Eigen::VectorXd VcX
Selection matrix multiplied with the current foot position.
Definition: intermediate-qp-matrices.hh:63
PatternGeneratorJRL::IntermedQPMat::State
state_variant_t & State()
Definition: intermediate-qp-matrices.hh:105
PatternGeneratorJRL::operator<<
std::ostream & operator<<(std::ostream &os, const COMPosition_s &aCp)
Definition: pgtypes.hh:62
PatternGeneratorJRL::IntermedQPMat::Trunk
const trunk_t & Trunk() const
Definition: intermediate-qp-matrices.hh:116
PatternGeneratorJRL::IntermedQPMat::state_variant_s::Vc_fX
Eigen::VectorXd Vc_fX
Selection matrix for the current foot position.
Definition: intermediate-qp-matrices.hh:68
PatternGeneratorJRL::IntermedQPMat::~IntermedQPMat
~IntermedQPMat()
Definition: intermediate-qp-matrices.cpp:44
PatternGeneratorJRL::IntermedQPMat::dump_state
void dump_state(std::ostream &aos)
Definition: intermediate-qp-matrices.cpp:119
PatternGeneratorJRL::IntermedQPMat::Reference
void Reference(const reference_t &Ref)
Definition: intermediate-qp-matrices.hh:121
PatternGeneratorJRL::IntermedQPMat::state_variant_s::Vshift
Eigen::MatrixXd Vshift
Shifted selection matrix for the previewed feet positions.
Definition: intermediate-qp-matrices.hh:59
PatternGeneratorJRL::IntermedQPMat::SupportState
const support_state_t & SupportState() const
Definition: intermediate-qp-matrices.hh:123
PatternGeneratorJRL::IntermedQPMat::CoM
const com_t & CoM() const
Definition: intermediate-qp-matrices.hh:113
PatternGeneratorJRL::IntermedQPMat::Objective
const objective_variant_t & Objective(objective_e type) const
Definition: intermediate-qp-matrices.cpp:46
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:73
PatternGeneratorJRL::IntermedQPMat::state_variant_s::Trunk
trunk_t Trunk
TrunkState.
Definition: intermediate-qp-matrices.hh:54
PatternGeneratorJRL::IntermedQPMat::CoM
void CoM(const com_t &CoM)
Definition: intermediate-qp-matrices.hh:114
PatternGeneratorJRL::IntermedQPMat::Trunk
void Trunk(const trunk_t &Trunk)
Definition: intermediate-qp-matrices.hh:117
PatternGeneratorJRL::IntermedQPMat::state_variant_s::VcshiftX
Eigen::VectorXd VcshiftX
Shifted selection matrix multiplied with the current feet position.
Definition: intermediate-qp-matrices.hh:66
PatternGeneratorJRL::IntermedQPMat::state_variant_s::V
Eigen::MatrixXd V
Selection matrix for the previewed feet positions.
Definition: intermediate-qp-matrices.hh:57
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:68
PatternGeneratorJRL::IntermedQPMat::state_variant_s::VcshiftY
Eigen::VectorXd VcshiftY
Definition: intermediate-qp-matrices.hh:66
PatternGeneratorJRL::IntermedQPMat::state_variant_s
Definition: intermediate-qp-matrices.hh:44
PatternGeneratorJRL::IntermedQPMat::Reference
reference_t & Reference()
Definition: intermediate-qp-matrices.hh:120
PatternGeneratorJRL::IntermedQPMat::state_variant_s::CoM
com_t CoM
State of the Center of Mass.
Definition: intermediate-qp-matrices.hh:51
PatternGeneratorJRL::IntermedQPMat::state_variant_s::SupportState
support_state_t SupportState
Current support state.
Definition: intermediate-qp-matrices.hh:72
rigid-body-system.hh
PatternGeneratorJRL::IntermedQPMat::dump_objective
void dump_objective(objective_e type, std::ostream &aos)
Definition: intermediate-qp-matrices.cpp:103
PatternGeneratorJRL::IntermedQPMat::objective_variant_s::dump
void dump(const char *filename) const
Definition: intermediate-qp-matrices.cpp:144
PatternGeneratorJRL::IntermedQPMat::objective_variant_s::weight
double weight
Ponderation.
Definition: intermediate-qp-matrices.hh:81