IT tutorials
 
Mobile
 

Iphone Application : Sensing Orientation and Motion - Understanding iPhone Motion Hardware

11/22/2012 4:03:31 PM
- Free product key for windows 10
- Free Product Key for Microsoft office 365
- Malwarebytes Premium 3.7.1 Serial Keys (LifeTime) 2019
All iOS devices, to date, can sense motion through the use of the accelerometer hardware. This capability was supplemented with a gyroscope in the iPhone 4 and presumably will be expanded to other hardware in the future. To get a better sense for what this means to your applications, let’s review what information each of these pieces of hardware can provide.

Accelerometer

An accelerometer uses a unit of measure called a g, which is short for gravity. 1g is the force pulling down on something resting at sea level on earth (9.8 meters/second2). You don’t normally notice the feeling of 1g (that is until you trip and fall, and then 1g hurts pretty bad). You are familiar with g-forces higher and lower than 1g if you’ve ever ridden on a roller coaster. The pull that pins you to your seat at the bottom of the roller coaster hill is a g-force greater than 1, and the feeling of floating up out of your seat at the top of a hill is negative g-force at work.

By the Way

An accelerometer measures acceleration relative to a free fall—meaning that if you dropped your iPhone into a sustained free fall, say off the Empire State Building, its accelerometer would measure 0g on the way down. (Just trust me; don’t try this out.) The accelerometer of an iPhone sitting in your lap, on the other hand, measures 1g along the axis it is resting on.


The measurement of the 1g pull of earth’s gravity on the device while it’s at rest is how the iPhone accelerometer can be used to measure the orientation of the phone. The accelerometer provides a measurement along three axes, called x, y, and z (see Figure 1).

Figure 1. The three measurable axes.


Depending on how your iPhone is resting, the 1g of gravity will be pulling differently on the three possible axes. If your device is standing straight up on one of its edges or is flat on its back or on its screen, the entire 1g will be measured on one axis. If the device is tilted at an angle, the 1g will be spread across multiple axes (see Figure 2).

Figure 2. The 1g of force on an iPhone at rest.


Gyroscope

Think about what we’ve just learned about the accelerometer hardware. Is there anything it can’t do? It might seem, at first, that using the measurements from the accelerometer we can make a good guess as to what the user is doing, no matter what. Unfortunately, that’s not quite the case.

The accelerometer measures the force of gravity distributed across your iPhone. Imagine, however, that your iPhone is lying face up on a table. We can detect this with the accelerometer, but what we can’t detect is if you start spinning the iPhone around in a rousing game of “spin the bottle... err... iPhone.” The accelerometer will still register the same value regardless of how the phone is spinning.

The same goes for if the iPhone is standing on one of its edges and rotates. The accelerometer can be used only if the iPhone is changing orientation with respect to gravity, but the gyroscope can determine if, in any given orientation, the iPhone is also rotating.

When querying the iPhone’s gyroscope, the hardware will report back with a rotation value along x, y, and z axes. The value is a measurement, in radians, of the speed of rotation along that axis. If you don’t remember your geometry, rotating 2 radians is a complete circle, so a reading of 2 on any of the gyroscope’s 3 axes would indicate that the device is spinning once per second, along that axis, as shown in Figure 3.

Figure 3. A reading of 2.0 from the gyroscope indicates that the iPhone is rotating (spinning in a complete circle) at a rate of one revolution per second.

 
Others
 
- Buyer’s Guide : Android Device (Part 3) - Asus Eee Pad Transformer Prime, Samsung Galaxy Tab 2 10.1, Asus Eee Pad Transformer Infinity
- Buyer’s Guide : Android Device (Part 2) - Sony Tablet S, Acer Iconia Tab A200, Lenovo ThinkPad Tablet
- Buyer’s Guide : Android Device (Part 1) - Google Nexus 7, Samsung Galaxy tab 2 7.0
- Best Mid-Range iPhone Cases
- iWALK Chameleon
- Western Digital My Passport Edge 500GB
- Apple AirPort Express (2012)
- The Life Of An App
- Google Nexus 7 vs. iPad
- Get Fit With Your Android Phone
 
 
Top 10
 
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Finding containers and lists in Visio (part 2) - Wireframes,Legends
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Finding containers and lists in Visio (part 1) - Swimlanes
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Formatting and sizing lists
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Adding shapes to lists
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Sizing containers
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 3) - The Other Properties of a Control
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 2) - The Data Properties of a Control
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 1) - The Format Properties of a Control
- Microsoft Access 2010 : Form Properties and Why Should You Use Them - Working with the Properties Window
- Microsoft Visio 2013 : Using the Organization Chart Wizard with new data
Technology FAQ
- Is possible to just to use a wireless router to extend wireless access to wireless access points?
- Ruby - Insert Struct to MySql
- how to find my Symantec pcAnywhere serial number
- About direct X / Open GL issue
- How to determine eclipse version?
- What SAN cert Exchange 2010 for UM, OA?
- How do I populate a SQL Express table from Excel file?
- code for express check out with Paypal.
- Problem with Templated User Control
- ShellExecute SW_HIDE
programming4us programming4us