The “oh, crap” moment in every big project

Geek Culture

So all was going swimmingly in our Lego Autopilot project. While we waited for the prototype gyro sensor, we used a tilt sensor as a stand-in, did the programming and installed the hardware in the plane. Of course we knew we couldn’t use the tilt sensor in flight, because the inertial frame of reference when you’re turning means that it has no idea where "down" really is. But we were sure the gyro would solve this problem.

Wrong.

Turns out that the HiTechnic gyro sensor outputs rate of rotation, but not degrees of rotation, which is what we need to stabilize the plane. And to convert the first to the second involves a totally gnarly process of integrating rate over time with all sorts of corrections necessary to maintain calibration. Remember that gobblygook about "Kalman filters"? Turns out that it’s important! In fact, it turns out that there’s been about a half-century of advanced math research on solving this exact problem, and it’s still a bit of a black art. Meanwhile the standard Mindstorms software doesn’t even support floating-point arithmetic. 

The HiTechnic guys have been great, and they’re considering whether to create a special Mindstorms programming block to do the rate-to-degrees conversion. But it’s a big job and if they can do it, it won’t be soon. So on to plan B.

We’re now going to use a cheap commercial "co-pilot" to keep the plane stable, and just use the Mindstorms to do the navigation. The $70 FMA flight stabilization unit (shown) uses a clever technique of measuring the difference in infrared signature between the earth and the carbon dioxide in the atmosphere to figure out where up and down are, and keeps the plane perpendicular to that vertical axis. We’ll connect that to the ailerons.

Meanwhile the Mindstorms controller will do the GPS waypoint navigation (thanks to a Bluetooth link to a small commercial GPS module) by controlling the rudder. It’s a little untidy—we’ll basically be skidding through turns as the auto-stabilized ailerons fight the rudder—but it should work.  Onward!

Liked it? Take a second to support GeekDad and GeekMom on Patreon!
Become a patron at Patreon!