A sparse MPC solver for walking motion generation.
as_problem_param.cpp
Go to the documentation of this file.
1 
9 /****************************************
10  * INCLUDES
11  ****************************************/
12 
13 #include "as_problem_param.h"
14 
15 /****************************************
16  * FUNCTIONS
17  ****************************************/
18 namespace AS
19 {
21  const int N_,
22  const double gain_position,
23  const double gain_velocity,
24  const double gain_acceleration,
25  const double gain_jerk)
26  {
27  N = N_;
28 
29  i2Q[0] = 1/(2*(gain_position/2));
30  i2Q[1] = 1/(2*(gain_velocity/2));
31  i2Q[2] = 1/(2*(gain_acceleration/2));
32 
33  i2P = 1/(2 * (gain_jerk/2));
34 
35  spar = new state_parameters[N];
36  }
37 
38 
39 
41  {
42  if (spar != NULL)
43  delete [] spar;
44  }
45 
46 
47 
54  const double* T_,
55  const double* h_,
56  const double h_initial_)
57  {
58  h_initial = h_initial_;
59 
60  for (int i = 0; i < N; i++)
61  {
62  if (i == 0)
63  {
64  spar[i].A6 = T_[i]*T_[i]/2 - (h_[0] - h_initial);
65  }
66  else
67  {
68  spar[i].A6 = T_[i]*T_[i]/2 - (h_[i] - h_[i-1]);
69  }
70 
71  spar[i].T = T_[i];
72  spar[i].h = h_[i];
73 
74  spar[i].B[2] = T_[i];
75  spar[i].B[1] = T_[i]*T_[i]/2;
76  spar[i].B[0] = spar[i].B[1]*T_[i]/3 - h_[i]*T_[i];
77 
78  spar[i].A3 = T_[i];
79  }
80  }
81 }
void set_state_parameters(const double *, const double *, const double)
Initializes quadratic problem.
problem_parameters(const int, const double, const double, const double, const double)
state_parameters * spar
double h_initial
Height of the CoM at initial state divided by the gravity, this initial state precede the first state...