35 const double *x_coord,
36 const double *y_coord,
37 const double *init_state,
38 const bool tilde_state,
42 double *cur_state = X;
44 init_state[0], init_state[1], init_state[2],
45 init_state[3], init_state[4], init_state[5]};
50 const double *prev_state = X_tilde;
53 for (
int i = 0; i < ppar.N; ++i)
61 double iCpB = 1/(ppar.spar[i].B[0]);
72 double iCpB_CpA[3] = {iCpB, iCpB*ppar.spar[i].A3, iCpB*ppar.spar[i].A6};
76 control[0] = -iCpB_CpA[0]*prev_state[0] - iCpB_CpA[1]*prev_state[1] - iCpB_CpA[2]*prev_state[2] + iCpB*x_coord[i];
77 control[1] = -iCpB_CpA[0]*prev_state[3] - iCpB_CpA[1]*prev_state[4] - iCpB_CpA[2]*prev_state[5] + iCpB*y_coord[i];
79 cur_state[0] = prev_state[0] + ppar.spar[i].A3*prev_state[1] + ppar.spar[i].A6*prev_state[2] + ppar.spar[i].B[0]*control[0];
80 cur_state[1] = prev_state[1] + ppar.spar[i].A3*prev_state[2] + ppar.spar[i].B[1]*control[0];
81 cur_state[2] = prev_state[2] + ppar.spar[i].B[2]*control[0];
82 cur_state[3] = prev_state[3] + ppar.spar[i].A3*prev_state[4] + ppar.spar[i].A6*prev_state[5] + ppar.spar[i].B[0]*control[1];
83 cur_state[4] = prev_state[4] + ppar.spar[i].A3*prev_state[5] + ppar.spar[i].B[1]*control[1];
84 cur_state[5] = prev_state[5] + ppar.spar[i].B[2]*control[1];
#define SMPC_NUM_STATE_VAR
Number of state variables.
void form_init_fp_tilde(const PP &ppar, const double *x_coord, const double *y_coord, const double *init_state, const bool tilde_state, double *X)
Generates an initial feasible point.
#define SMPC_NUM_CONTROL_VAR
Number of control variables.
void orig_to_tilde(const double h, double *state)
Converts state from original variables to X_tilde.