I played for a while with the maps framework from the iphone os sdk and the routemap api from cloudmade and it was fairly easy to display the current location and other information on a map by using the data provided by the GPS.
I have the map of a building(airport, mall etc) transformed in tiles of some sort, my question is what would be the best approach to obtain the current position of a phone inside a building? I know that GPS is not accurate inside buildings or might not work at all.
Unless you have a strange sort of building (i.e. radio transparent roof), you will not get a GPS signal inside the building, unless you are close to a window, which there are usually very few of (in a mall anyway).
You will not get useful positional information from cell triangulation (not at mall/airport terminal scale anyway).
I'm afraid I can't see any way to do what you are trying.
EDIT: come to think of it, some malls do have a glass roof, so it might be possible to get a GPS fix in some places. And some small airport terminals have big glass walls, although you'd be unlikely to want a map if they were very small.
If you are able to install a few WiFi nodes inside a building, you can get your location inside this building with Navizon's Indoor Positioning System.
They have a demonstration video of their indoor navigation solution on an iPhone.
Since you can't use GPS or Cell towers, you'll need some other sort of RF sources, that have known positions (as GPS and Cell Towers do) Perhaps that's what you're targeting anyway, something like a mall or airport with a number of WiFi routers in known locations, that you could "ping" off. It's not that simple of course --- an interesting research paper on such a service is at Microsoft Research: In fact they write about possible applications such as malls or airports.
Indoor Atlas maps magnetic fields in buildings and then uses smartphone magnetometer data to geolocate indoor locations to within 2 meters. It's based on the fact that buildings have predictable magnetic fields due to the materials they are constructed with. It's the best solution I've seen for this. You can try it for free as see if they've mapped the particular buildings you're trying to geolocate inside of. Another solution I've seen requires bluetooth devices within the building to assist with the geolocation, not as good because of the infrastructure requirements.
Related
I want to create a small app using flutter that tracks my location inside my 100x100m apartment. I am interested in creating an indoor navigation app for various places, but at the moment, I lack the knowledge on how to accomplish it, therefore setting the scope of the app to be very small and very local for testing purposes.
From what I could gather, there is three primary technology to use BLE(Bluetooth Low Energy),Wi-Fiand UWB(Ultra-wideband). I am planning to useWi-Fi as it seems to be the most straight forward way, but I could be wrong on this matter.
The issue is that I don't know where to start learning about this or what kind of tools I would need to create the map for the house. If anyone could point me in the right direction, I would be very happy and appreciative.
I imagine you would use use beacons placed at known positions and use RSSI as analogue to distance and do something similar to GPS where you draw spheres around each beacon and where it all intersects is where your device is.
There's quite a few research papers if you search indoor localization using rssi measurements
What is the best way, if any, to use Apple's new ARKit with multiple users/devices?
It seems that each devices gets its own scene understanding individually. My best guess so far is to use raw features points positions and try to match them across devices to glue together the different points of views since ARKit doesn't offer any absolute referential reference.
===Edit1, Things I've tried===
1) Feature points
I've played around and with the exposed raw features points and I'm now convinced that in their current state they are a dead end:
they are not raw feature points, they only expose positions but none of the attributes typically found in tracked feature points
their instantiation doesn't carry over from frame to frame, nor are the positions exactly the same
it often happens that reported feature points change by a lot when the camera input is almost not changing, with either a lot appearing or disappearing.
So overall I think it's unreasonable to try to use them in some meaningful way, not being able to make any kind of good point matching within one device, let alone several.
Alternative would to implement my own feature point detection and matching, but that'd be more replacing ARKit than leveraging it.
2) QR code
As #Rickster suggested, I've also tried identifying an easily identifiable object like a QR code and getting the relative referential change from that fixed point (see this question) It's a bit difficult and implied me using some openCV to estimate camera pose. But more importantly very limiting
As some newer answers have added, multiuser AR is a headline feature of ARKit 2 (aka ARKit on iOS 12). The WWDC18 talk on ARKit 2 has a nice overview, and Apple has two developer sample code projects to help you get started: a basic example that just gets 2+ devices into a shared experience, and SwiftShot, a real multiplayer game built for AR.
The major points:
ARWorldMap wraps up everything ARKit knows about the local environment into a serializable object, so you can save it for later or send it to another device. In the latter case, "relocalizing" to a world map saved by another device in the same local environment gives both devices the same frame of reference (world coordinate system).
Use the networking technology of your choice to send the ARWorldMap between devices: AirDrop, cloud shares, carrier pigeon, etc all work, but Apple's Multipeer Connectivity framework is one good, easy, and secure option, so it's what Apple uses in their example projects.
All of this gives you only the basis for creating a shared experience — multiple copies on your app on multiple devices all using a world coordinate system that lines up with the same real-world environment. That's all you need to get multiple users experiencing the same static AR content, but if you want them to interact in AR, you'll need to use your favorite networking technology some more.
Apple's basic multiuser AR demo shows encoding an ARAnchor
and sending it to peers, so that one user can tap to place a 3D
model in the world and all others can see it. The SwiftShot game example builds a whole networking protocol so that all users get the same gameplay actions (like firing slingshots at each other) and synchronized physics results (like blocks falling down after being struck). Both use Multipeer Connectivity.
(BTW, the second and third points above are where you get the "2 to 6" figure from #andy's answer — there's no limit on the ARKit side, because ARKit has no idea how many people may have received the world map you saved. However, Multipeer Connectivity has an 8 peer limit. And whatever game / app / experience you build on top of this may have latency / performance scaling issues as you add more peers, but that depends on your technology and design.)
Original answer below for historical interest...
This seems to be an area of active research in the iOS developer community — I met several teams trying to figure it out at WWDC last week, and nobody had even begun to crack it yet. So I'm not sure there's a "best way" yet, if even a feasible way at all.
Feature points are positioned relative to the session, and aren't individually identified, so I'd imagine correlating them between multiple users would be tricky.
The session alignment mode gravityAndHeading might prove helpful: that fixes all the directions to a (presumed/estimated to be) absolute reference frame, but positions are still relative to where the device was when the session started. If you could find a way to relate that position to something absolute — a lat/long, or an iBeacon maybe — and do so reliably, with enough precision... Well, then you'd not only have a reference frame that could be shared by multiple users, you'd also have the main ingredients for location based AR. (You know, like a floating virtual arrow that says turn right there to get to Gate A113 at the airport, or whatever.)
Another avenue I've heard discussed is image analysis. If you could place some real markers — easily machine recognizable things like QR codes — in view of multiple users, you could maybe use some form of object recognition or tracking (a ML model, perhaps?) to precisely identify the markers' positions and orientations relative to each user, and work back from there to calculate a shared frame of reference. Dunno how feasible that might be. (But if you go that route, or similar, note that ARKit exposes a pixel buffer for each captured camera frame.)
Good luck!
Now, after releasing ARKit 2.0 at WWDC 2018, it's possible to make games for 2....6 users.
For this, you need to use ARWorldMap class. By saving world maps and using them to start new sessions, your iOS application can now add new Augmented Reality capabilities: multiuser and persistent AR experiences.
AR Multiuser experiences. Now you may create a shared frame of a reference by sending archived ARWorldMap objects to a nearby iPhone or iPad. With several devices simultaneously tracking the same world map, you may build an experience where all users (up to 6) can share and see the same virtual 3D content (use Pixar's USDZ file format for 3D in Xcode 10+ and iOS 12+).
session.getCurrentWorldMap { worldMap, error in
guard let worldMap = worldMap else {
showAlert(error)
return
}
}
let configuration = ARWorldTrackingConfiguration()
configuration.initialWorldMap = worldMap
session.run(configuration)
AR Persistent experiences. If you save a world map and then your iOS application becomes inactive, you can easily restore it in the next launch of app and in the same physical environment. You can use ARAnchors from the resumed world map to place the same virtual 3D content (in USDZ or DAE format) at the same positions from the previous saved session.
Not bulletproof answers more like workarounds but maybe you'll find these helpful.
All assume the players are in the same place.
DIY ARKit sets up it's world coordinate system quickly after the AR session has been started. So if you can have all players, one after another, put and align their devices to the same physical location and let them start the session there, there you go. Imagine the inside edges of an L square ruler fixed to whatever available. Or any flat surface with a hole: hold phone agains surface looking through the hole with camera, (re)init session.
Medium Save the player aligning phone manually, instead detect a real world marker with image analysis just like #Rickster described.
Involved Train an Core ML model to recognize iPhones and iPads and their camera location. Like it's done with human face and eyes. Aggregate data on a server, then turn off ML to save power. Note: make sure your model is cover-proof. :)
I'm in the process of updating my game controller framework (https://github.com/robreuss/VirtualGameController) to support a shared controller capability, so all devices would receive input from the control elements on the screens of all devices. The purpose of this enhancement is to support ARKit-based multiplayer functionality. I'm assuming developers will use the first approach mentioned by diviaki, where the general positioning of the virtual space is defined by starting the session on each device from a common point in physical space, a shared reference, and specifically I have in mind being on opposite sides of a table. All the devices would launch the game at the same time and utilize a common coordinate space relative to physical size, and using the inputs from all the controllers, the game would remain theoretically in sync on all devices. Still testing. The obvious potential problem is latency or disruption in the network and the sync falls apart, and it would be difficult to recover except by restarting the game. The approach and framework may work for some types of games fairly well - for example, straightforward arcade-style games, but certainly not for many others - for example, any game with significant randomness that cannot be coordinated across devices.
This is a hugely difficult problem - the most prominent startup that is working on it is 6D.ai.
"Multiplayer AR" is the same problem as persistent SLAM, where you need to position yourself in a map that you may not have built yourself. It is the problem that most self driving car companies are actively working on.
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.
hai
Can we know current location without using gps? Is it possible?
The iPhone SDK has a framework that automatically utilizes the proper mechanism for determining location based on how accurate the result needs to be. Apple has a good article discussing these different methods of locating a device.
Also, here is a good starting point for learning about programming with Location Services.
Furthermore, you can dive right into the CoreLocation framework documentation and learn about everything you can do using Location Services on iOS.
Yes, CoreLocation can triangulate your position via nearby cell phone towers, but the position won't be as accurate as with GPS. Also, it can get your location via nearby WLANs, but this is even less reliable.
Core Location does what you want (by using Wi-Fi triangulation). Check out the documentation of CLLocationManager
Try this
map.showsUserLocation = YES;
map is my MKMapView Object.
Well thats kind of a very broad and very general question. If you are talking cell phones you can use three tower triangulation which is good when you are hitting three towers all at once, but if you are only hitting one the error can be up to a few kilometers.
Now if you are talking internet accessing devices (ie something with an IP address) again things get dicey. If you are using a stationary access point you will get a close approximation using nearest known Hubs with the IP range the device is in. Mobile devices with IPs are really hard to pinpoint.
More links
http://mithin.in/2009/06/22/using-iphone-sdk-mapkit-framework-a-tutorial
http://www.icodeblog.com/2009/12/22/introduction-to-mapkit-in-iphone-os-3-0-part-2/
and step by step guide.
http://gigaom.com/apple/iphone-dev-sessions-finding-your-way-with-mapkit/
To add to #Jenifer's answer
showsUserLocation
Discussion
This property does not indicate
whether the user’s position is
actually visible on the map, only
whether the map view is allowed to
display it. To determine whether the
user’s position is visible, use the
userLocationVisible property. The
default value of this property is NO.
Setting this property to YES causes
the map view to use the Core Location
framework to find the current
location. As long as this property is
YES, the map view continues to track
the user’s location and update it
periodically.
Core Location Framework
The Core Location framework lets you
determine the current location or
heading associated with a device. The
framework uses the available hardware
to determine the user’s position and
heading. You use the classes and
protocols in this framework to
configure and schedule the delivery of
location and heading events. You can
also use it to define geographic
regions and monitor when the user
crosses the boundaries of those
regions.
If you want to know How does the Core Location do this
It actually uses several mechanisms.
GPS
Cell Tower Triangulation
Wifi Hotspot cataloging
Randomly assuming you are in Cupertino
There are tradeoffs based on speed, precision, and available hardware. A first Gen iPad will only have the 3 option available while the iPhone simulator makes use of the last mechanism.
You can observe the difference in these systems in the map application where it initially guesses based on the cell tower, then refines the guess via GPS.
Only options #3 requires a data connection.
And for the humor impaired including #4 was not totally serious although it is functionally correct. (I think they simulate the GPS reporting that location rather than just hard coding it, but I haven't checked.)
From How does CoreLocation locate the device?
The iPod Touch does something like this. It doesn't have a GPS chip, but instead uses the available WiFi networks in the area to get a rough idea of where you're located.
I am trying to find the location of user using corelocation framework in my app ,
but
it doesn't showing good results , can anyone please tell me how can i get location accurately in indoors ?
thanks in advance
regards
I am not sure, about the exact physical environment but if wifi access points are available then you can use sdk available from skyhook wireless or navision to locate your current position in case the accuracy of the gps position is not good.
This is not a failsafe approach, but may work better in areas where data is available about wireless ap.
In the general case, you can't get an accurate location indoors using Core Location. (What's wrong with your question is in assuming that you can, before asking how to do the impossible.)
You might get lucky if you are under to a tent roof that is paper thin or near a large window below lots of wide open sky, or happen to be between 3 or more nearby wifi access points whose locations are all accurately and precisely registered with whichever wifi database(s) Apple is using.