2

I wrote an app which displays pitch and roll attitude (a glass cockpit app). When I rotate or tilt the iPhone/iPad the attitude is displayed accurately. When I'm flying in an airplane and rotate or tilt the device it also displays accurately. Now, when I hold the device against the panel and roll the airplane, the attitude does not change accurately - it doesn't move at all. This is strange behavior to me and I wonder if it has something to do with the accelerations of the airplane affecting the output of the gyro in the device.

Any insight is appreciated.

codiac
  • 71
  • 8
  • 1
    Are you using the gyros (iPhone4) to measure roll rate or are you just displaying roll (bank) angle based on the accelerometers? – progrmr Sep 22 '11 at 03:35
  • I'm using the roll received by the device motion attitude property which is generated by the device motion framework. It's not well documented exactly where the data comes from. Device motion says it uses all available data and it treats this data to provide a smooth (little noise) roll curve. Same for pitch and yaw. I don't know if Apple uses the accelerometers along with the gyro data and then applies a Kalman filter among other treatments to obtain the roll data that it gives the programmer. – codiac Oct 24 '11 at 02:31
  • I added code in my app to stream all the sensor data to a file on the iPhone. Sitting at my desk, if I rotate the iPhone to the right at a 30 degree angle of bank for 10 seconds and then back to level and into a left turn at 30 degrees, when I look at the graphs of the data, the roll graph shows exactly what I did - smooth line from 0 to 30 degrees then back to -30 and back to level. In an airplane, the same behavior is shown if I rotate the iPhone by hand, but if I hold it against the panel and let the airplane roll it, odd behavior emerges. See next comment. – codiac Oct 24 '11 at 02:47
  • Continuing from the comment above, in the airplane the iPhone doesn't show the bank angles as the plane produced them. Instead, it shows erratic data hovering around 0 angle of bank. The roll data shows the same. The raw gyro data backs up the roll data by showing appropriate rotation rate changes for the erratic roll behavior. In short, the data coming from the sensors does not reflect the actual orientation change of the device when the airplane does the rolling. If I remove the device from the panel and rotate it in front of me by hand while flying, it shows appropriate roll behavior. – codiac Oct 24 '11 at 02:52
  • If anyone can point me in the correct direction it may help that I have stored ALL the sensor data including all accelerometer data, raw gyro data along with all the device motion data (attitude, quaternions, rotation matrices, gravity acceleration, user acceleration, rotation rate, etc.) I also tested a few other glass cockpit apps and they behaved similarly to mine although a couple others seemed to be somewhat more accurate (rolled roughly in the correct direction at the appropriate times). – codiac Oct 24 '11 at 03:03

1 Answers1

0

Randy, a roll is a one-G maneuver, right? So there is no acceleration for the accelerometer in the phone to sense.

Watch Bob Hoover roll his Shrike while pouring a glass of iced tea from a pitcher.

Sky Kelsey
  • 19,192
  • 5
  • 36
  • 77
  • Thanks Sky. I'm also a pilot and understand the aerodynamics involved. I'm not speaking of an "aileron roll" or a "barrel roll" or any of the aerobatic rolls. I'm only looking at a simple level turning maneuver with say a 30 degree bank. Strictly speaking, this is an acceleration since the vector is changing but more importantly the g-vector is no longer totally pointed toward the earth but is instead pointed toward the seat in the airplane and there's a user acceleration involved. I just don't know if any of this affects the instruments in the iPhone adversely (whether by design or not). – codiac Oct 24 '11 at 02:39
  • Also, see comments written with the question above. Thanks. – codiac Oct 24 '11 at 02:53
  • Sky, I've seen Bob Hoover roll his Shrike many times in person at various airshows. Quite impressive, huh? I'm gathering more data in the airplane today. I'll let you know what happens. – codiac Oct 24 '11 at 03:07
  • Randy, that's cool you got to see him live. My impression of a level coordinated turn is that the plane rolls as it turns, and so the force vector is always pointing straight up from the floor. In fact, this is why you can't trust your senses when flying without visual reference. I bet it you slipped or skidded the plane, you would see the expected roll recorded in the phone. Unless the phone has a gyro in it, it's not going to be able to tell if you are banked while in a coordinated turn. – Sky Kelsey Oct 24 '11 at 06:47
  • And if I'm completely wrong, one other thought. There is a lot of vibration on the dash of a single engine piston plane. Could this be interfering? – Sky Kelsey Oct 24 '11 at 06:47
  • The iPhone 4 and 4S have gyros, previously they only had accelerometers. In any *coordinated* turn you should NOT see any bank angle from the accelerometers because the acceleration vector is straight up/down. With a 4 or 4S though the gyros should detect roll rate but I've never tried to use that data so I'm not sure what the API gives you. – progrmr Oct 24 '11 at 11:56
  • Actually it appears that [this API](http://developer.apple.com/library/IOS/#documentation/CoreMotion/Reference/CMGyroData_Class/Reference/Reference.html#//apple_ref/occ/cl/CMGyroData) gives you rotation *rate*. So it seems to me you would need to apply that to your current attitude to get the new attitude. ie: if the gyro says you rolled 10 degrees/sec and you get that measurement for 2 seconds, then you need to change your attitude display by 20 degrees. – progrmr Oct 24 '11 at 12:03
  • 1
    I submitted a TSI with Apple Developer Support and have received a preliminary reply. They said that probably the centripetal force of the turn is affecting their device motion attitude tracking algorithms, giving inaccurate results. I'm in the middle of a conversation with them to search for solutions. I'll post what I find. – codiac Oct 30 '11 at 04:40