alexliniger/MPCC

normalized state and input

DreamonZhu opened this issue · 2 comments

Hi alexliniger,

stages_[time_step].cost_mat = normalizeCost(cost_.getCost(track_,xk_nz,time_step));

In this place, you did the normalization for the problem. And I guess it was done by replacig "x'=T_x \times x", "u'=T_u \times u" and "s'=T_s*s".
Then,
State x0_normalized = vectorToState(normalization_param_.T_x_inv*stateToVector(x0));

but here you just dealt with state x while doing nothing with input x and slack variable s? I don't know why?

The first part is normalizing the matrices of the optimization problem and thereby indirectly the optimization variables, the second line is normalizing the "measured" state x0
This function

std::array<OptVariables,N+1> MPC::deNormalizeSolution(const std::array<OptVariables,N+1> &solution)

is then de-normalizing all the variables back to their metric values.

Normalizing the optimization variables is only depending on the matrices and the initial state x0, so I don't have to normalize anything else. But once I get the solution I have to get it back to my normal space.

I hope this helps, otherwise I suggest you just write down all the math for normalizing a QP.

Thanks a lot. I got it.