What are your CoreLocation best practices? - iphone

I am working on a CoreLocation based application which should show the position of the user on a map.
My current problem is, that the precision of CL is not very good.
I am testing the app in an urban environment, so i am walking through a the streets around our office and see how precise it is. The horizontalAccuracy is usually around 47m - 50m when i am walking, and updates occur randomly between every 10 seconds and 1 minute. The updated position can vary between almost accurate and 20 meters or more off my real position. When i stop and wait for a minute, the position will almost always be correct within a minute, and the precision may rise to 17m.
I have tested this with three iPhone (3G and 3GS) and one iPod Touch(which is less precise).
However, there is a difference in the final usage of the product: The target audience of our product will use it in a rural, open environment without any houses nearby.
Will this improve accuracy?
How accurate can the iPhone get at best in terms of horizontalAccuracy?
Are there any best practices, tips and tricks to improve the precision?

Your problem is not CL, but the urban environment. Buildings block view of the GPS satellites used to calculate location. The more satellites you can see the better the accuracy.
The iPod Touch doesn't have GPS capability and location based solely on WiFi signals it can detect and lookup in an online database. It will probably give poor or no location data when in a rural environment since it depends entirely on nearby WiFi signals.
For more info see:
iphone-gps-performance
iphone GPS Tips and Tricks
The absolute best accuracy you can expect is about 2.5m (8') without WAAS and with SA turned off. You won't get that in an urban environment though, you need a clear sky for that best case accuracy.

Related

Bluetooth LE RSSI for proximity detection iOS

I'll start with the question.
Is the BTLE RSSI a good way to indicate two devices proximity to each other or not? does it only work with small devices like fobs etc?
The Issue:
I am currently looking at making an app that will use BTLE and allow connections based on proximity. In this regard it is much like the demo app that apple show in the Advanced Core Bluetooth keynote (When two devices are almost touching they then connect).
As I understand it the proximity is determined based on the RSSI value when the central discovers the peripheral. When I try this however with two iPads the signal seems too strong for this it is also too inconsistent to have an accurate stab at the proximity as it doesn't show very much correlation to the devices proximity.
I have tried the Apple sample code and that is similar in that the devices don't have to be close at all for the information to pass from one to another.
If only there was a way to reduce the signal strength of the peripheral devices advertisement....
Thanks in advance for any help.
The experience of Matthew Griffin matches mine. However - when we can measure for a fair period of time two things have helped us calibrate this better.
We did have to wrap a simple (kalman) filter on the antenna orientation and the IMU to get a rough running commentary though - and this is not very CPU or battery light.
Using the IMU you get a fair idea of the distance/direction of travel - and if this is over a short period of time - we assume the other 'side' is stationary. This helps a lot to get a value for 'current' orientation and 'callibrate current environment noise.
Likewise - do the same for rotations/position changes.
We've found that in general a re-orientation of the device is a better way to get direction; and that distance is only reliable some up to some 30 to 600 seconds after a 'move' calibration' and only if the device is not too much rotated. And in practice once needs some 4-5 'other' devices; ideally not too mobile, to keep oneself dynamically calibrated.
However the converse is quite reliable - i.e. we know when not to measure. And the net result is that one can fairly well ascertain things like 'at the keyboard' and 'relocated'/moved away through a specific door/openning or direction. Likewise measuring a field by randomly dancing through the room; changing orientation a lot - does work well once the receiver antenna lobes got somewhat worked out after a stationary period.
You are entirely correct about RSSI jumping wildly and randomly. You should retrieve your RSSI values every two seconds (any faster and you get a bunch of errors). Throw out the RSSI values that are more than a ~-40 decibel spike and use an aggregate of the past values before you declare your approximate range to the user.
As for your following statement, you are in luck.
If only there was a way to reduce the signal strength of the
peripheral devices advertisement....
The service you are looking for is called the TX Power Service. Implementing this service on your peripheral will allow you to decrease the transmit power of the device. That way you can throttle down the range that the advertisement data is visible from. We unfortunately do not however, have access to this service on an iOS device. But if you are writing your own firmware for a BLE peripheral, this is the service you want.
I've spent the last week dealing strictly with RSSI, trying to use Wifi and Bluetooth LE sensors for location triangulation and for distance conversion.
Unfortunately, what I have found is that RSSI is just too finicky and unreliable to consistently use to determine distance. In theory, the RSSI and distance behave according to the inverse square law (double the distance, and the RSSI will go down a fixed number of decibels), but in practice the RSSI is affected by uncontrollable factors such as weather (dry weather allows RF fields to travel better) and obstacles (any metal objects or humans in the path from one sensor to another will cause attenuation, and any metal objects closely positioned by one of the sensors will cause gain in the signal strength).
There are ways to try to compensate for this. This paper is one of the best papers I read on how to get accurate results, but the bottom line is that is an unreliable method unless you just want a general idea of where the device is.
If I understand well, you are trying to implement similar functionality that to what seen in the WWDC demo and what apps like Bump implement. For that RSSI will be adequate. Test for appopriate threshold values (e.g. >-30) and you will be fine.

How accurate is the GPS on the iPhone 4?

quick question. How accurate is the GPS on the iPhone 4? I ask because I'm working on an enterprise project for a company, and part 2 of it will deal with iDevice development where I have to determine the position of the user. I'd like to know if the GPS is accurate enough to sense the user moving within rooms because the user will have to "tag" sections of the room as they move about it.
Thanks in advance!
P.S. Pressuming that it won't make much of a difference, but the users will actually end up using the iPads, not iPhones, and more than likely the iPad 2 will be out by the time the entire project is completed. I don't know if the iPad 2 will have a better GPS receiver or not, but at the minimum I should use the iPad/iPhone 4 GPS receiver...
Most buildings will not allow reception of an accurate set of GPS signals (if they can be received at all) indoors. The roof/ceiling/floors above are just too thick. Even a lot of trees overhanging a building will degrade the signal from the GPS satellites.
You might have a chance if all the rooms have very large unobstructed windows with no overhangs, and it's the right time of day for several satellites to be in view out that window.
Outdoors, in the clear, the iPhone 4 GPS seems to be very accurate. Sometimes I can walk around my parked car, and see the blue dot in the Maps app follow me in a circle.
I have done some work with a large location data set. My result set is based on cars driving outside and will therefore be, on average, more accurate than those taken inside (based on line of sight to satellites).
For the 650,704 location updates I used in my tests, I found the average accuracy radius was 246m (91m if your remove >1km outliers). 85.1% of updates had an accuracy of less than 100m. So given that your update will not be as accurate as these, I don't imagine you will have much success tracking indoor location changes.
For a further description of my results.
It is very difficult, and most of the time impossible to obtain a GPS signal inside a building. The type of waves used by the GPS (radio waves) are not powerful enough to go through the structure itself.
A simpler and probably cheaper solution would be to give people maybe tags or cards and install some sort of trnasreceiver in each room.
It seems the original question was "how accurate is the GPS on an iPhone 4", which hasn't exactly been answered yet.
I've done lots of testing with the accuracy of the GPS chips in iPhone 4, iPhone 4s, and iPhone 5, and the most accurate reading allowed seems to be ~5 meters, or ~16 feet when you're outside with clear line of sight to the sky. I'm guessing this is a software limitation imposed by Apple to conserve battery.

Typical time and horizontalAccuracy of iPhone CLLocation in practice

I'm wondering if anybody has done thorough empirical testing of the iPhone's ability to find its location. Obviously the performance and accuracy will depend on the type of area one is in (urban vs suburban vs remote).
Just testing from the Simulator, I get a horizontalAccuracy of < 100 meters (98 meters) in a few seconds. I believe it is because it's using WiFi.
But, for user experience purposes, how fast would it be to get this kind of accuracy using EDGE or GPS (assuming both are available)? Does the timing vary in very dense urban areas vs suburban?
It would be great it there were some empirical results published on this so that apps could modify their user experience accordingly.
The simulator just sends one event with the coordinates of Apple's headquarters after a few minutes delay.
There is a difference in accuracy between models of iPhone, in whether "real" GPS, or wifi triangulation, or cell tower location are being used, as well as issues from sky coverage and the particular satellites in view when GPS is being used, as well as how long you wait.
In practice, the range I've seen is from infinite (or maybe the diameter of the planet) when I'm in an elevator (Faraday cage), to telling me when I walk from the front to the back of my car.

iPhone 4 background location service question

I'm looking into the new background location service options in the iPhone 4 SDK. It allows an app to run in the background and receive location updates from the device.
There are two methods offered. One is a battery intensive mode that continuously gets location updates. The second recommended method sends the app location updates when there has been a "significant location change".
Does anyone know what a significant location change might be? Is a 30 foot walk considered significant, or is a 10 block walk considered significant? I imagine it also depends on the accuracy of the location mechanism being used at the time.
I've recently done some field testing of the new background location service to get an idea of what constitutes a significant location update, what kind of accuracy to expect for the location hits and our general experiences using it.
The results are detailed in a fairly lengthy blog post:
iPhone Background GPS: Accurate to 500 meters, not enough for foot traffic
As Steve Jobs mentioned in the OS 4 introduction, the low power mode uses cell tower triangulation and does not activate GPS unit. Since the iPhone phone module needs to keep a connection to the cell network anyway, there should be no impact on battery life.
Since the precision of a location fix with cell tower triangulation is anywhere between a few dozen meters (in dense city locations) and a few miles, I think 30 ft is not a significant location change. I don't know the specifics, though (and as mentioned by the commenters, the Apple dev forums are the right place to talk about those).

How accurate is the iPhone 3G GPS for measuring Distances between two CLLocation?

In my application the user will hold the iPhone and walk in straight line, iPhone will alert the user every 2 meters to make lux measurements and record them. Is the GPS on the iPhone accurate enough for such task? (given that the place is the runway of the airport and should have clear reception of GPS satellites signals...)
No, you won't get that good a fix. 2m is about the limit of GPS and that usually requires significant time without moving. 10m seems to be what you should be able to get, though I've heard worse and (obviously Ole above) better.
The best reported GPS accuracy I ever got was about 7 m. Why don't you build a simple sample app and test it for yourself? It should only take a few minutes.