A session for World Positioning System (WPS) functionality. WPS provides the 3D position and orientation of the device in geographic coordinates as an alternative to using device GPS and compass heading data. WPS provides greater accuracy and frame-to-frame stability than standard GPS positioning, making it more suitable for AR applications. As the user moves around, WPS maintains the device's position, making it suitable for continuous use over long periods of time and long distances. WPS will work in any location where the phone has a GPS signal, but the accuracy will vary depending on GPS accuracy. ### Usage 1. Acquire the WPS session:kotlin val wpsSession = ardkSession.wps.acquire() 2. Configure the session (optional - defaults are usually sufficient):kotlin val config = WPSConfig( enableSmoothing = true, framerate = 120 ) wpsSession.configure(config) 3. Start the session:kotlin wpsSession.start() 4. Poll for location updates regularly:kotlin coroutineScope.launch { while (trackingStarted) { delay(1000) // Update every second // Check feature status val featureStatus = wpsSession.featureStatus() if (!featureStatus.isOk()) { println("WPS has encountered an error") } // Get the latest location estimate when (val result = wpsSession.getLatestLocation()) { is ARDKResult.Success -> { val location = result.value println("GPS: ${location.referenceLatitudeDegrees}, ${location.referenceLongitudeDegrees}") println("Altitude: ${location.referenceAltitudeMetres} meters") // Use the transformation matrix for coordinate conversions val worldPosition = location.trackingToRelativeEdn // Place AR content using world position } is ARDKResult.Error -> { when (result.code) { WPSError.NOT_INITIALIZED -> println("WPS still initializing...") WPSError.NO_GNSS -> println("No GPS signal available") WPSError.NO_HEADING -> println("No compass data available") WPSError.TRACKING_FAILED -> println("WPS tracking failed") else -> println("WPS error: ${result.code}") } } } } } 5. Clean up when done:kotlin wpsSession.stop() wpsSession.close() ### Advanced Features Converting specific poses to geolocations:kotlin val cameraPose = frame.camera.pose when (val result = wpsSession.getDevicePoseAsGeolocation(cameraPose)) { is ARDKResult.Success -> { val geolocation = result.value println("Pose location: ${geolocation.latitude}, ${geolocation.longitude}") } is ARDKResult.Error -> { println("Could not get geolocation for pose: ${result.code}") } }
kotlin val wpsSession = ardkSession.wps.acquire()2. Configure the session (optional - defaults are usually sufficient):kotlin val config = WPSConfig( enableSmoothing = true, framerate = 120 ) wpsSession.configure(config)3. Start the session:kotlin wpsSession.start()4. Poll for location updates regularly:kotlin coroutineScope.launch { while (trackingStarted) { delay(1000) // Update every second // Check feature status val featureStatus = wpsSession.featureStatus() if (!featureStatus.isOk()) { println("WPS has encountered an error") } // Get the latest location estimate when (val result = wpsSession.getLatestLocation()) { is ARDKResult.Success -> { val location = result.value println("GPS: ${location.referenceLatitudeDegrees}, ${location.referenceLongitudeDegrees}") println("Altitude: ${location.referenceAltitudeMetres} meters") // Use the transformation matrix for coordinate conversions val worldPosition = location.trackingToRelativeEdn // Place AR content using world position } is ARDKResult.Error -> { when (result.code) { WPSError.NOT_INITIALIZED -> println("WPS still initializing...") WPSError.NO_GNSS -> println("No GPS signal available") WPSError.NO_HEADING -> println("No compass data available") WPSError.TRACKING_FAILED -> println("WPS tracking failed") else -> println("WPS error: ${result.code}") } } } } }5. Clean up when done:kotlin wpsSession.stop() wpsSession.close()### Advanced Features Converting specific poses to geolocations:kotlin val cameraPose = frame.camera.pose when (val result = wpsSession.getDevicePoseAsGeolocation(cameraPose)) { is ARDKResult.Success -> { val geolocation = result.value println("Pose location: ${geolocation.latitude}, ${geolocation.longitude}") } is ARDKResult.Error -> { println("Could not get geolocation for pose: ${result.code}") } }