Is there a way to know which direction one iPhone is from another? - iphone

Presume I have two+ iPhones connected to the same server.
Using the sensors built in the iPhone and any possible calculations based on their information, is there any way to tell which direction one phone is from another?
They would be in the same room, so the fluctuation of GPS would not work very well here.
I've tried to model two points on a graph using only their compass readings, but I do not think this will work alone. I could be wrong though.

You could setup a calibration phase in your program where you start each phone in an exact position, and then using the 6 axis motion continually calculate the exact current position (in all 6 axis). But the longer you run that calculation the further from true position you will be and eventually (given a long enough time) one phone could think it's in canada and the other in Mexico.
So It could work for short term spurts if you do a calibration every time you want to start.
There is also the possibility of bluetooth localization, but that would require at least 3 phones and the sharing of positional data between them. Or you could do wifi location, but that would require the same as the bluetooth.
Long story short if you want inches localization it's not going to happen. If you want yards localization it's possible, but not as usable.

As you already mentioned, GPS does not work very well when used inside buildings. Thus, it is not possible to get the direction, as you don't have two reliable positions.
Indoor localisation should be much easier with iOS7 and location beacons .. but this does not help much now.

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.

distance between two iPhones without using GPS

Is there any way to find the distance between two iPhones without using GPS in iOS??
i am working on finding out the exact distance between two iPhones which are few feet away.
Any suggestion, tutorial/links would be appreciated.
Looking forward for reply...
You could create some sort of sonar type thing. Use bluetooth between the devices to "arrange" a date stamp and emit a sound from one of the devices at the exact time stamp.
On the second device listen for the sound and mark the timestamp that it comes in at.
Then you can work out how long it took to get from one to the other.
I don't know how accurate that would be though.
Or possibly easier would be to emit a sound from one device then when the second device picks it up it re-emits another sound.
Then the first device listens out for the reply and can find the distance between them in time.
The only thing that comes to mind is some sort of audio chirp that you could measure the latency between, but at a few feet apart, I don't know that you'd be able to get the two iPhones synchronized closely enough to be able to take an accurate measurement.
As long as there isn't too much noise, you could pair the devices using bluetooth and use the signal intensity as a measure of distance. This will probably require a lot of trial and error, but I think that without gps it might be your best choice.
You could also go for wifi triangulation if you had enough access points with known locations, but this might be even more inaccurate.

WiFi triangulation on the iPhone

Lets say you have a zoo and you want to create an app which shows you details on each animal whenever you are next to the cage. (just for the sake of this question ... GPS signals are not an option)
If there was a WiFi router next to each cage, are there any methods the iPhone app can use to work out that the phone is nearby? I guess this is WiFi triangulation.
Or are there other methods to do this kind of geolocation without GPS?
The iPhone can detect the intensity of the signal.. So it may be enough having a router inside each cage, with some calculated emission power.
However, if it gets crowded, mapping the routers and comparing intensities of different routers might work.
Nice idea =)
--hiring a guide might also do the job :D
The iPod touch actually uses this kind of triangulation to get the iPod's location, but it requires a lot of data mining and is a lot less precise than GPS.
You could try it though, in a smaller area (like a zoo) it imagine it would be possible: calculate the intensity of the signal from every router and estimate the distance from three of them according to signal strength.
Another option in this specific case would be to offer an app to scan a bar code at every cage and display the animal info.

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.

GPS or triangulation when setting user position on map?

I have been programming an app using the mapkit and the SDK 3.0. Everything works allright except for one detail. I have noticed that when displaying the userlocation I get different user positions on the map dependent of the current network. I have read about this problem and understand that it is common? In my WLAN is the user position correctly displayed. When using the 3G net (T-mobile) the position is some 100 meters away from my actual position. I understand this has to do with the celluar phone net using triangulation and in WLAN is the GPS or WiFi hotspot used. So, to my question. Is there a way to go around this? My app shows positions in a town and also the distance to those positions. It is very obvious and also missleading if the position is false because of the short distances. Is there a way (in code) to set which method to be used for getting the user postion? I have tested all other apps on my iPhone using maps and the problem seem to be the same by all of them. (If someone wants to test my app it is in the app store for free under car2go also other comments are of course interesting)
Thanks in advance!
-loop-
Core Location provides information about the vertical and horizontal accuracy of the location that it is reporting. One should use that accuracy to report to the user if the location is suspect. Google maps does this by increasing the size of the blue circle around the location marker. There are other ways to indicate to the user that the location is suspect, alert boxes, not showing the location if it falls outside of some predetermined accuracy, etc.
See: http://developer.apple.com/iphone/library/documentation/CoreLocation/Reference/CLLocation_Class/CLLocation/CLLocation.html#//apple_ref/occ/instp/CLLocation/horizontalAccuracy
Use an alternate source for your location? Portable GPS units would do the trick.
The real question is how can you correct the data being specified by the 3G triangulation. I wonder if you can do a differential to correct for the 3G's location errors.
1) In a given city, calibrate the 3G location errors by plotting the city. This could be corrected by the 3G networks at any time, so you'd have to have a way to verify and re-calibrate.
2) Calibrate the 3G network's location using a known location - a 3G location along with a GPS location. Take that as a differential that can be applied to other 3G locations. This assumes a consistent offset in the triangulation calculation which probably isn't the reality.
3) Wait for the 3G networks to fix it and do nothing in the meantime.
4) Provide the 3G network provider with error information in their triangulation and see if it is a priority for them.
I can't think of any other viable options...
Perhaps you can use CoreLocation directly. CLLocationManager gives you CLLocation objects than include their accuracy. If you get an accuracy below 50 meters, it the location probably came from GPS.