请选择您的所在地
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
Suisse
Suomi
Sverige
台灣
Ukraine
United Kingdom
United States
请选择您的所在地
België
Česká republika
Denmark
Iceland
Ireland
Italia
Latvija
Lietuva
Lëtzebuerg
Malta
Nederland
Norge
Polska
Portugal
Suisse
Suomi
Sverige

使用 ArUco 标记对齐虚拟现实和锚点坐标系

使用 ArUco 标记对齐您 VR 模拟器的虚拟现实和锚点坐标系。
注:
  • 必须设置基于标记的位置共享才能使用此功能。有关详细信息,请参见基于标记的位置共享设置

  • 请在操作 VR 模拟器之前测试 API,以确保坐标系按预期工作。

  1. 定义虚拟现实和锚点坐标系的偏移量。

    在对齐虚拟现实和锚点坐标系之前,必须先定义偏移量。请使用字符串键 ClearRecenterXform 来定义偏移量:

    操控手柄

    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));
    

    腕带式追踪器

    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. 配置用于对齐虚拟现实和锚点坐标系的字符串键。

    字符串键 PLAYER01InCarOrg 用于对齐虚拟现实和锚点坐标系。请使用您的 ArUco 标记的参数配置此字符串键。

    在下图中,锚点坐标系基于 ArUco 标记的位置和方向,并遵循左手法则。

  3. 使用标记位置标记方向标记 ID标记大小值修改 PLAYER01InCarOrg

    一体机

    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. 扫描标记。

    一体机

    // 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);
    Mar
    

    PC VR

    // Start
    string key = "‍PLAYER00StartScan"‍;
    SendRequestMessage(DeviceType.HMD, key);
    
    // Stop
    string key = "‍PLAYER00StopScan"‍;
    SendRequestMessage(DeviceType.HMD, key);
    
  5. 可选:检查扫描状态。

    一体机

    // 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. 可选:使用低通滤波补偿机械振动。

    您可以使用字符串键 PLAYER01PUM_HW_LPF_LEVEL 来最小化机械振动。指定 0 和 2 之间的过滤级别。请根据您的需要调整过滤级别。

    一体机

    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);
    
提交
谢谢!您的反馈可以帮助其他人了解最有用的信息。