This project is part of the Udacity Self-Driving Car Engineer Nanodegree Program. The project base code can be found under https://github.com/udacity/CarND-MPC-Project. The program interacts with a simulator that can be downloaded at https://github.com/udacity/self-driving-car-sim/releases -> Term 2 simulator.
In this project, the task was to implement a Controller based on a more complex vehicle model. The model includes a state with 6 variables:
Solving the model is an optimization task in which a cost function is minimized under given constraints. The constraints are given as the current state of the vehicle in timestep
with
The cross track error at time 0 is given by the difference of the vehicle's position (defined in vehicle coordinates as 0) and the current waypoint path, which is the evaluation of the polynomial fitting at position 0, or coeffs[0].
The model evaluates N timesteps of each dt seconds into the future (total prediction timeframe: N*dt) to minimize the cost function that as best as possible matches the given waypoint. This ensures that, unlike a PID controller, not only the next command is optimized, but the next command is executed in a way so as to minimize the error N timesteps in the future. Because errors accumulate, I have chosen a relatively short period of 10 timesteps of each 100ms, or a total of 1s prediction into the future.
Regarding the waypoints, the points are given in map coordinates, but need to be handed to the simulator in vehicle coordinates to be displayed correctly, which also greatly simplifies the model calculations, because the CTE calculation from the vehicle perspective is much simpler: it only involves the deviation in
In the time of the latency, the vehicle travels with velocity v further in x direction. Since
See the Udacity starter code page https://github.com/udacity/CarND-MPC-Project#dependencies