@jabbdo
We should share ideas! I suggest that you start with a KK board for $12 including gyros. There's plenty of work to do besides that, why reinvent the wheel? At least you can see how it's supposed to work with your 'copter hardware. My autonomous glider will also have a motor. I fly paragliders for a living so I'm familiar with thermals. I have seen that R/C is far easier to keep up in the same thermals. Especially for ridge soaring. I think that is overly ambitious for cross-country. Instead I will try to optimize my flight time by flying faster during a down draft, and slower when going up, even turning off the motor.
@Peter
This granny likes eggs so thanks! Boundary transitions, wonderful idea! Will update my code. I knew I posted here for a reason. I will listen to you from now on. I need to make some improvements to reduce oscillating and drifting. I'm thinking about your last paragraph. Sounds complicated, I wish it were simpler. Maybe I will come up with something.
I will keep you updated here as my projects progress!