Holds heading for any craft reliably and smoothly, at least for planes. Probably works with boats/cars too, might take some fiddling of the PID, comment if you have any issues.
For the longest time I wanted a working heading holder that could handle the south flip, where the compass goes from .5 straight to -.5. And also a heading holder that isn't trash. This is that, finally made, took way too long to figure out.
The solution was to use two compasses, forward is used when it's above 270 degrees or below 90, and that compass is also locked for the process variable in the PID if you're worried. Back compass is used from 90 to 270. So essentially the only way you could break this MC is if you flip the entire craft around at least 90 degrees, although at that point you probably have bigger issues.
If you'd like to use this in a creation just link.