I wrote a rudimentary autopilot in Go that used a Kalman filter to maintain straight and level flight. It was a fun exercise!
https://austinsnerdythings.com/2024/04/06/adding-track-follo...
and the first post in the series -
https://austinsnerdythings.com/2021/10/15/creating-an-autopi...