Lane keeping in autonomous driving with Model Predictive Control & PID

<p>MPC is a process to minimize costs while satisfying a set of constraints.&nbsp;For example, we want to adjust the steering and the speed every 100 ms such that the cost function, defined as the difference between the target trajectory point (the yellow dot) and ours (the green dot), is minimized under the constraint that the wheel cannot be steered more than 25&deg;. In MPC, we read from the sensors to determine the current states of the car like speed. Then we consider possible actions within a short period of time (say 1 sec.) based on these readings. Let&rsquo;s say, we&nbsp;<strong>consider</strong>&nbsp;steering the wheel by 20&deg; clockwise and then reduce it by 1&deg; every 100 ms. Assuming these actions result in the lowest cost at the end of the one second period, we will then apply the first action of stirring the wheel 20&deg;. But instead of performing the remaining actions later, we wait for 100 ms and read the sensors again. With the new readings, we recompute the next optimal action again. MPC makes the next action by taking advantage of viewing the results of a longer future plan (1 sec.). So it is less vulnerable to short-sighted gain in a greedy method and therefore, plan better.</p> <p><a href="https://jonathan-hui.medium.com/lane-keeping-in-autonomous-driving-with-model-predictive-control-50f06e989bc9"><strong>Read More</strong></a></p>