
The physics of making an iPad into an accurate aviation instrument - joshwa
http://www.x-plane.com/adventures/60_so_thats_how_its_done.html
======
joshwa
Yes, Austin Meyer (creator of X-Plane) is a bit of a loon, but if you can see
past the ALL CAPS he does give some pretty good explanations of interesting
aviation-related stuff.

More Austin Meyer goodness:
<http://www.x-plane.com/x-world/austins_adventures/>

Building his own airplane (in incredible detail):
<http://www.x-plane.com/hardware/evo/evo.html>

Incredible in-flight engine failure autoland device:
<http://www.x-plane.com/hardware/evo/9_seeker/Seeker.html>

A rather convincing explanation of why very small jets just don't make sense:
<http://www.x-plane.com/hardware/evo/0_nojet.html>

------
brendn
OK. I'm no expert on this myself, but for someone who claims to have just
figured out how an attitude indicator works, the author certainly doesn't
explain it very well. I was left with the impression that the author is
uncertain of the distinction between an accelerometer and a gyroscope. An
accelerometer, like he says, can be likened to a hanging weight or pendulum.
Accelerometers can measure the direction of gravity of a stationary object
because the only force acting on the pendulum is acceleration due to gravity.
However, as soon as the object is moved, other acceleration vectors are added
to the already-present gravity vector.

(Imagine an accelerometer hanging from a rope. If you swing that rope in a
circle around your head, the accelerometer will report that the force vector
points to its bottom, away from your head, and not down to your feet as
gravity alone would indicate.)

