Alasdair Allan, Babilim Light Industries
http://programmingiphonesensors.com/
Magnetometer (it’s not a digital compass!)
- 4th gen iPod Touch doesn’t have magnetometer
- so no outside AR apps without markers
- UIAccelerometer API newly deprecated for CoreMotion in iOS5
- if you want compass heading but not location, then just start up [locationManager startUpdatingHeading]
- you won’t get location updates warning
- however, magnetic north varies across the world
- there’s a big lookup table in the iPhone that can translate the magnetic heading into true north
- so you need actual location to work this out
- watch out for device orientation: magnetometer always reports heading pointing out of top of device
- need to rotate according to device orientation…
- local magnetic anomalies cause a fluctuating magnetic field — which is when it tells you to wave your device around
- Earth’s magnetic pole is a quadrapole, not a bipole — it swaps over every now and then and the north pole goes south
Gyroscope & Accelerometer (CoreMotion)
- iPhone 4 has more bits in its accelerometer sampler
- combining gyroscope and accelerometer provides very accurate device attitude
- if there’s no natural timer in your app, then you may have to use the push API
- otherwise much easier to use pull API
CMMotionManager
should be treated as a singleton (but API allows you to create multiples…)- monitoring does take a lot of CPU, so remember to stop it when you’re finished
- device motion at 100 samples/sec uses 65% of iPhone 4 CPU
- see “Pushing Device Motion” slide
- you can fetch a frame of reference and then work out attitude relative to that
AR Toolkits
- Marker based:
- Location-aware
- doPanic Toolkit
- ARView — available from Programming iOS Sensors
External accessories
- Arduino for iPhone!!!!
- Redpark Breakout Pack for iPhone
- been going through Made for iPhone accreditation for the last 3 years
No comments:
Post a Comment