alexliniger / MPCC

Model Predictive Contouring Controller (MPCC) for Autonomous Racing
Apache License 2.0
1.34k stars 371 forks source link

Passing in state of 0s into solveMPC() #63

Closed kheng-yu closed 3 years ago

kheng-yu commented 3 years ago

Hi Alex, just wondering about this line in the fullsize branch, specifically on the (x0 - 1.0*x0) term. Doesn't this just make all the states 0?

https://github.com/alexliniger/MPCC/blob/302e12a0546221963dc2430477e54a279532c52d/C%2B%2B/MPC/mpc.cpp#L238

And why does it work even though every single state that is passed into solveMPC() is 0?

alexliniger commented 3 years ago

The fullsize branch uses a proper SQP formulation where the optimization variable is the difference to the linearization point. Thus, at the zero time step where the linearization point is the measurement x0, instead of having a constraint that the state should be identical to the measured state, we need a constraint the the first "differential state" optimization variable is zero. If i find time i will update the readme. Best, Alex