OpenXRAndroidGeospatialExtension
Inherits: OpenXRExtensionWrapper
Wraps the XR_ANDROID_geospatial extension.
Description
Wraps the XR_ANDROID_geospatial extension, which provides precise geo-location and orientation using a combination of motion tracking, GPS and other sensors, and Google's Visual Positioning System (VPS). This can provide sub-meter positional accuracy and sub-degree orientation accuracy.
Authentication must be configured via OpenXRAndroidGoogleCloudAuthExtension before using this extension.
Methods
OpenXRFutureResult |
check_vps_availability ( float latitude, float longitude ) |
Transform3D |
geospatial_pose_to_transform ( OpenXRAndroidGeospatialPose pose ) |
void |
get_geographic_location ( Callable callback ) |
get_geospatial_state ( ) const |
|
bool |
is_geospatial_supported ( ) const |
void |
start_geospatial ( ) |
void |
stop_geospatial ( ) |
transform_to_geospatial_pose ( Transform3D transform ) |
Signals
openxr_android_geospatial_state_changed ( int state )
Emitted when the geospatial tracker state changes. See GeospatialState for possible values.
Enumerations
enum GeospatialState:
GeospatialState GEOSPATIAL_STATE_STOPPED = 0
The geospatial tracker is not running.
GeospatialState GEOSPATIAL_STATE_RUNNING = 1
The geospatial tracker is running and ready to use.
GeospatialState GEOSPATIAL_STATE_INITIALIZATION_FAILED = 2
The geospatial tracker failed to initialize.
enum VpsAvailability:
The VPS is unavailable.
VpsAvailability VPS_AVAILABILITY_AVAILABLE = 1
The VPS is available.
Method Descriptions
OpenXRFutureResult check_vps_availability ( float latitude, float longitude )
Checks whether VPS (Visual Positioning System) data is available at the given latitude and longitude. Returns an OpenXRFutureResult whose result value is VpsAvailability.
When VPS is unavailable, geospatial tracking accuracy may be lower at that location.
You can call get_geographic_location to get the latitude and longitude to use here.
Transform3D geospatial_pose_to_transform ( OpenXRAndroidGeospatialPose pose )
Converts an OpenXRAndroidGeospatialPose to a Transform3D in the current play space. The geospatial tracker must be in the GEOSPATIAL_STATE_RUNNING state.
void get_geographic_location ( Callable callback )
Gets the devices's geographic location using normal Android APIs, not VPS.
The given callback will be called with three arguments: (success: bool, latitude: float, longitude: float)
This method is helpful for getting a latitude and longitude to call check_vps_availability
GeospatialState get_geospatial_state ( ) const
Returns the current state of the geospatial tracker.
bool is_geospatial_supported ( ) const
Returns true if the XR_ANDROID_geospatial extension is supported by the OpenXR runtime.
void start_geospatial ( )
Creates the geospatial tracker, which tracks the device's position and orientation relative to the Earth.
You must call is_geospatial_supported first to verify that the extension is supported. The tracker initially enters the GEOSPATIAL_STATE_STOPPED state, and the application must wait for the openxr_android_geospatial_state_changed signal to indicate GEOSPATIAL_STATE_RUNNING before using pose conversion methods.
void stop_geospatial ( )
Destroys the geospatial tracker and stops geospatial tracking.
OpenXRAndroidGeospatialPose transform_to_geospatial_pose ( Transform3D transform )
Converts a Transform3D in the current play space to an OpenXRAndroidGeospatialPose containing latitude, longitude, altitude, and east-up-south orientation.
The returned pose includes accuracy information: check OpenXRAndroidGeospatialPose.is_position_valid and OpenXRAndroidGeospatialPose.is_orientation_valid before reading the corresponding fields. The geospatial tracker must be in the GEOSPATIAL_STATE_RUNNING state.