vps
Classes
| Name | Type | Summary |
|---|---|---|
| VPSCoverageSession | VPSCoverageSession | Creates a VPS Coverage instance for querying coverage information. VPS Coverage allows you to query which areas have VPS mapping coverage, helping you determine where VPS localization will be available. |
| VPSSession | VPSSession | A session for Visual Positioning System (VPS) functionality. VPSSession provides capabilities for precise localization using visual features. VPS can determine device position and orientation relative to a pre-mapped environment, enabling persistent AR experiences that maintain accuracy across sessions. ### Usage 1. Acquire the VPS session: kotlin val vpsSession = ardkSession.vps.acquire() 2. Configure the session (must be done before starting): kotlin val config = VPSConfig( enableContinuousLocalization = true, enableTemporalFusion = true ) vpsSession.configure(config) 3. Start the session: kotlin vpsSession.start() 4. Track an anchor using a payload: A VPS payload can be obtained from the "blob" field in the Geospatial Browser, or via [getAnchorPayload] for user-generated anchors. kotlin val anchorId = vpsSession.trackAnchor(anchorPayload) 5. Poll for anchor updates regularly: kotlin coroutineScope.launch { while (trackingStarted) { delay(500) // Update every 500ms val update = vpsSession.getAnchorUpdate(anchorId) when (update.trackingState) { AnchorTrackingState.NOT_TRACKED -> println("Anchor not tracked - waiting for localization") AnchorTrackingState.LIMITED -> println("Limited tracking - pose may be unreliable") AnchorTrackingState.TRACKED -> { // Anchor is fully tracked - safe to place content val matrix = FloatArray(16) update.anchorToLocalTrackingTransform.toMatrix(matrix, 0) // Update your AR content with the anchor's transform } } } } 6. Clean up when done: kotlin vpsSession.stop() vpsSession.close() ### Advanced Features Creating new anchors: kotlin val cameraPose = frame.camera.getDisplayOrientedPose() val newAnchorId = vpsSession.createAnchor(cameraPose) Getting anchor payload for sharing: kotlin val payload = vpsSession.getAnchorPayload(newAnchorId) if (payload != null) { // Store or share this payload for future sessions } Converting poses to GPS coordinates: kotlin val result = vpsSession.getDevicePoseAsGeolocation(frame.camera.pose) when (result) { is ARDKResult.Success -> { val geolocation = result.value println("Lat: ${geolocation.latitude}, Lon: ${geolocation.longitude}") } is ARDKResult.Error -> { println("Geolocation error: ${result.code}") } } Getting session ID for debugging: kotlin val sessionId = vpsSession.getSessionId() println("VPS Session ID: ${sessionId?.joinToString("") { "%02x".format(it) }}") |