Iphone 4 GPS + IMU

From OpenStreetMap Wiki
Jump to navigation Jump to search

Thoughts on getting more accurate OSM mapping data by combining GPS and dead-reckoning position information. The two complement each other - GPS is great for large-scale, long-term absolute position, whereas dead-reckoning is good for small-scale, short-term, independent (no satellite signal required) relative position. Together, they could produce mapping information that is more accurate, reliable and consistent than either method alone.

Where I live there are lots of trees and windy roads (yay!) that result in frequent small GPS aberrations (ugh!). I've tried many GPS devices, settling on various Sirf Star III based USB mice. Even then, using a basic program that reads three of them at once, I've found that they often disagree to a disturbing degree (even after allowing for no WAAS in Australia).

To generate reasonably accurate mapping contributions for OSM, I usually drive a route at least three times. Sounds a little extreme (pedantic is a common accusation), but at least I can sleep at night with a clear conscience without worry of having sent someone up a garden path.

I have been toying for some time with using an inertial measurement system (IMU) / inertial navigation system (INS) to augment the GPS readings. The primary benefits would be that this should: (i) restrict the GPS readings from careering too far away when the signal is patchy, and (ii) fill in the gaps when there is no signal at all (eg, tunnels, under-cover parking, heavy tree canopy, maybe even indoors???).

Sparkfun have a combined "9 DOF" accelerometer/gyroscope/compass module, but I haven't had the time to do any more programming. And I figure that even though I'm willing to buy special equipment to make a decent system for generating OSM map data, most people wouldn't be.


Now the iPhone 4 is out. Hallelujah! It's got it all as standard equipment. And there will be millions of them in circulation. This could be good.


iPhone 4 chips:

GPS = Broadcom BCM4750 (-162 dBm tracking, -157 dBm assisted acquisition, 2 Hz)

Accelerometer = ST LIS331DLH (12 bit, FS 2/4/8 g)

Gyroscope = ST L3G4200D (16 bit, FS 250/500/2000 deg/sec)


My thoughts on augmentation are:

work in progress - feel free to contribute

Mapping data doesn't need to be live - can post-process to fill in the gaps when the GPS signal goes missing or haywire.

When GPS velocity signal is zero (or unchanging?), accelerometers can be reset to zero speed, and orientation of gyroscopes can be determined by direction of gravity acceleration.

IMU generates "relative" movement trace, that can then be used to fill in gaps given start and end GPS coordinates, by transforming the IMU trace so that corresponding start and end regions of IMU and valid GPS traces align.

IMU movement knowledge enables filtering/smoothing of GPS readings even when moving (akin to taking multiple readings when stationary to get a more accurate position).

GPS can be used to calibrate IMU drift (and perhaps scale). Indeed, continuous calibration probably means that IMU thermal calibration (changes in sensor readings due to temperature changes) can be disregarded.

Some study would need to be done of the alignment of the accelerometers and gyroscopes, and the consequent effects on readings and "cross-talk".


I shudder to think of the math involved, but it'd be a wonderful uni project (or thesis topic) for anyone in the GIS field.


I would tend to shy away from using the compass, because of variation due to location and environment (metallic and magnetic, eg car).


Three stages (first two probably easy, third one perhaps less so):


(i) App to display raw GPS, accelerometer and gyroscope readings, perhaps with graphical indication also.


(ii) App to log GPS and IMU data to (prefer CSV) file, and (optionally) email file to designated account for offline study

GPS data should include information to determine validity (number of satellites, signal strength?), velocity, altitude and time.

Both GPS and IMU data should be timestamped using common clock with appropriate resolution.


(iii) App to generate IMU-augmented GPS GPX files, and (optionally) upload files to designated OSM account.

Ideally this app would also be capable of (optionally) recording the raw data as per the second app, just in case.


Extra bonus points: most cars have a OBDII data output that includes vehicle speed (integer km/h), and there are bluetooth readers available that presumably can talk to the iPhone - this could be a useful backup velocity source for when the GPS signal drops out.


I also dream of a navigation program that takes advantage of OSM mapping and enables easy user contribution towards updating OSM mapping, but I'm sure there are already people working on this. I doubt that OSM maps for vehicle navigation will ever be as comprehensive as the commercial maps, but obviously OSM has cost, coverage and currency advantages which for many people would outweigh the niceties such as lane guidance.

Think about it. And if you're game/brave/innocent/ambitious/nuts enough to give it a go, feel free to contact me (emexes).

Cheers.

-)