Which gets me to the OP. Because the article does not make a single mention of
angular momentum (among other reasons), I would guess that the author doesn't
understand how gyroscopes work. A gyroscope is essentially a spinning disc-
shaped mass that resists change to its axis of rotation. If you built a
housing that allowed it freedom of motion in three dimensions (called a gimbal
(<http://en.wikipedia.org/wiki/Gimbal)>), it would remain on its original axis
no matter how you tilted its enclosure (barring the inevitable energy loss due
to friction, etc.)

So, in the case of an airplane, you would set the disc spinning on level
ground. Then, while you're flying, any changes to your pitch or roll would be
_around_ the gyroscope (which, remember, is allowed to move freely relative to
the cabin). The gyroscope wants to preserve its angular momentum, so it will
still be spinning on the same axis relative to level ground. Any difference
between the gyro and the cabin therefore indicates the orientation of the
plane relative to the ground.

You'd probably get a more concise explanation from the Wikipedia page on
Gyroscopes (<http://en.wikipedia.org/wiki/Gyroscope>). The Wikipedia page on
attitude indicators (the visual display for a cockpit gyro) is also quite
coherent and less prone to rambling
(<http://en.wikipedia.org/wiki/Attitude_indicator>).

[EDIT: Toned down some grumpiness. I must be tired.]

~~~
quux
Private pilot here. Mechanical attitude indicators don't need to be reset on
level ground, when they first start spinning they're almost always tilted but
once they spin up they level out on their own. Because they're driven by
vacuum from the engine, sometimes they don't fully spin up and level out until
the engine's being run up or takeoff.

I've always wondered how the attitude indicator self levels, and the OP's
explanation sounds plausible. Next time I go flying I'll have to spend a few
minutes in a constant rate turn to see if I can make the attitude indicator
drift like he says it should.

Edit to add, here's a link to a youtube video showing the inner working of an
AI, including the pendulous vanes, neat:

<http://www.youtube.com/watch?v=KUSklh3MKtA>

~~~
brendn
Yeah, I kind of glossed over the vacuum aspect of the attitude indicator
because I don't understand all its intricacies. The video pretty much confirms
my understanding of how the gyro is kept spinning. The original author's
description of air puffs sounds a lot like how the filtered air is ducted in
to the housing and vented off in quadrants. I suspect that has more to do with
maintaining the gyroscopes precession
(<http://en.wikipedia.org/wiki/Precession>) than leveling the gyro in mid-
flight.

I've heard that during prolonged banks or pitches, the AI can eventually find
a different "level" than the true horizon. I'm trying to find more info into
that phenomenon though.

In the mean time, I've found this article that seems to be talking about the
same accuracy and drift issues as the original post, but explains the issues
with more clarity and also includes sensor graphs and code samples:
[http://myahrs.wordpress.com/2012/04/24/turning-errors-
contin...](http://myahrs.wordpress.com/2012/04/24/turning-errors-continued/)

------
daurnimator
Though this is the internet....

Far too many hyperbole. Much of this is straightforward when dealing with GPS
data. And all the shortcomings of relying on gyro data can be found by
searching for dead reckoning systems.

Don't get me wrong, I am very impressed with the x-plane application, but the
writing style assumes a complete idiot.

~~~
quink
I agree. Some paragraphs in I was thinking that the solution is to just
calibrate it when it's on the ground, but was curious what solution he came up
with...

> While on the ground, use the ACCELEROMETERS to see which way is up.

Oh. Yeah, I guess I should have seen that coming.

Still, the more people write this enthusiastically about a topic considered as
"mundane" as this by an average "complete idiot", then I'm all for it.

Because despite the writing style, I could feel the excitement in this, and it
was worth it for that alone.

And it has made me more excited about this topic.

~~~
sosuke
He continues on, saying that [ground calibration] doesn't work for very long
due to errors in the reported rates of change.

------
joezydeco
Put another way, holy crap that was nearly impossible to read.

~~~
michaelkscott
Man, that's exactly how I felt. I think we need a tl;dr for this -- it was
incredibly frustrating.

------
FrojoS
I couldn't read due to the much caps locks. After reading the comments, I
thought I might add a few things.

As others have pointed out, outdoors you would use mostly GPS, and maybe a
camera pointing to the ground to estimate the position. Accelerometer are more
or less worthless when you want to estimate a translational position of a free
flying rigid body. However, orientation can bes estimated very well with the
sensors you find in a smartphone. At least outdoors.

The acceleration gives you the orientation of the earth gravity vector,
assuming that translational acceleration can be neglected. This information
corresponds to pitch and roll in an airplane. The iPad, and most smartphones,
also have a magnetometer (digital compass) which gives you the direction of
the earth magnetic field and which works reasonably well outdoors. You can
combine these two 3D vectors with an iterative algorithm, e.g. QUEST [3] or
Madgwicks AHRS [4] to obtain an estimation of your orientation in quaternions.
No gyroscope required so far. Usually, the gyroscope is only used to give a
more accurate angular velocity and acceleration signal, speed up the
orientation estimation and serve as a short term replacement in case of a
larger disturbance in acceleration or the magnetic field. A Kalman filter is
the most common way to do this.

If you want to play around with these values on your phone I recommend the
Sensor Kinetics [5] app for Android, or if you have an iOS device, I believe
XSens has an app, too. There is usually need to implement the above method
yourself. Most IMU's you can buy of the shelf provide these higher level
estimations already.

[1] <http://en.wikipedia.org/wiki/MEMS_gyroscope#MEMS_gyroscope> [2]
<http://www.apple.com/ipad/specs/> [3] e.g. EXTENDED QUEST ATTITUDE
DETERMINATION FILTERING Mark L. Psiaki 1999
[http://www.google.ch/url?sa=t&rct=j&q=&esrc=s...](http://www.google.ch/url?sa=t&rct=j&q=&esrc=s&source=web&cd=2&ved=0CCkQFjAB&url=http%3A%2F%2Fciteseerx.ist.psu.edu%2Fviewdoc%2Fdownload%3Fdoi%3D10.1.1.151.7265%26rep%3Drep1%26type%3Dpdf&ei=XDVoUJTPI-
P_4QSkqoGwAg&usg=AFQjCNGouU0km_Q-
BeIthUrTnqmaES2ckQ&sig2=LJC_j6hylww0fp3y_pAT-g) [4] Includes working (tested
it myself) Matlab, C and C# code <http://www.x-io.co.uk/node/8> [5]
[https://play.google.com/store/apps/details?id=com.innoventio...](https://play.google.com/store/apps/details?id=com.innoventions.sensorkinetics&hl=en)

------
fotbr
"If anyone thinks that they are revealing new information to me by telling me
the difference between centrifugal force and acceleration, I will fed-ex a
crazed baboon that is high on crack to their house."

I can think of a few people I'd like to see receive a package from fedex
containing a crazed baboon high on crack.

------
josephagoss
He is being sued by Uniloc, I think this is the same suit against Mojang
(Minecraft)

<http://www.x-plane.com/x-world/lawsuit/>

~~~
joshwa
previously: <http://news.ycombinator.com/item?id=4523380>

------
twp
XCSoar is a very nice free and open source flight computer that includes an
artificial horizon. It runs on your Android phone, old PDA, and many other
devices.

<http://xcsoar.org/>
<https://play.google.com/store/apps/details?id=org.xcsoar>

It's designed for sailplane, hang glider and paraglider pilots, and is slowly
disrupting the incumbents in this space. Source code is C++.

------
gpcz
It seems that the author developed the underlying kinematics needed to
implement an inertial measurement unit (src:
<http://en.wikipedia.org/wiki/Inertial_measurement_unit> ), though with his
introduction of GPS, he could probably convert it to an inertial navigation
system (<http://en.wikipedia.org/wiki/Inertial_navigation_system>). I wonder
if the author is aware of the Extended Kalman Filter (src:
<http://en.wikipedia.org/wiki/Extended_Kalman_filter> ) -- he could fuse the
noisy sensor data with the aircraft's kinematic model to cancel out some of
the error he was mentioning getting. The best resource I've found online about
how to use Kalman filters and EKFs is course notes from a simultaneous
localization and mapping workshop taught at Drexel University in 2006 (src:
<http://prism2.mem.drexel.edu/~billgreen/slam/slam.html> ).

------
jnsaff2
There are external GPS receivers specifically to improve iPad GPS performance
in aviation.

For example: <http://www.mygoflight.com/external-gps/>

------
lbraasch
The writer would benefit greatly from the Ardiuno community. Most of this
stuff is open-source code. Quite possibly, some of the authors solutions were
learned from it. However, no credit was issued for where the author learned
most of their lessons.

I do appreciate the layperson's explanation of an attitude system applied to a
smartphone/tablet. Many do not realize just how powerful these mobile devices
actually are.

~~~
kijiki
The Arduino community did not invent the Kalman filter or sensor fusion.

~~~
ChuckMcM
No, but they have aggressively applied them to self balancing robots which
have many of the same issues as the author is dealing with (isolating actual
up vector from acceleration vectors etc)

~~~
fotbr
And they're not the only ones to have done so. Adruinos aren't the be-all and
end-all of embedded systems, and most projects do not need to give them any
credit whatsoever.

------
rg31415
I couldn't make it to the end of the article; the writing style is too
frustrating.

