pgtypes.hh 4.97 KB
Newer Older
Thomas Moulard's avatar
Thomas Moulard committed
1
/*
2
 * Copyright 2007, 2008, 2009, 2010,
Thomas Moulard's avatar
Thomas Moulard committed
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
 *
 * Mehdi    Benallegue
 * Andrei   Herdt
 * Francois Keith
 * Olivier  Stasse
 *
 * JRL, CNRS/AIST
 *
 * This file is part of walkGenJrl.
 * walkGenJrl is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * walkGenJrl is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Lesser Public License for more details.
 * You should have received a copy of the GNU Lesser General Public License
 * along with walkGenJrl.  If not, see <http://www.gnu.org/licenses/>.
 *
24
 *  Research carried out within the scope of the
Thomas Moulard's avatar
Thomas Moulard committed
25
26
27
 *  Joint Japanese-French Robotics Laboratory (JRL)
 */
/*! \file PGTypes.h
Olivier Stasse's avatar
Olivier Stasse committed
28
  \brief Defines basic types for the Humanoid Walking Pattern Generator.
Thomas Moulard's avatar
Thomas Moulard committed
29
30
31
32
33
34
*/
#ifndef _PATTERN_GENERATOR_TYPES_H_
#define  _PATTERN_GENERATOR_TYPES_H_

// For Windows compatibility.
#if defined (WIN32)
Francois Keith's avatar
Francois Keith committed
35
#  ifdef jrl_walkgen_EXPORTS
Thomas Moulard's avatar
Thomas Moulard committed
36
#    define WALK_GEN_JRL_EXPORT __declspec(dllexport)
37
#  else
Thomas Moulard's avatar
Thomas Moulard committed
38
#    define WALK_GEN_JRL_EXPORT __declspec(dllimport)
39
#  endif
Thomas Moulard's avatar
Thomas Moulard committed
40
41
42
43
#else
#  define WALK_GEN_JRL_EXPORT
#endif

44
#include <jrl/mal/matrixabstractlayer.hh>
Thomas Moulard's avatar
Thomas Moulard committed
45
46
47
48
49

namespace PatternGeneratorJRL
{
  struct COMState_s;

50
  /// Structure to store the COM position computed by the preview control.
Thomas Moulard's avatar
Thomas Moulard committed
51
52
  struct WALK_GEN_JRL_EXPORT COMPosition_s
  {
53
54
    double x[3],y[3];
    double z[3];
Thomas Moulard's avatar
Thomas Moulard committed
55
56
    double yaw; // aka theta
    double pitch; // aka omega
57
58
    double roll; // aka hip

Thomas Moulard's avatar
Thomas Moulard committed
59
    struct COMPosition_s & operator=(const COMState_s &aCS);
60

Thomas Moulard's avatar
Thomas Moulard committed
61
62
63
64
65
66
67
68
69
70
71
72
  };

  typedef struct COMPosition_s COMPosition;
  typedef struct COMPosition_s WaistState;

  /// Structure to store the COM state computed by the preview control.
  struct WALK_GEN_JRL_EXPORT COMState_s
  {
    double x[3],y[3],z[3];
    double yaw[3]; // aka theta
    double pitch[3]; // aka omega
    double roll[3]; // aka hip
73

Thomas Moulard's avatar
Thomas Moulard committed
74
    struct COMState_s & operator=(const COMPosition_s &aCS);
75
76

    void reset();
Thomas Moulard's avatar
Thomas Moulard committed
77
78
79
80
81

    COMState_s();
  };

  typedef struct COMState_s COMState;
82
83

  /** Structure to store each foot position when the user is specifying
Thomas Moulard's avatar
Thomas Moulard committed
84
85
      a sequence of relative positions. */
  struct RelativeFootPosition_s
86
  {
Thomas Moulard's avatar
Thomas Moulard committed
87
    double sx,sy,theta;
olivier-stasse's avatar
olivier-stasse committed
88
89
    double SStime;
    double DStime;
Thomas Moulard's avatar
Thomas Moulard committed
90
91
    int stepType;     //1:normal walking 2:one step before opbstacle
                      //3:first leg over obstacle 4:second leg over obstacle 5:one step after obstacle
92
    double DeviationHipHeight;
Olivier Stasse's avatar
Olivier Stasse committed
93
  };
Thomas Moulard's avatar
Thomas Moulard committed
94
95
96
97
98
  typedef struct RelativeFootPosition_s RelativeFootPosition;

