alexliniger / MPCC

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

Question about discretization #9

Closed herryting closed 5 years ago

herryting commented 5 years ago

Hi! I am trying to implement the MPCC in C++, but I don't understand the discretization part. Where can I find the proof of the discretization method used in the code? Thank you.

alexliniger commented 5 years ago

Hi! I assume you believe me that the matrix exponential is used to do exact zero order hold discretization.

The non-standard part of my discretization is the 'g' part. The derivation is quite simple: It is staightfroward to see that the system \dot{x} = Ax + Bu + g is identical to lifting the state to \hat{x} = [x; u; 1] and then definig a new autonomous sytstem \dot{\hat{x}} = \hat{A} \hat{x} where \hat{A} = [A, B, g; zeros(nu+1,nx+nu+1)]

now you can use the matrix exponential to discretize the resulting system It is basically the same as the standard approach for LTI systems, just that the lifted state has an additional 1 entry.

Best, Alex