Compute Heading Error for Vehicle Driving

Hi,
I am working on a car driving application. I need to compute the heading error.
What is the implementation procedure for it.

Research PID controllers.