  /** Structure to store each of the ZMP value, with a given
      direction at a certain time. */
  struct ZMPPosition_s
99
  {
Thomas Moulard's avatar
Thomas Moulard committed
100
101
102
103
104
    double px,py,pz;
    double theta;//For COM
    double time;
    int stepType;     //1:normal walking 2:one step before opbstacle
                      //3:first leg over obstacle 4:second leg over obstacle 5:one step after obstacle
Olivier Stasse's avatar
Olivier Stasse committed
105
106
    //+10 if duoble support phase
    //*(-1) if right foot stance else left foot stance
Thomas Moulard's avatar
Thomas Moulard committed
107
108
109
110
111
112
  };
  typedef struct ZMPPosition_s ZMPPosition;

  //TODO 0: FootAbsolutePosition_t does not contain the acceleration
  /// Structure to store the absolute foot position.
  struct FootAbsolutePosition_t
113
  {
Thomas Moulard's avatar
Thomas Moulard committed
114
    /*! px, py in meters, theta in DEGREES. */
115
    double x,y,z, theta, omega, omega2;
Thomas Moulard's avatar
Thomas Moulard committed
116
    /*! Speed of the foot. */
117
    double dx,dy,dz, dtheta, domega, domega2;
Thomas Moulard's avatar
Thomas Moulard committed
118
119
120
121
122
123
    /*! Time at which this position should be reached. */
    double time;
    /*! 1:normal walking 2:one step before opbstacle
      3:first leg over obstacle 4:second leg over obstacle 5:one step after obstacle
      +10 if double support phase
      (-1) if support foot  */
124
    int stepType;
Thomas Moulard's avatar
Thomas Moulard committed
125
126
127
128
129
130
131
132
133
134
135
136
  };
  typedef struct FootAbsolutePosition_t FootAbsolutePosition;

  // Linear constraint.
  struct LinearConstraintInequality_s
  {
    MAL_MATRIX(A,double);
    MAL_MATRIX(B,double);
    MAL_VECTOR(Center,double);
    std::vector<int> SimilarConstraints;
    double StartingTime, EndingTime;
  };
137
  typedef struct LinearConstraintInequality_s
Thomas Moulard's avatar
Thomas Moulard committed
138
    LinearConstraintInequality_t;
139

140
141
142
143
144
145
146
147
148
  /// Linear constraints with variable feet placement.
  struct LinearConstraintInequalityFreeFeet_s
  {
    MAL_MATRIX(D,double);
    MAL_MATRIX(Dc,double);
    int StepNumber;
  };
  typedef struct LinearConstraintInequalityFreeFeet_s
    LinearConstraintInequalityFreeFeet_t;
Thomas Moulard's avatar
Thomas Moulard committed
149

150
151
152
153
154
155
156
157
158
  //State of the feet on the ground
  struct SupportFeet_s
  {
    double x,y,theta,StartTime;
    int SupportFoot;
  };
  typedef struct SupportFeet_s
    SupportFeet_t;

olivier-stasse's avatar
olivier-stasse committed
159
  /// Structure to store the absolute reference.
160
161
  struct ReferenceAbsoluteVelocity_t
  {
olivier-stasse's avatar
olivier-stasse committed
162
163
    /*! m/sec or degrees/sec */
    double x,y,z, dYaw;
164

olivier-stasse's avatar
olivier-stasse committed
165
166
167
168
    /*! reference values for the whole preview window */
    MAL_VECTOR(RefVectorX,double);
    MAL_VECTOR(RefVectorY,double);
    MAL_VECTOR(RefVectorTheta,double);
169
170
171
  };
  typedef struct ReferenceAbsoluteVelocity_t ReferenceAbsoluteVelocity;

olivier-stasse's avatar
olivier-stasse committed
172
}
Thomas Moulard's avatar
Thomas Moulard committed
173
#endif