Loading...
Searching...
No Matches
AnalyticalZMPCOGTrajectory.hh
Go to the documentation of this file.
1/*
2 * Copyright 2008, 2009, 2010,
3 *
4 * Alireza Nakhaei
5 * Olivier Stasse
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 */
28#ifndef _ANALYTICAL_COG_H_
29#define _ANALYTICAL_COG_H_
30
32#include <iostream>
33#include <vector>
34
35namespace PatternGeneratorJRL {
36
42 public:
44 AnalyticalZMPCOGTrajectory(int lNbOfIntervals = 0);
45
48
56 bool ComputeCOM(double t, double &r);
57
65 bool ComputeCOMSpeed(double t, double &r);
66
77 bool ComputeCOM(double t, double &r, int i);
78
89 bool ComputeCOMSpeed(double t, double &r, int i);
90
101 bool ComputeCOMAcceleration(double t, double &r, int j);
102
110 bool ComputeZMP(double t, double &r);
111
119 bool ComputeZMPSpeed(double t, double &r);
120
129 bool ComputeZMP(double t, double &r, int i);
130
135 void SetNumberOfIntervals(unsigned int lNbOfIntervals);
136
139 void SetCoGHyperbolicCoefficients(std::vector<double> &lV,
140 std::vector<double> &lW);
141
143 void SetStartingTimeIntervalsAndHeightVariation(std::vector<double> &lDeltaTj,
144 std::vector<double> &lomegaj);
145
150 void SetPolynomialDegrees(std::vector<unsigned int> &lPolynomialDegree);
151
154 void GetPolynomialDegrees(std::vector<unsigned int> &lPolynomialDegree) const;
155
158 void GetNumberOfIntervals(unsigned int &lNbOfIntervals) const;
159
162 void GetHyperbolicCoefficients(std::vector<double> &lV,
163 std::vector<double> &lW) const;
164
166 void GetStartingPointAndHeightVariation(std::vector<double> &lTj,
167 std::vector<double> &lomegaj);
168
174 bool GetFromListOfCOGPolynomials(unsigned int j, Polynome *&aPoly) const;
175
180 bool GetFromListOfZMPPolynomials(unsigned int j, Polynome *&aPoly) const;
181
188 std::vector<double> &lCOMZ, std::vector<double> &lZMPZ);
189
196 unsigned int IntervalIndex, double &lCOMZ, double &lZMPZ);
197
201 void Building3rdOrderPolynomial(unsigned int anIntervalj, double pjTjm1,
202 double pjTj);
203
208 double FluctuationMaximal();
209
210 friend std::ostream &operator<<(std::ostream &os,
211 const AnalyticalZMPCOGTrajectory &obj);
212
215
217 void SetAbsoluteTimeReference(double anAbsoluteTimeReference) {
218 m_AbsoluteTimeReference = anAbsoluteTimeReference;
219 }
220
222 bool GetIntervalIndexFromTime(double t, unsigned int &j);
223
226 bool GetIntervalIndexFromTime(double t, unsigned int &j,
227 unsigned int &prev_j);
228
229 protected:
232
235 std::vector<double> m_V;
236
239 std::vector<double> m_W;
240
242 std::vector<double> m_DeltaTj;
243
246 std::vector<double> m_omegaj;
247
249 std::vector<double> m_RefTime;
250
252 std::vector<unsigned int> m_PolynomialDegree;
253
255 std::vector<Polynome *> m_ListOfCOGPolynomials;
256
258 std::vector<Polynome *> m_ListOfZMPPolynomials;
259
261 void FreePolynomes();
262
265
266 /* \brien Sensitivity to numerical noise. */
268};
269
270std::ostream &operator<<(std::ostream &os,
271 const AnalyticalZMPCOGTrajectory &obj);
272} // namespace PatternGeneratorJRL
273#endif /* _ANALYTICAL_COG_H_ */
Definition: AnalyticalZMPCOGTrajectory.hh:41
void GetHyperbolicCoefficients(std::vector< double > &lV, std::vector< double > &lW) const
Get the coefficients for the sinuse and cosinues function.
Definition: AnalyticalZMPCOGTrajectory.cpp:311
void SetCoGHyperbolicCoefficients(std::vector< double > &lV, std::vector< double > &lW)
Set the coefficients for the sinuse and cosinues function.
Definition: AnalyticalZMPCOGTrajectory.cpp:259
std::vector< double > m_DeltaTj
Definition: AnalyticalZMPCOGTrajectory.hh:242
std::vector< Polynome * > m_ListOfZMPPolynomials
Definition: AnalyticalZMPCOGTrajectory.hh:258
void TransfertOneIntervalCoefficientsFromCOGTrajectoryToZMPOne(unsigned int IntervalIndex, double &lCOMZ, double &lZMPZ)
Transfert the coefficients from the COG trajectory to the ZMP.
Definition: AnalyticalZMPCOGTrajectory.cpp:346
bool ComputeCOMSpeed(double t, double &r)
Definition: AnalyticalZMPCOGTrajectory.cpp:115
std::vector< double > m_RefTime
Definition: AnalyticalZMPCOGTrajectory.hh:249
void SetAbsoluteTimeReference(double anAbsoluteTimeReference)
Set Absolute time reference of this trajectory.
Definition: AnalyticalZMPCOGTrajectory.hh:217
double m_AbsoluteTimeReference
Definition: AnalyticalZMPCOGTrajectory.hh:264
void SetPolynomialDegrees(std::vector< unsigned int > &lPolynomialDegree)
Set the degree of each polynomials for the CoG Remark: the size of the vector of degrees should match...
Definition: AnalyticalZMPCOGTrajectory.cpp:284
void GetStartingPointAndHeightVariation(std::vector< double > &lTj, std::vector< double > &lomegaj)
Get the starting point and the height variation.
Definition: AnalyticalZMPCOGTrajectory.cpp:317
void GetPolynomialDegrees(std::vector< unsigned int > &lPolynomialDegree) const
Get the degree of each polynomials for the CoG.
Definition: AnalyticalZMPCOGTrajectory.cpp:301
bool GetFromListOfCOGPolynomials(unsigned int j, Polynome *&aPoly) const
Get the polynomial at interval j for the CoG Remark: The call to this function assume that the method...
Definition: AnalyticalZMPCOGTrajectory.cpp:323
std::vector< double > m_V
Definition: AnalyticalZMPCOGTrajectory.hh:235
void GetNumberOfIntervals(unsigned int &lNbOfIntervals) const
Set the number of Intervals for this trajectory.
Definition: AnalyticalZMPCOGTrajectory.cpp:306
bool GetIntervalIndexFromTime(double t, unsigned int &j)
Get the index of the interval according to the time.
Definition: AnalyticalZMPCOGTrajectory.cpp:420
void SetNumberOfIntervals(unsigned int lNbOfIntervals)
Set the number of Intervals for this trajectory.
Definition: AnalyticalZMPCOGTrajectory.cpp:58
void SetStartingTimeIntervalsAndHeightVariation(std::vector< double > &lDeltaTj, std::vector< double > &lomegaj)
Set the starting point and the height variation.
Definition: AnalyticalZMPCOGTrajectory.cpp:265
bool GetFromListOfZMPPolynomials(unsigned int j, Polynome *&aPoly) const
Definition: AnalyticalZMPCOGTrajectory.cpp:334
std::vector< unsigned int > m_PolynomialDegree
Definition: AnalyticalZMPCOGTrajectory.hh:252
void TransfertCoefficientsFromCOGTrajectoryToZMPOne(std::vector< double > &lCOMZ, std::vector< double > &lZMPZ)
Transfert the coefficients from the COG trajectory to the ZMP for all intervals.
Definition: AnalyticalZMPCOGTrajectory.cpp:369
double GetAbsoluteTimeReference() const
Absolute Time reference of this trajectory.
Definition: AnalyticalZMPCOGTrajectory.hh:214
~AnalyticalZMPCOGTrajectory()
Definition: AnalyticalZMPCOGTrajectory.cpp:43
void Building3rdOrderPolynomial(unsigned int anIntervalj, double pjTjm1, double pjTj)
Definition: AnalyticalZMPCOGTrajectory.cpp:379
std::vector< double > m_omegaj
Definition: AnalyticalZMPCOGTrajectory.hh:246
bool ComputeZMP(double t, double &r)
Definition: AnalyticalZMPCOGTrajectory.cpp:183
double m_Sensitivity
Definition: AnalyticalZMPCOGTrajectory.hh:267
friend std::ostream & operator<<(std::ostream &os, const AnalyticalZMPCOGTrajectory &obj)
std::vector< double > m_W
Definition: AnalyticalZMPCOGTrajectory.hh:239
bool ComputeCOM(double t, double &r)
Definition: AnalyticalZMPCOGTrajectory.cpp:77
bool ComputeZMPSpeed(double t, double &r)
Definition: AnalyticalZMPCOGTrajectory.cpp:216
void FreePolynomes()
Definition: AnalyticalZMPCOGTrajectory.cpp:45
std::vector< Polynome * > m_ListOfCOGPolynomials
Definition: AnalyticalZMPCOGTrajectory.hh:255
double FluctuationMaximal()
Returns the maximal fluctuation for the first segment of this trajectory.
Definition: AnalyticalZMPCOGTrajectory.cpp:408
int m_NbOfIntervals
Definition: AnalyticalZMPCOGTrajectory.hh:231
bool ComputeCOMAcceleration(double t, double &r, int j)
Definition: AnalyticalZMPCOGTrajectory.cpp:171
Definition: Polynome.hh:42
\doc Simulate a rigid body
Definition: patterngeneratorinterface.hh:41
std::ostream & operator<<(std::ostream &os, const COMPosition_s &aCp)
Definition: pgtypes.hh:62