b e s p o k e A R f o r m o b i l e s
SEEING STARS
Using technology to deliver an engaging app to capture meteorite sightings, on Android and iOS
SEEING STARS Using technology to deliver an engaging app to capture - - PowerPoint PPT Presentation
b e s p o k e A R f o r m o b i l e s SEEING STARS Using technology to deliver an engaging app to capture meteorite sightings, on Android and iOS DESERT FIREBALL NETWORK Image credit: DFN 2 HTTP:// BIT.LY/FIREBALLSDL Or search App Store
b e s p o k e A R f o r m o b i l e s
Using technology to deliver an engaging app to capture meteorite sightings, on Android and iOS
2
Image credit: DFN
Or search App Store or Google Play for “Fireballs in the Sky”
3
5
DAVID COLLS Maths nerd @davidcolls AR MATHS BRAD WARD Developer IOS NATHAN JONES Developer @the_nathanjones ANDROID
* Actual number may vary
6
Image credit: National Library of Australia
Words & numbers fall short, so animated recreations were MVP.
Demanded performance beyond the reach of mobile web for the majority of devices.
Developed in parallel.
7
And improved reporting
8
Release 1 Release 2
No desire to license technology Based on sensors not camera image Camera view just black at night Very simple interaction Google Sky only Android Google Sky won’t subordinate
9
The maths guy knew Processing (visualisation IDE) Rapid iteration to demonstrate we could do star maps (highest risk) No dependencies
Porting together to apps felt low risk
10
Just HUD
Fully featured
Stars And planets! Support for tilt
* Guaranteed to contain NO equations
11
12
Where are you standing? Where are you looking? W h e r e a r e t h e s t a r s ? How do we draw this (in a virtual window)? Where in the universe? Where in the sky?
13
8 mins 4 years circle to scale Alpha Centauri
14
Infinitely distant Celestial sphere “Fixed Stars” How do the stars look from the earth’ s surface? HYG Database
19
Celestial sphere Time + Date Sidereal Time + Longitude LOCAL SIDERIAL TIME LATITUDE
Azimuth Elevation
Terrestrial
DRAWING IN A VIRTUAL WINDOW
20
Choose an eye-screen distance Find where the line-of-sight hits the screen Location View direction Known positions Known positions Screen Perspective Projection
WHERE ARE YOU STANDING?
21
GPS satellites Cell towers WiFi access points
API
CLLocationManager LocationManager
DEFINES LOCAL REFERENCE FRAME
22
X - North Y - West Z - Up X - East Y - North Z - Up
23
Device rotation matrix… …with respect to local reference frame Magneto- meters Accelero- meters Gyroscopes
API
CLLocationManager For heading CMMotionManager RefFrameXTrue NorthZVertical SensorManager Register for updates & getOrientation() WindowManager Device default
24
Tilt Elevation Azimuth
Obtained from device rotation matrix
25
Where are you standing? Where are you looking? Where in the universe? Where in the sky? [RA & DECL] (Fixed stars) [Azimuth & Elevation] (LST & Lat) Once per session Device rotation matrix (APIs) Device location (APIs) Once per session Every frame Once per universe*
Sweet, fruity, and objective knowledge
26
IOS INGREDIENTS
CLLocationManager latitude - longitude CMMotionManager azimuth - elevation - tilt
Using CMAttitudeReferenceFrameXTrueNorthZVertical reference frame The API-provided pitch, roll and yaw were not used. Used deviceMotion.attitude.rotationMatrix directly instead Reference frame ‘drifts’ over time, periodic resets resolve this
27
IOS INGREDIENTS
hardware-accelerated vector maths vecLib uses the Advanced SIMD instruction set implemented by NEON on ARMv7 devices 2-10x performance bump over standard
Avoided overhead of classes/GC in calculation code Work well with Accelerate library’s C interface Rendering code is Objective-C
28
IOS INGREDIENTS
CPU-based 2D rendering Minimal development effort with reasonable flexibility Was an expected (and realised) performance bottleneck
performance, at higher development cost. Final performance was good on iPhone5 devices
IOS IMPLEMENTATION
Optimise use of Accelerate library via bulk calculations OpenGLES (eg. Cocos2D or SpriteKit) for rendering Multi-threading Full GPU implementation of star-positioning calculations
30
Developing for the bot with the lot
31
ANDROID INGREDIENTS
SensorManager is the home for all sensors in Android
compass
ANDROID INGREDIENTS
We use a regular SurfaceView We use a Timer targeting 60FPS instead of an explicit thread Draw on a regular 2D Canvas Not hardware accelerated
33
ANDROID IMPLEMENTATION
Optimised vector math libraries not as mature Embrace some functional paradigms
Multi-threading became an option Beware the garbage collector Profile all the things, these are limited resources Many ways to skin a cat with vastly different performance
34
ANDROID - HERE BE DRAGONS
Expect it and deal with it Eligible for installation on 3606 4508 devices Pick a baseline and work out what you are in for Don’t expect the API to be consistent
Lowest and highest target OS versions Lowest and highest screen sizes - resolution and physical size Lowest performance - slow single-core phones Fall back to emulator only for sanity check on look and feel
35
On both Android and iOS
36
Image credit: DFN
TESTING
Performance differs from emulators Sensor data not available in emulators
The acid test for an AR app
37
LOCATION
No wifi or cell towers in the outback
While you find their location
Know the required accuracy, and stop when you have it
Turn off location services on app hide
38
DEVICE ROTATION
Android vs iOS
True North or Magnetic North?
How to filter noise while preserving a responsive signal
39
For questions or suggestions:
brward@thoughtworks.com dcolls@thoughtworks.com