IAARSession
Objective-C
@interface IAARSession : NSObject <IABeta, IARestricted>
Swift
class IAARSession : NSObject, IABeta, IARestricted
IndoorAtlas AR fusion API
NOTE! To enable AR features, please contact IndoorAtlas sales.
The AR API provides you with convenient means of converting between two important coordinate systems: * The global coordinates encoded in IALocation objects and their components. In practice, this means latitude, longitude, floor number and heading/orientation information. * An augmented reality (AR) coordinate system, which is assumed to be a right-handed 3D metric coordinate system, where the Y axis points up (towards the sky).
The local tracking of the device in the AR coordinate system is assumed to be handled by an external AR solution like ARCore, whose certain outputs are given to this class. The IndoorAtlas platform fuses this information with the IndoorAtlas position estimates and provides the relevant coordinate transforms in a stable and visually consistent manner, which allows you to easily place geographically referenced content in the AR world.
The methods of an instance of this class can be called from any thread.
-
Wayfinding arrow AR object.
Declaration
Objective-C
@property (nonatomic, readonly, nonnull) IAARObject *wayfindingCompassArrow;
Swift
var wayfindingCompassArrow: IAARObject { get }
-
Wayfinding target (goal) AR object.
Declaration
Objective-C
@property (nonatomic, readonly, nonnull) IAARObject *wayfindingTarget;
Swift
var wayfindingTarget: IAARObject { get }
-
Array of waypoint AR objects constructed from the wayfinding route.
Declaration
Objective-C
@property (nonatomic, readonly, nullable) NSArray<IAARObject *> *wayfindingTurnArrows;
Swift
var wayfindingTurnArrows: [IAARObject]? { get }
-
Check if the positioning session has approximately converged. If false, it is recommended to advise the user to walk for a couple of meters to any direction so that they coordinate systems can be oriented correctly. This is optional, but the
IAARObject
instances may first appear in clearly incorrect directions on positions otherwise.Declaration
Objective-C
@property (nonatomic, readonly) _Bool converged;
Swift
var converged: Bool { get }
-
Create an AR Point-of-Interest in the given geographical coordinates. The coordinates of the object in the AR world update in a visually pleasing manner.
Declaration
Objective-C
- (nonnull IAARObject *)createPoi:(CLLocationCoordinate2D)coords floorNumber:(int)floorNumber;
Swift
func createPoi(_ coords: CLLocationCoordinate2D, floorNumber: Int32) -> IAARObject
Parameters
coords
latitude in degrees
floorNumber
IndoorAtlas integer floor number
Return Value
IAARObject
-
Create an AR Point-of-Interest in the given geographical coordinates. The coordinates of the object in the AR world update in a visually pleasing manner.
Declaration
Objective-C
- (nonnull IAARObject *)createPoi:(CLLocationCoordinate2D)coords floorNumber:(int)floorNumber heading:(double)heading zOffset:(double)zOffset;
Swift
func createPoi(_ coords: CLLocationCoordinate2D, floorNumber: Int32, heading: Double, zOffset: Double) -> IAARObject
Parameters
coords
latitude in degrees
floorNumber
IndoorAtlas integer floor number
heading
Heading in degrees 0=North, 90=East, 180=South, 270=West
zOffset
Vertical offset from the floor plane in meters
Return Value
IAARObject
-
Create an AR Point-of-Interest in the given geographical coordinates. The coordinates of the object in the AR world update in a visually pleasing manner.
Declaration
Objective-C
- (nonnull IAARObject *)createPoi:(nonnull IALocation *)location;
Swift
func createPoi(_ location: IALocation) -> IAARObject
Parameters
location
location of the POI
Return Value
IAARObject
-
Convert from geographical to AR coordinates.
Declaration
Objective-C
- (simd_float4x4)geoToAr:(const CLLocationCoordinate2D)coords floorNumber:(int)floorNumber heading:(double)heading zOffset:(double)zOffset;
Swift
func geo(toAr coords: CLLocationCoordinate2D, floorNumber: Int32, heading: Double, zOffset: Double) -> simd_float4x4
Parameters
coords
Geographical coordinates
floorNumber
IndoorAtlas integer floor number
heading
heading in degrees 0=North, 90=East, 180=South, 270=West
zOffset
Vertical offset from the floor plane in meters
Return Value
a 4x4 homogeneous model-to-world matrix. The matrix will be a identity matrix in case of conversion failure. The conversion fails unless both IndoorAtlas positioning and the AR input have been obtained (i.e., before the first fix or before setArCameraMatrix has been called for the first time).
-
Convert from AR to geographic coordinates.
Declaration
Objective-C
- (nonnull IALocation *)arToGeo:(const simd_float4x4)matrix;
Swift
func ar(toGeo matrix: simd_float4x4) -> IALocation
Parameters
matrix
4x4 homogeneous model-to-world matrix
Return Value
geographical coordinates. Nil if not available
-
Convert from AR to geographic coordinates.
Declaration
Objective-C
- (nonnull IALocation *)arToGeo:(double)x Y:(double)y Z:(double)z;
Swift
func ar(toGeo x: Double, y: Double, z: Double) -> IALocation
Parameters
x
AR coordinate system X-coordinate (horizontal)
y
AR coordinate system Y-coordinate (vertical)
z
AR coordinate system Z-coordinate (horizontal)
Return Value
geographical coordinates. Nil if not available
-
Input current pose from the external AR tracking. This method should be called on each successfully tracked AR camera frame.
Declaration
Objective-C
- (void)setPoseMatrix:(const simd_float4x4)poseMatrix;
Swift
func setPoseMatrix(_ poseMatrix: simd_float4x4)
Parameters
poseMatrix
Current “sensor pose” from AR tracking. a 4x4 homogeneous local-to-world matrix, equivalent to ARKit’s ARCamera.transform[1] This matrix does not change with UI orientation. 1: https://developer.apple.com/documentation/arkit/arcamera/2866108-transform.
-
Set the current camera-to-world matrix. Should be called regularly as long as one wishes to render objects. Calling on each AR frame is recommended.
Declaration
Objective-C
- (void)setCameraToWorldMatrix:(const simd_float4x4)cameraToWorldMatrix;
Swift
func setCameraToWorldMatrix(_ cameraToWorldMatrix: simd_float4x4)
Parameters
cameraToWorldMatrix
a 4x4 homogeneous camera-to-world matrix, where the the negative Z axis is points “into the screen” in camera coordinates. Unlike the poseMatrix method, this matrix may change with UI orientation. This matrix is equivalent to inverse of ARKit’s ARCamera.viewMatrix[1] 1: https://developer.apple.com/documentation/arkit/arcamera/2921672-viewmatrix
-
Input AR plane tracking information. This input is optional, but allows more accurate vertical tracking, e.g., placing geo-referenced AR objects so that they appear to be on the floor. If used, should be called on each AR frame for each tracked horizontal upward-facing planes as input.
The planes will be applied on the next
setPoseMatrix:
call.Declaration
Objective-C
- (void)addPlaneWithCenterX:(float)centerX withCenterY:(float)centerY withCenterZ:(float)centerZ withExtentX:(float)extentX withExtentZ:(float)extentZ;
Swift
func addPlane(withCenterX centerX: Float, withCenterY centerY: Float, withCenterZ centerZ: Float, withExtentX extentX: Float, withExtentZ extentZ: Float)
Parameters
centerX
Center X coordinate of the plane
centerY
Center Y coordinate of the plane
centerZ
Center Z coordinate of the plane
extentX
Extent X of the plane
extentZ
Extent Z of the plane
-
Update AR route manually. Calling this method is only required if not using IndoorAtlas wayfinding. You should update the route each time location changes to keep it in sync.
If this method is used while also using IndoorAtlas wayfinding, the route will not be updated automatically anymore.
Declaration
Objective-C
- (void)updateRoute:(nonnull IARoute *)route;
Swift
func update(_ route: IARoute)
Parameters
route
The current route graph from the current location