A sparse MPC solver for walking motion generation.
smpc_parameters.cpp
Go to the documentation of this file.
1 
7 #include "WMG.h"
8 
9 
11  const unsigned int N,
12  const double hCoM_,
13  const double gravity_)
14 {
15  hCoM = hCoM_;
16  gravity = gravity_;
17 
18  X = new double[SMPC_NUM_VAR*N];
19 
20  T = new double[N];
21  h = new double[N];
22 
23  h0 = hCoM/gravity;
24  for (unsigned int i = 0; i < N; i++)
25  {
26  h[i] = h0;
27  }
28 
29  angle = new double[N];
30  zref_x = new double[N];
31  zref_y = new double[N];
32  fp_x = new double[N];
33  fp_y = new double[N];
34  lb = new double[2*N];
35  ub = new double[2*N];
36 }
37 
38 
39 
41 {
42  if (X != NULL)
43  {
44  delete [] X;
45  X = NULL;
46  }
47 
48  if (T != NULL)
49  {
50  delete T;
51  }
52  if (h != NULL)
53  {
54  delete h;
55  }
56 
57  if (angle != NULL)
58  {
59  delete angle;
60  }
61  if (zref_x != NULL)
62  {
63  delete zref_x;
64  }
65  if (zref_y != NULL)
66  {
67  delete zref_y;
68  }
69  if (fp_x != NULL)
70  {
71  delete fp_x;
72  }
73  if (fp_y != NULL)
74  {
75  delete fp_y;
76  }
77  if (lb != NULL)
78  {
79  delete lb;
80  }
81  if (ub != NULL)
82  {
83  delete ub;
84  }
85 }
double * zref_y
N reference coordinates of ZMP.
Definition: WMG.h:105
double hCoM
Definition: WMG.h:78
#define SMPC_NUM_VAR
Total number of variables.
Definition: smpc_solver.h:28
double * zref_x
N reference coordinates of ZMP.
Definition: WMG.h:104
double * fp_x
Coordinates of N points satisfying constraints,.
Definition: WMG.h:92
double * angle
initial h
Definition: WMG.h:88
double * lb
2*N bounds for coordinates of ZMP position.
Definition: WMG.h:98
double h0
h = hCoM/gravity for each preview step
Definition: WMG.h:85
double * T
Norm of the acceleration due to gravity.
Definition: WMG.h:82
~smpc_parameters()
Default destructor.
smpc_parameters(const unsigned int, const double, const double gravity_=9.81)
Allocate memory and initialize some of the parameters.
double * ub
2*N bounds for coordinates of ZMP position.
Definition: WMG.h:99
double gravity
Height of the CoM.
Definition: WMG.h:80
double * h
Preview sampling time.
Definition: WMG.h:84
double * X
A chunk of memory allocated for solution.
Definition: WMG.h:113
double * fp_y
Coordinates of N points satisfying constraints,.
Definition: WMG.h:93