Please Select Your Location
Australia
Österreich
België
Canada
Canada - Français
中国
Česká republika
Denmark
Deutschland
France
HongKong
Iceland
Ireland
Italia
日本
Korea
Latvija
Lietuva
Lëtzebuerg
Malta
المملكة العربية السعودية (Arabic)
Nederland
New Zealand
Norge
Polska
Portugal
Russia
Saudi Arabia
Southeast Asia
España
Suisse
Suomi
Sverige
台灣
Ukraine
United Kingdom
United States
Please Select Your Location
België
Česká republika
Denmark
Iceland
Ireland
Italia
Latvija
Lietuva
Lëtzebuerg
Malta
Nederland
Norge
Polska
Portugal
España
Suisse
Suomi
Sverige

Aligning VR and anchor coordinate systems using an ArUco marker

Use an ArUco marker to align the VR and anchor coordinate systems of your VR simulator.
Note:
  • Marker-Based Location Sharing must be set up to use this feature. For details, see Marker-Based Location Sharing setup.

  • Test the APIs before operating your VR simulator to make sure the coordinate systems work as expected.

  1. Define the offset of the VR and anchor coordinate systems.

    The offset must be defined before the VR and anchor coordinate systems can be aligned. Use the string key ClearRecenterXform to define the offset:

    Controller

    string key = "‍ClearRecenterXform"‍;
    Interop.WVR_SetParameters
    (WVR_DeviceType.WVR_DeviceType_HMD, Marshal.StringToHGlobalAnsi(key));
    Interop.WVR_SetParameters
    (WVR_DeviceType.WVR_DeviceType_Controller_Right, Marshal.StringToHGlobalAnsi(key));
    Interop.WVR_SetParameters
    (WVR_DeviceType.WVR_DeviceType_Controller_Left, Marshal.StringToHGlobalAnsi(key));
    

    Wrist tracker

    string key = "‍ClearRecenterXform"‍;
    Interop.WVR_SetParameters(WVR_DeviceType.WVR_DeviceType_HMD, Marshal.StringToHGlobalAnsi(key));
    key = "‍ClearRecenterXformTR"‍;
    Interop.WVR_SetParameters(WVR_DeviceType.WVR_DeviceType_HMD, Marshal.StringToHGlobalAnsi(key));
    
  2. Configure the string key used to align the VR and anchor coordinate systems.

    The string key PLAYER01InCarOrg is used to align the VR and anchor coordinate systems. Configure this string key by using the parameters of your ArUco markers.

    In the following illustration, the anchor coordinate system is based on the position and orientation of the ArUco markers, following the left-hand rule.

  3. Modify PLAYER01InCarOrg using the values marker position, marker orientation, marker ID, and marker size.

    AIO

    string key = "‍PLAYER00InCarOrg=0.0,0.0,0.0,0.0,0.0,0.0,1.0,1,0.2"‍;// Tx, Ty, Tz, qx, qy, qz, qw, marker id, marker size
    uint RETURN_SIZE = 256;
    IntPtr value = Marshal.AllocHGlobal(new IntPtr(RETURN_SIZE));
    Interop.WVR_GetParameters(WVR_DeviceType.WVR_DeviceType_HMD, Marshal.StringToHGlobalAnsi(key), value, RETURN_SIZE);
    string polling_value = Marshal.PtrToStringAnsi(value);
    Marshal.FreeCoTaskMem(value);
    if(string.Compare(polling_value, "‍InitMAErr"‍) == 0) // initialization failed, should check config string
    {
    // write your error handling code here
    }
    

    PC VR

    string key = "‍PLAYER00InCarOrg="‍;
    string setting = "‍-0.4,0.9,-0.4,0.0,0.0,0.0,1.0,1,0.2"‍; // Tx,Ty,Tz,qx,qy,qz,qw,id,size
    key += setting;
    string result = SendRequestMessage(DeviceType.HMD, key);
    if (string.Compare(result, "‍InitMAErr"‍) == 0)
    {
       // write your error handling code here
    }
    
  4. Scan the marker.

    AIO

    // Start
    string key = "‍PLAYER00StartScan"‍;
    uint RETURN_SIZE = 256;
    IntPtr value = Marshal.AllocHGlobal(new IntPtr(RETURN_SIZE));
    Interop.WVR_GetParameters(WVR_DeviceType.WVR_DeviceType_HMD, Marshal.StringToHGlobalAnsi(key), value, RETURN_SIZE);
    Marshal.FreeCoTaskMem(value);
    // Stop
    string key = "‍PLAYER00StopScan"‍;
    uint RETURN_SIZE = 256;
    IntPtr value = Marshal.AllocHGlobal(new IntPtr(RETURN_SIZE));
    Interop.WVR_GetParameters(WVR_DeviceType.WVR_DeviceType_HMD, Marshal.StringToHGlobalAnsi(key), value, RETURN_SIZE);
    Marshal.FreeCoTaskMem(value);
    

    PC VR

    // Start
    string key = "‍PLAYER00StartScan"‍;
    SendRequestMessage(DeviceType.HMD, key);
    
    // Stop
    string key = "‍PLAYER00StopScan"‍;
    SendRequestMessage(DeviceType.HMD, key);
    
  5. Optional: Check the scan status.

    AIO

    // Check scan
    string key = "‍PLAYER00CheckMA"‍;
    uint RETURN_SIZE = 256;
      IntPtr value = Marshal.AllocHGlobal(new IntPtr(RETURN_SIZE));
                  Interop.WVR_GetParameters(WVR_DeviceType.WVR_DeviceType_HMD, Marshal.StringToHGlobaltrToStringAnsi(value);
    Ansi(key), value, RETURN_SIZE);
    string polling_value = Marshal.PtrToStringAnsi(value);
    Marshal.FreeCoTaskMem(value);
    if (string.Compare(polling_value, "‍CTdone"‍) == 0)  // 2 markers scanned
    {
    //handling with 2nd marker scanned
    } 
    else if (string.Compare(polling_value, "‍CTpass"‍) == 0)  // 1 marker scanned
    {
    //handling with first marker scanned
    }
    

    PC VR

    string key = "‍PLAYER00CheckMA"‍;
    string result = SendRequestMessage(DeviceType.HMD, key);
    if (string.Compare(result, "‍CTdone"‍) == 0)
    {
       // handling with the second marker scanned
    }
    else if (string.Compare(result, "‍CTpass"‍) == 0)
    {
       // handling with the first marker scanned
    }
    
  6. Optional: Compensate for mechanical vibration using a low-pass filter.

    You can use the string key PLAYER01PUM_HW_LPF_LEVEL to minimize mechanical vibration. Specify a filter level between 0 and 2. Adjust the filter level according to your needs.

    AIO

    string key = "‍PLAYER01PUM_HW_LPF_LEVEL=2"‍;
    Interop.WVR_SetParameters(WVR_DeviceType.WVR_DeviceType_HMD, Marshal.StringToHGlobalAnsi(key));
    

    PC VR

    string key = "‍ PLAYER01PUM_HW_LPF_LEVEL="‍;
    string setting = "‍2"‍;
    key += setting;
    string result = SendRequestMessage(DeviceType.Controller_Left, key);
    
Submit
Thank you! Your feedback helps others to see the most helpful information.