I am currently working on autopilot code for a fixed wing UAV
I am using flightgear as a simulator and coding in C# .
I am getting heading value from FG wich I believe is the compass value means my current direction and I calculating the bearing as follow
DX = PointB.x - PointA.x
DY = PointB.y - PointA.y
= atan2(DY, DX)
My question is how to use this data to cntrol my ailerons in order to turn to the right direction of the next waypointplease I am stopped here for almost two months of trying all kind of algorithms without any result please help