認識シミュレーション

アプリの自動テストを作成したいと思いますか。 コンポーネントレベルの単体テストを超えるテストを行って、実際にアプリをエンドツーエンドで実行したいと思いますか? それならば、認識シミュレーションがあなたが探しているものです。 認識シミュレーション ライブラリを使用すると、人と世界の入力データをアプリに送信できるため、テストを自動化できます。 たとえば、特定の反復可能な位置を見ている人の入力をシミュレートし、ジェスチャまたはモーション コントローラーを使用できます。

認識シミュレーションでは、このようなシミュレートされた入力を、物理 HoloLens、HoloLens エミュレーター (第 1 世代)、HoloLens 2 Emulator、または Mixed Reality ポータルがインストールされた PC に送信できます。 認識シミュレーションでは、Mixed Reality デバイス上のライブ センサーをバイパスし、デバイス上で実行されているアプリケーションにシミュレートされた入力を送信します。 アプリケーションは、通常使用するのと同じ API を介してこれらの入力イベントを受け取ります。実際のセンサーで実行する場合と認識シミュレーションで実行する場合の違いを区別することはできません。 認識シミュレーションは、HoloLens エミュレーターがシミュレートされた入力を HoloLens 仮想マシンに送信するために使用するのと同じテクノロジです。

コードでシミュレーションの使用を開始するには、IPerceptionSimulationManager オブジェクトを作成することから始めます。 そのオブジェクトから、頭の位置、手の位置、ジェスチャなど、シミュレートされた "人" のプロパティを制御するコマンドを発行できます。 モーション コントローラーを有効にして操作することもできます。

認識シミュレーション用の Visual Studio プロジェクトの設定

  1. 開発用 PC に HoloLens エミュレーターをインストールします。 エミュレーターには、認識シミュレーションに使用するライブラリが含まれています。

  2. 新しい Visual Studio C# デスクトップ プロジェクトを作成します (開始するにはコンソール プロジェクトが最適です)。

  3. 次のバイナリを参照としてプロジェクトに追加します ([プロジェクト] -> [追加] -> [Reference] (リファレンス))。これらは、%ProgramFiles(x86)%\Microsoft XDE\<バージョン> にあります (たとえば、HoloLens 2 エミュレーターの場合は %ProgramFiles(x86)%\Microsoft XDE\10.0.18362.0)。

    注意

    バイナリは HoloLens 2 Emulator の一部ですが、デスクトップ上のWindows Mixed Realityでも機能します)。

    a. PerceptionSimulationManager.Interop.dll - 認識シミュレーション用のマネージド C# ラッパー。
    b. PerceptionSimulationRest.dll - HoloLens またはエミュレーターへの Web ソケット通信チャネルを設定するためのライブラリ。
    c. SimulationStream.Interop.dll - シミュレーション用の共有型。

  4. 実装バイナリ PerceptionSimulationManager.dll をプロジェクトに追加する

    a. 最初に、これをバイナリとしてプロジェクトに追加します ([プロジェクト] -> [追加] -> [既存の項目])。プロジェクトのソース フォルダーにコピーされないように、これをリンクとして保存します。
    プロジェクトにリンクとして PerceptionSimulationManager.dll を追加する

    b. 次に、これがビルド時に出力フォルダーにコピーされるようにします。 これは、バイナリのプロパティ シートにあります。
    PerceptionSimulationManager.dll にマークを付けて、出力ディレクトリにコピーされるようにします

  5. アクティブなソリューション プラットフォームを x64 に設定します。 (x64 のプラットフォーム エントリがまだ存在しない場合は、構成マネージャーを使用して作成します。)

IPerceptionSimulationManager オブジェクトの作成

シミュレーションを制御するには、IPerceptionSimulationManager オブジェクトから取得したオブジェクトに対して更新を発行します。 最初の手順では、そのオブジェクトを取得し、ターゲット デバイスまたはエミュレーターに接続します。 エミュレーターの IP アドレスは、ツール バーの [デバイス ポータル] ボタンをクリックすると取得できます

[Open Device Portal] (デバイス ポータルを開く) アイコン[Open Device Portal] (デバイス ポータルを開く): HoloLens OS の Windows デバイス ポータルをエミュレーターで開きます。 Windows Mixed Realityの場合は、[設定] アプリの [Update & Security]\(& セキュリティの更新\) の下にある [Connect using:]\(使用する接続\) セクションの [開発者向け]で取得できます。必ず IP アドレスとポートの両方をメモしてください。

まず、RestSimulationStreamSink.Create を呼び出して RestSimulationStreamSink オブジェクトを取得します。 これは、http 接続を介して制御するターゲット デバイスまたはエミュレーターです。 コマンドは、デバイスまたはエミュレーターで実行されている Windows デバイス ポータルに渡され、処理されます。 オブジェクトを作成するために必要な 4 つのパラメーターは次のとおりです。

  • Uri uri - ターゲット デバイスの IP アドレス (例: "https://123.123.123.123"、"https://123.123.123.123:50080")
  • System.Net.NetworkCredential 資格情報 - ターゲット デバイスまたはエミュレーターの Windows デバイス ポータルに接続するためのユーザー名とパスワード。 同じ PC 上のローカル アドレス (例: 168...*) を介してエミュレーターに接続している場合、すべての資格情報が受け入れられます。
  • bool normal - true は通常の優先度を示し、false は低優先度を示します。 テスト シナリオでは、通常、これを true に設定して、テストを制御できるようにします。 エミュレーターと Windows Mixed Reality シミュレーションでは、優先度の低い接続を使用します。 テストでも優先度の低い接続を使用する場合は、最後に確立された接続が制御されます。
  • System.Threading.CancellationToken トークン - 非同期操作を取り消すためのトークン。

次に、IPerceptionSimulationManager を作成します。 これは、シミュレーションを制御するために使用するオブジェクトです。 これは、非同期メソッドでも行う必要があります。

シミュレートされた人を制御する

IPerceptionSimulationManager には、ISimulatedHuman オブジェクトを返す Human プロパティがあります。 シミュレートされた人を制御するには、このオブジェクトに対して操作を実行します。 次に例を示します。

manager.Human.Move(new Vector3(0.1f, 0.0f, 0.0f))

基本的なサンプル C# コンソール アプリケーション

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.PerceptionSimulation;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            Task.Run(async () =>
            {
                RestSimulationStreamSink sink = null;
                CancellationToken token = new System.Threading.CancellationToken();

                try
                {
                    sink = await RestSimulationStreamSink.Create(
                        // use the IP address for your device/emulator
                        new Uri("https://169.254.227.115"),
                        // no credentials are needed for the emulator
                        new System.Net.NetworkCredential("", ""),
                        // normal priorty
                        true,
                        // cancel token
                        token);

                    IPerceptionSimulationManager manager = PerceptionSimulationManager.CreatePerceptionSimulationManager(sink);
                }
                catch (Exception e)
                {
                    Console.WriteLine(e);
                }

                // Always close the sink to return control to the previous application.
                if (sink != null)
                {
                    await sink.Close(token);
                }
            });

            // If main exits, the process exits.  
            Console.WriteLine("Press any key to exit...");
            Console.ReadLine();
        }
    }
}

拡張サンプル C# コンソール アプリケーション

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.PerceptionSimulation;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            RestSimulationStreamSink sink = null;
            CancellationToken token = new System.Threading.CancellationToken();

            Task.Run(async () =>
            {
                try
                {
                    sink = await RestSimulationStreamSink.Create(
                        // use the IP address for your device/emulator
                        new Uri("https://169.254.227.115"),
                        // no credentials are needed for the emulator
                        new System.Net.NetworkCredential("", ""),
                        // normal priorty
                        true,
                        // cancel token
                        token);

                    IPerceptionSimulationManager manager = PerceptionSimulationManager.CreatePerceptionSimulationManager(sink);

                    // Now, we'll simulate a sequence of actions.
                    // Sleeps in-between each action give time to the system
                    // to be able to properly react.
                    // This is just an example. A proper automated test should verify
                    // that the app has behaved correctly
                    // before proceeding to the next step, instead of using Sleeps.

                    // Activate the right hand
                    manager.Human.RightHand.Activated = true;

                    // Simulate Bloom gesture, which should cause Shell to disappear
                    manager.Human.RightHand.PerformGesture(SimulatedGesture.Home);
                    Thread.Sleep(2000);

                    // Simulate Bloom gesture again... this time, Shell should reappear
                    manager.Human.RightHand.PerformGesture(SimulatedGesture.Home);
                    Thread.Sleep(2000);

                    // Simulate a Head rotation down around the X axis
                    // This should cause gaze to aim about the center of the screen
                    manager.Human.Head.Rotate(new Rotation3(0.04f, 0.0f, 0.0f));
                    Thread.Sleep(300);

                    // Simulate a finger press & release
                    // Should cause a tap on the center tile, thus launching it
                    manager.Human.RightHand.PerformGesture(SimulatedGesture.FingerPressed);
                    Thread.Sleep(300);
                    manager.Human.RightHand.PerformGesture(SimulatedGesture.FingerReleased);
                    Thread.Sleep(2000);

                    // Simulate a second finger press & release
                    // Should activate the app that was launched when the center tile was clicked
                    manager.Human.RightHand.PerformGesture(SimulatedGesture.FingerPressed);
                    Thread.Sleep(300);
                    manager.Human.RightHand.PerformGesture(SimulatedGesture.FingerReleased);
                    Thread.Sleep(5000);

                    // Simulate a Head rotation towards the upper right corner
                    manager.Human.Head.Rotate(new Rotation3(-0.14f, 0.17f, 0.0f));
                    Thread.Sleep(300);

                    // Simulate a third finger press & release
                    // Should press the Remove button on the app
                    manager.Human.RightHand.PerformGesture(SimulatedGesture.FingerPressed);
                    Thread.Sleep(300);
                    manager.Human.RightHand.PerformGesture(SimulatedGesture.FingerReleased);
                    Thread.Sleep(2000);

                    // Simulate Bloom gesture again... bringing the Shell back once more
                    manager.Human.RightHand.PerformGesture(SimulatedGesture.Home);
                    Thread.Sleep(2000);
                }
                catch (Exception e)
                {
                    Console.WriteLine(e);
                }
            });

            // If main exits, the process exits.  
            Console.WriteLine("Press any key to exit...");
            Console.ReadLine();

            // Always close the sink to return control to the previous application.
            if (sink != null)
            {
                sink.Close(token);
            }
        }
    }
}

6-DOF コントローラーに関する注意

シミュレートされた 6-DOF コントローラーのメソッドでプロパティを呼び出す前に、コントローラーをアクティブ化する必要があります。 そうしないと、例外が発生します。 Windows 10 May 2019 Update より、シミュレートされた 6-DOF コントローラーをインストールしてアクティブ化するには、ISimulatedSixDofController オブジェクトの Status プロパティを SimulatedSixDofControllerStatus.Active に設定します。 Windows 10 October 2018 Update 以前では、最初に \Windows\System32 フォルダーにある PerceptionSimulationDevice ツールを呼び出して、シミュレートされた 6-DOF コントローラーを個別にインストールする必要があります。 このツールの使用方法は次のとおりです。

    PerceptionSimulationDevice.exe <action> 6dof <instance>

次に例を示します。

    PerceptionSimulationDevice.exe i 6dof 1

サポートされているアクション:

  • i = インストール
  • q = クエリ
  • r = 削除

サポートされているインスタンス:

  • 1 = 左側の 6-DOF コントローラー
  • 2 = 右側の 6 DOF コントローラー

プロセスの終了コードは、成功 (ゼロの戻り値) または失敗 (ゼロ以外の戻り値) を示します。 "q" アクションを使用してコントローラーがインストールされているかどうかを照会する場合、戻り値は、コントローラーがまだインストールされていない場合は 0、コントローラーがインストールされている場合は 1 になります。

Windows 10 October 2018 Update 以前からコントローラーを削除する場合は、最初に API を使用してその状態をオフに設定してから、PerceptionSimulationDevice ツールを呼び出します。

このツールは、管理者として実行する必要があります。

API リファレンス

Microsoft.PerceptionSimulation.SimulatedDeviceType

シミュレートされたデバイスの種類を表します

public enum SimulatedDeviceType
{
    Reference = 0
}

Microsoft.PerceptionSimulation.SimulatedDeviceType.Reference

架空の参照デバイス。PerceptionSimulationManager の既定値

Microsoft.PerceptionSimulation.HeadTrackerMode

ヘッド トラッカー モードを表します

public enum HeadTrackerMode
{
    Default = 0,
    Orientation = 1,
    Position = 2
}

Microsoft.PerceptionSimulation.HeadTrackerMode.Default

既定のヘッド トラッキング。 これは、システムが実行時の条件に基づいて最適なヘッド トラッキング モードを選択する可能性があることを意味します。

Microsoft.PerceptionSimulation.HeadTrackerMode.Orientation

向きのみのヘッド トラッキング。 これは、追跡された位置が信頼できない可能性があり、頭の位置に依存する一部の機能が利用できない可能性があることを意味します。

Microsoft.PerceptionSimulation.HeadTrackerMode.Position

ポジショナル ヘッド トラッキング。 これは、追跡された頭の位置と向きの両方が信頼できることを意味します

Microsoft.PerceptionSimulation.SimulatedGesture

シミュレートされたジェスチャを表します

public enum SimulatedGesture
{
    None = 0,
    FingerPressed = 1,
    FingerReleased = 2,
    Home = 4,
    Max = Home
}

Microsoft.PerceptionSimulation.SimulatedGesture.None

ジェスチャがないことを示すために使用されるセンチネル値。

Microsoft.PerceptionSimulation.SimulatedGesture.FingerPressed

指を押すジェスチャ。

Microsoft.PerceptionSimulation.SimulatedGesture.FingerReleased

指を離すジェスチャ。

Microsoft.PerceptionSimulation.SimulatedGesture.Home

ホームまたはシステム ジェスチャ。

Microsoft.PerceptionSimulation.SimulatedGesture.Max

有効な最大ジェスチャ。

Microsoft.PerceptionSimulation.SimulatedSixDofControllerStatus

シミュレートされた 6-DOF コントローラーの可能な状態。

public enum SimulatedSixDofControllerStatus
{
    Off = 0,
    Active = 1,
    TrackingLost = 2,
}

Microsoft.PerceptionSimulation.SimulatedSixDofControllerStatus.Off

6-DOF コントローラーがオフです。

Microsoft.PerceptionSimulation.SimulatedSixDofControllerStatus.Active

6-DOF コントローラーがオンで、追跡されます。

Microsoft.PerceptionSimulation.SimulatedSixDofControllerStatus.TrackingLost

6-DOF コントローラーがオンですが、追跡できません。

Microsoft.PerceptionSimulation.SimulatedSixDofControllerButton

シミュレートされた 6-DOF コントローラーでサポートされているボタン。

public enum SimulatedSixDofControllerButton
{
    None = 0,
    Home = 1,
    Menu = 2,
    Grip = 4,
    TouchpadPress = 8,
    Select = 16,
    TouchpadTouch = 32,
    Thumbstick = 64,
    Max = Thumbstick
}

Microsoft.PerceptionSimulation.SimulatedSixDofControllerButton.None

ボタンがないことを示すために使用されるセンチネル値。

Microsoft.PerceptionSimulation.SimulatedSixDofControllerButton.Home

[ホーム] ボタンが押されました。

Microsoft.PerceptionSimulation.SimulatedSixDofControllerButton.Menu

[メニュー] ボタンが押されました。

Microsoft.PerceptionSimulation.SimulatedSixDofControllerButton.Grip

[グリップ] ボタンが押されました。

Microsoft.PerceptionSimulation.SimulatedSixDofControllerButton.TouchpadPress

タッチパッドが押されました。

Microsoft.PerceptionSimulation.SimulatedSixDofControllerButton.Select

[選択] ボタンが押されました。

Microsoft.PerceptionSimulation.SimulatedSixDofControllerButton.TouchpadTouch

タッチパッドがタッチされました。

Microsoft.PerceptionSimulation.SimulatedSixDofControllerButton.Thumbstick

サムスティックが押されました。

Microsoft.PerceptionSimulation.SimulatedSixDofControllerButton.Max

有効な最大ボタン。

Microsoft.PerceptionSimulation.SimulatedEyesCalibrationState

シミュレートされた視点の調整状態

public enum SimulatedGesture
{
    Unavailable = 0,
    Ready = 1,
    Configuring = 2,
    UserCalibrationNeeded = 3
}

Microsoft.PerceptionSimulation.SimulatedEyesCalibrationState.Unavailable

視点の調整を利用できません。

Microsoft.PerceptionSimulation.SimulatedEyesCalibrationState.Ready

視点が調整されています。 これが既定値です。

Microsoft.PerceptionSimulation.SimulatedEyesCalibrationState.Configuring

視点の調整中です。

Microsoft.PerceptionSimulation.SimulatedEyesCalibrationState.UserCalibrationNeeded

視点を調整する必要があります。

Microsoft.PerceptionSimulation.SimulatedHandJointTrackingAccuracy

手の関節のトラッキング精度。

public enum SimulatedHandJointTrackingAccuracy
{
    Unavailable = 0,
    Approximate = 1,
    Visible = 2
}

Microsoft.PerceptionSimulation.SimulatedHandJointTrackingAccuracy.Unavailable

関節は追跡されません。

Microsoft.PerceptionSimulation.SimulatedHandJointTrackingAccuracy.Approximate

関節の位置が推測されます。

Microsoft.PerceptionSimulation.SimulatedHandJointTrackingAccuracy.Visible

関節は完全に追跡されます。

Microsoft.PerceptionSimulation.SimulatedHandPose

手の関節のトラッキング精度。

public enum SimulatedHandPose
{
    Closed = 0,
    Open = 1,
    Point = 2,
    Pinch = 3,
    Max = Pinch
}

Microsoft.PerceptionSimulation.SimulatedHandPose.Closed

手の指の関節は、閉じたポーズを反映するように構成されています。

Microsoft.PerceptionSimulation.SimulatedHandPose.Open

手の指の関節は、開いたポーズを反映するように構成されています。

Microsoft.PerceptionSimulation.SimulatedHandPose.Point

手の指の関節は、指さしポーズを反映するように構成されています。

Microsoft.PerceptionSimulation.SimulatedHandPose.Pinch

手の指の関節は、つまむポーズを反映するように構成されています。

Microsoft.PerceptionSimulation.SimulatedHandPose.Max

SimulatedHandPose の有効な最大値。

Microsoft.PerceptionSimulation.PlaybackState

再生の状態を表します。

public enum PlaybackState
{
    Stopped = 0,
    Playing = 1,
    Paused = 2,
    End = 3,
}

Microsoft.PerceptionSimulation.PlaybackState.Stopped

現在、録音は停止されており、再生の準備ができています。

Microsoft.PerceptionSimulation.PlaybackState.Playing

記録は現在再生中です。

Microsoft.PerceptionSimulation.PlaybackState.Paused

記録は現在一時停止中です。

Microsoft.PerceptionSimulation.PlaybackState.End

記録が終了しました。

Microsoft.PerceptionSimulation.Vector3

3D 空間の点またはベクトルを表す可能性のある 3 成分ベクトルを表します。

public struct Vector3
{
    public float X;
    public float Y;
    public float Z;
    public Vector3(float x, float y, float z);
}

Microsoft.PerceptionSimulation.Vector3.X

ベクトルの X 成分。

Microsoft.PerceptionSimulation.Vector3.Y

ベクトルの Y 成分。

Microsoft.PerceptionSimulation.Vector3.Z

ベクトルの Z 成分。

Microsoft.PerceptionSimulation.Vector3.#ctor(System.Single,System.Single,System.Single)

新しい Vector3 を構築します。

パラメーター

  • x - ベクトルの x 成分。
  • y - ベクトルの y 成分。
  • z - ベクトルの z 成分。

Microsoft.PerceptionSimulation.Rotation3

3 成分の回転を表します。

public struct Rotation3
{
    public float Pitch;
    public float Yaw;
    public float Roll;
    public Rotation3(float pitch, float yaw, float roll);
}

Microsoft.PerceptionSimulation.Rotation3.Pitch

X 軸を中心とする回転のピッチ成分。

Microsoft.PerceptionSimulation.Rotation3.Yaw

Y 軸を中心とする回転のヨー成分。

Microsoft.PerceptionSimulation.Rotation3.Roll

Z 軸を中心とする回転のロール成分。

Microsoft.PerceptionSimulation.Rotation3.#ctor(System.Single,System.Single,System.Single)

新しい Rotation3 を構築します。

パラメーター

  • pitch - 回転のピッチ成分。
  • yaw - 回転のヨー成分。
  • roll - 回転のロール成分。

Microsoft.PerceptionSimulation.SimulatedHandJointConfiguration

シミュレートされた手の関節の構成を表します。

public struct SimulatedHandJointConfiguration
{
    public Vector3 Position;
    public Rotation3 Rotation;
    public SimulatedHandJointTrackingAccuracy TrackingAccuracy;
}

Microsoft.PerceptionSimulation.SimulatedHandJointConfiguration.Position

関節の位置。

Microsoft.PerceptionSimulation.SimulatedHandJointConfiguration.Rotation

関節の回転。

Microsoft.PerceptionSimulation.SimulatedHandJointConfiguration.TrackingAccuracy

関節のトラッキング精度。

Microsoft.PerceptionSimulation.Frustum

カメラで一般的に使用される、視野の視錐台を表します。

public struct Frustum
{
    float Near;
    float Far;
    float FieldOfView;
    float AspectRatio;
}

Microsoft.PerceptionSimulation.Frustum.Near

視錐台に含まれる最小距離。

Microsoft.PerceptionSimulation.Frustum.Far

視錐台に含まれる最大距離。

Microsoft.PerceptionSimulation.Frustum.FieldOfView

ラジアン単位 (PI 未満) の、視錐台の水平方向の視野。

Microsoft.PerceptionSimulation.Frustum.AspectRatio

水平方向の視野と垂直方向の視野の比率。

Microsoft.PerceptionSimulation.SimulatedDisplayConfiguration

シミュレートされたヘッドセットのディスプレイの構成を表します。

public struct SimulatedDisplayConfiguration
{
    public Vector3 LeftEyePosition;
    public Rotation3 LeftEyeRotation;
    public Vector3 RightEyePosition;
    public Rotation3 RightEyeRotation;
    public float Ipd;
    public bool ApplyEyeTransforms;
    public bool ApplyIpd;
}

Microsoft.PerceptionSimulation.SimulatedDisplayConfiguration.LeftEyePosition

ステレオ レンダリング用の、頭の中心から左目への変換。

Microsoft.PerceptionSimulation.SimulatedDisplayConfiguration.LeftEyeRotation

ステレオ レンダリング用の、左目の回転。

Microsoft.PerceptionSimulation.SimulatedDisplayConfiguration.RightEyePosition

ステレオ レンダリング用の、頭の中心から右目への変換。

Microsoft.PerceptionSimulation.SimulatedDisplayConfiguration.RightEyeRotation

ステレオ レンダリング用の、右目の回転。

Microsoft.PerceptionSimulation.SimulatedDisplayConfiguration.Ipd

ステレオ レンダリング用の、システムによって報告された Ipd 値。

Microsoft.PerceptionSimulation.SimulatedDisplayConfiguration.ApplyEyeTransforms

左目と右目の変換に指定された値を有効であると見なして実行中のシステムに適用するかどうか。

Microsoft.PerceptionSimulation.SimulatedDisplayConfiguration.ApplyIpd

Ipd に指定された値を有効であると見なして実行中のシステムに適用するかどうか。

Microsoft.PerceptionSimulation.IPerceptionSimulationManager

デバイスの制御に使用されるパケットを生成するためのルート。

public interface IPerceptionSimulationManager
{   
    ISimulatedDevice Device { get; }
    ISimulatedHuman Human { get; }
    void Reset();
}

Microsoft.PerceptionSimulation.IPerceptionSimulationManager.Device

シミュレートされた人とシミュレートされた世界を解釈する、シミュレートされたデバイス オブジェクトを取得します。

Microsoft.PerceptionSimulation.IPerceptionSimulationManager.Human

シミュレートされた人を制御するオブジェクトを取得します。

Microsoft.PerceptionSimulation.IPerceptionSimulationManager.Reset

シミュレーションを既定の状態にリセットします。

Microsoft.PerceptionSimulation.ISimulatedDevice

シミュレートされた世界とシミュレートされた人を解釈するデバイスを表すインターフェイス

public interface ISimulatedDevice
{
    ISimulatedHeadTracker HeadTracker { get; }
    ISimulatedHandTracker HandTracker { get; }
    void SetSimulatedDeviceType(SimulatedDeviceType type);
}

Microsoft.PerceptionSimulation.ISimulatedDevice.HeadTracker

シミュレートされたデバイスからヘッド トラッカーを取得します。

Microsoft.PerceptionSimulation.ISimulatedDevice.HandTracker

シミュレートされたデバイスからハンド トラッカーを取得します。

Microsoft.PerceptionSimulation.ISimulatedDevice.SetSimulatedDeviceType(Microsoft.PerceptionSimulation.SimulatedDeviceType)

シミュレートされたデバイスのプロパティを、指定したデバイスの種類に合わせて設定します。

パラメーター

  • type - シミュレートされたデバイスの新しい種類

Microsoft.PerceptionSimulation.ISimulatedDevice2

ISimulatedDevice を ISimulatedDevice2 にキャストすると、追加のプロパティを使用できます

public interface ISimulatedDevice2
{
    bool IsUserPresent { [return: MarshalAs(UnmanagedType.Bool)] get; [param: MarshalAs(UnmanagedType.Bool)] set; }
    SimulatedDisplayConfiguration DisplayConfiguration { get; set; }

};

Microsoft.PerceptionSimulation.ISimulatedDevice2.IsUserPresent

シミュレートされた人がヘッドセットをアクティブに装着しているかどうかを取得または設定します。

Microsoft.PerceptionSimulation.ISimulatedDevice2.DisplayConfiguration

シミュレートされたディスプレイのプロパティを取得または設定します。

Microsoft.PerceptionSimulation.ISimulatedHeadTracker

シミュレートされた人の頭を追跡するシミュレートされたデバイスの部分を表すインターフェイス。

public interface ISimulatedHeadTracker
{
    HeadTrackerMode HeadTrackerMode { get; set; }
};

Microsoft.PerceptionSimulation.ISimulatedHeadTracker.HeadTrackerMode

現在のヘッド トラッカー モードを取得および設定します。

Microsoft.PerceptionSimulation.ISimulatedHandTracker

シミュレートされた人の手を追跡するシミュレートされたデバイスの部分を表すインターフェイス

public interface ISimulatedHandTracker
{
    Vector3 WorldPosition { get; }
    Vector3 Position { get; set; }
    float Pitch { get; set; }
    bool FrustumIgnored { [return: MarshalAs(UnmanagedType.Bool)] get; [param: MarshalAs(UnmanagedType.Bool)] set; }
    Frustum Frustum { get; set; }
}

Microsoft.PerceptionSimulation.ISimulatedHandTracker.WorldPosition

世界に対するノードの位置をメートル単位で取得します。

Microsoft.PerceptionSimulation.ISimulatedHandTracker.Position

頭の中心を基準とした、シミュレートされたハンド トラッカーの位置を取得および設定します。

Microsoft.PerceptionSimulation.ISimulatedHandTracker.Pitch

シミュレートされたハンド トラッカーの下降ピッチを取得および設定します。

Microsoft.PerceptionSimulation.ISimulatedHandTracker.FrustumIgnored

シミュレートされたハンド トラッカーの視錐台を無視するかどうかを取得および設定します。 無視すると、両手が常に表示されます。 無視しない場合 (既定)、手は、ハンドト ラッカーの視錐台内にいる場合にのみ表示されます。

Microsoft.PerceptionSimulation.ISimulatedHandTracker.Frustum

シミュレートされたハンド トラッカーに手が見えるかどうかを判断するために使用される視錐台プロパティを取得および設定します。

Microsoft.PerceptionSimulation.ISimulatedHuman

シミュレートされた人を制御するための最上位のインターフェイス。

public interface ISimulatedHuman 
{
    Vector3 WorldPosition { get; set; }
    float Direction { get; set; }
    float Height { get; set; }
    ISimulatedHand LeftHand { get; }
    ISimulatedHand RightHand { get; }
    ISimulatedHead Head { get; }s
    void Move(Vector3 translation);
    void Rotate(float radians);
}

Microsoft.PerceptionSimulation.ISimulatedHuman.WorldPosition

世界に対するノードの位置をメートル単位で取得および設定します。 位置は、人の足の中心の点に対応します。

Microsoft.PerceptionSimulation.ISimulatedHuman.Direction

シミュレートされた人が世界の中で向いている方向を取得および設定します。 0 のラジアンでは、負の Z 軸から下を向いています。 正のラジアンでは、Y 軸を中心に時計回りに回転します。

Microsoft.PerceptionSimulation.ISimulatedHuman.Height

シミュレートされた人の身長をメートル単位で取得および設定します。

Microsoft.PerceptionSimulation.ISimulatedHuman.LeftHand

シミュレートされた人の左手を取得します。

Microsoft.PerceptionSimulation.ISimulatedHuman.RightHand

シミュレートされた人の右手を取得します。

Microsoft.PerceptionSimulation.ISimulatedHuman.Head

シミュレートされた人の頭を取得します。

Microsoft.PerceptionSimulation.ISimulatedHuman.Move(Microsoft.PerceptionSimulation.Vector3)

現在の位置を基準にして、シミュレートされた人をメートル単位で移動します。

パラメーター

  • translation - 現在の位置を基準とする移動。

Microsoft.PerceptionSimulation.ISimulatedHuman.Rotate(System.Single)

現在の方向を基準にして、シミュレートされた人を Y 軸を中心に時計回りに回転させます

パラメーター

  • radians - Y 軸を中心に回転する量。

Microsoft.PerceptionSimulation.ISimulatedHuman2

ISimulatedHuman を ISimulatedHuman2 にキャストすると、追加のプロパティを使用できます

public interface ISimulatedHuman2
{
    /* New members in addition to those available on ISimulatedHuman */
    ISimulatedSixDofController LeftController { get; }
    ISimulatedSixDofController RightController { get; }
}

Microsoft.PerceptionSimulation.ISimulatedHuman2.LeftController

左側の 6-DOF コントローラーを取得します。

Microsoft.PerceptionSimulation.ISimulatedHuman2.RightController

右側の 6-DOF コントローラーを取得します。

Microsoft.PerceptionSimulation.ISimulatedHand

シミュレートされた人の手を表すインターフェイス

public interface ISimulatedHand
{
    Vector3 WorldPosition { get; }
    Vector3 Position { get; set; }
    bool Activated { [return: MarshalAs(UnmanagedType.Bool)] get; [param: MarshalAs(UnmanagedType.Bool)] set; }
    bool Visible { [return: MarshalAs(UnmanagedType.Bool)] get; }
    void EnsureVisible();
    void Move(Vector3 translation);
    void PerformGesture(SimulatedGesture gesture);
}

Microsoft.PerceptionSimulation.ISimulatedHand.WorldPosition

世界に対するノードの位置をメートル単位で取得します。

Microsoft.PerceptionSimulation.ISimulatedHand.Position

人を基準にして、シミュレートされた手の位置をメートル単位で取得および設定します。

Microsoft.PerceptionSimulation.ISimulatedHand.Activated

手が現在アクティブになっているかどうかを取得および設定します。

Microsoft.PerceptionSimulation.ISimulatedHand.Visible

手が現在 SimulatedDevice に見えるかどうか (つまり、HandTracker によって検出される位置にあるかどうか) を取得します。

Microsoft.PerceptionSimulation.ISimulatedHand.EnsureVisible

SimulatedDevice に見えるように手を移動します。

Microsoft.PerceptionSimulation.ISimulatedHand.Move(Microsoft.PerceptionSimulation.Vector3)

現在の位置を基準にして、シミュレートされた手の位置をメートル単位で移動します。

パラメーター

  • translation - シミュレートされた手を移動する量。

Microsoft.PerceptionSimulation.ISimulatedHand.PerformGesture(Microsoft.PerceptionSimulation.SimulatedGesture)

シミュレートされた手を使用してジェスチャを実行します。 手が有効になっている場合にのみ、システムによって検出されます。

パラメーター

  • gesture - 実行するジェスチャ。

Microsoft.PerceptionSimulation.ISimulatedHand2

ISimulatedHand を ISimulatedHand2 にキャストすると、追加のプロパティを使用できます。

public interface ISimulatedHand2
{
    /* New members in addition to those available on ISimulatedHand */
    Rotation3 Orientation { get; set; }
}

Microsoft.PerceptionSimulation.ISimulatedHand2.Orientation

シミュレートされた手の回転を取得または設定します。 正のラジアンでは、軸に沿って見たときに時計回りに回転します。

Microsoft.PerceptionSimulation.ISimulatedHand3

ISimulatedHand を ISimulatedHand3 にキャストすると、追加のプロパティを使用できます

public interface ISimulatedHand3
{
    /* New members in addition to those available on ISimulatedHand and ISimulatedHand2 */
    GetJointConfiguration(SimulatedHandJoint joint, out SimulatedHandJointConfiguration jointConfiguration);
    SetJointConfiguration(SimulatedHandJoint joint, SimulatedHandJointConfiguration jointConfiguration);
    SetHandPose(SimulatedHandPose pose, bool animate);
}

Microsoft.PerceptionSimulation.ISimulatedHand3.GetJointConfiguration

指定した関節の関節構成を取得します。

Microsoft.PerceptionSimulation.ISimulatedHand3.SetJointConfiguration

指定した関節の関節構成を設定します。

Microsoft.PerceptionSimulation.ISimulatedHand3.SetHandPose

アニメーション化するためのオプションのフラグを使用して、手を既知のポーズに設定します。 注: アニメーション化によって、最終的な関節構成がすぐに反映されるわけではありません。

Microsoft.PerceptionSimulation.ISimulatedHead

シミュレートされた人の頭を表すインターフェイス。

public interface ISimulatedHead
{
    Vector3 WorldPosition { get; }
    Rotation3 Rotation { get; set; }
    float Diameter { get; set; }
    void Rotate(Rotation3 rotation);
}

Microsoft.PerceptionSimulation.ISimulatedHead.WorldPosition

世界に対するノードの位置をメートル単位で取得します。

Microsoft.PerceptionSimulation.ISimulatedHead.Rotation

シミュレートされた頭の回転を取得します。 正のラジアンでは、軸に沿って見たときに時計回りに回転します。

Microsoft.PerceptionSimulation.ISimulatedHead.Diameter

シミュレートされた頭の直径を取得します。 この値は、頭の中心 (回転点) を判定するために使用されます。

Microsoft.PerceptionSimulation.ISimulatedHead.Rotate(Microsoft.PerceptionSimulation.Rotation3)

現在の回転を基準として、シミュレートされた頭を回転させます。 正のラジアンでは、軸に沿って見たときに時計回りに回転します。

パラメーター

  • rotation - 回転の量。

Microsoft.PerceptionSimulation.ISimulatedHead2

ISimulatedHead を ISimulatedHead2 にキャストすると、追加のプロパティを利用できます

public interface ISimulatedHead2
{
    /* New members in addition to those available on ISimulatedHead */
    ISimulatedEyes Eyes { get; }
}

Microsoft.PerceptionSimulation.ISimulatedHead2.Eyes

シミュレートされた人の目を取得します。

Microsoft.PerceptionSimulation.ISimulatedSixDofController

シミュレートされた人に関連付けられた 6-DOF コントローラーを表すインターフェイス。

public interface ISimulatedSixDofController
{
    Vector3 WorldPosition { get; }
    SimulatedSixDofControllerStatus Status { get; set; }
    Vector3 Position { get; }
    Rotation3 Orientation { get; set; }
    void Move(Vector3 translation);
    void PressButton(SimulatedSixDofControllerButton button);
    void ReleaseButton(SimulatedSixDofControllerButton button);
    void GetTouchpadPosition(out float x, out float y);
    void SetTouchpadPosition(float x, float y);
}

Microsoft.PerceptionSimulation.ISimulatedSixDofController.WorldPosition

世界に対するノードの位置をメートル単位で取得します。

Microsoft.PerceptionSimulation.ISimulatedSixDofController.Status

コントローラーの現在の状態を取得または設定します。 移動、回転、または押すボタンの呼び出しが成功する前に、コントローラーの状態を "オフ" 以外の値に設定する必要があります。

Microsoft.PerceptionSimulation.ISimulatedSixDofController.Position

人を基準にして、シミュレートされたコントローラーの位置をメートル単位で取得または設定します。

Microsoft.PerceptionSimulation.ISimulatedSixDofController.Orientation

シミュレートされたコントローラーの向きを取得または設定します。

Microsoft.PerceptionSimulation.ISimulatedSixDofController.Move(Microsoft.PerceptionSimulation.Vector3)

現在の位置を基準にして、シミュレートされたコントローラーの位置をメートル単位で移動します。

パラメーター

  • translation - シミュレートされたコントローラーを移動する量。

Microsoft.PerceptionSimulation.ISimulatedSixDofController.PressButton(SimulatedSixDofControllerButton)

シミュレートされたコントローラーのボタンを押します。 コントローラーが有効になっている場合にのみ、システムによって検出されます。

パラメーター

  • button - 押すボタン。

Microsoft.PerceptionSimulation.ISimulatedSixDofController.ReleaseButton(SimulatedSixDofControllerButton)

シミュレートされたコントローラーのボタンを離します。 コントローラーが有効になっている場合にのみ、システムによって検出されます。

パラメーター

  • button - 離すボタン。

Microsoft.PerceptionSimulation.ISimulatedSixDofController.GetTouchpadPosition(out float, out float)

シミュレートされたコントローラーのタッチパッド上のシミュレートされた指の位置を取得します。

パラメーター

  • x - 指の水平位置。
  • y - 指の垂直位置。

Microsoft.PerceptionSimulation.ISimulatedSixDofController.SetTouchpadPosition(float, float)

シミュレートされたコントローラーのタッチパッド上のシミュレートされた指の位置を設定します。

パラメーター

  • x - 指の水平位置。
  • y - 指の垂直位置。

Microsoft.PerceptionSimulation.ISimulatedSixDofController2

ISimulatedSixDofController を ISimulatedSixDofController2 にキャストすると、追加のプロパティとメソッドを使用できます

public interface ISimulatedSixDofController2
{
    /* New members in addition to those available on ISimulatedSixDofController */
    void GetThumbstickPosition(out float x, out float y);
    void SetThumbstickPosition(float x, float y);
    float BatteryLevel { get; set; }
}

Microsoft.PerceptionSimulation.ISimulatedSixDofController2.GetThumbstickPosition(out float, out float)

シミュレートされたコントローラー上のシミュレートされたサムスティックの位置を取得します。

パラメーター

  • x - サムスティックの水平位置。
  • y - サムスティックの垂直位置。

Microsoft.PerceptionSimulation.ISimulatedSixDofController2.SetThumbstickPosition(float, float)

シミュレートされたコントローラー上のシミュレートされたサムスティックの位置を設定します。

パラメーター

  • x - サムスティックの水平位置。
  • y - サムスティックの垂直位置。

Microsoft.PerceptionSimulation.ISimulatedSixDofController2.BatteryLevel

シミュレートされたコントローラーのバッテリー レベルを取得または設定します。 値は、0.0 より大きく 100.0 以下である必要があります。

Microsoft.PerceptionSimulation.ISimulatedEyes

シミュレートされた人の目を表すインターフェイス。

public interface ISimulatedEyes
{
    Rotation3 Rotation { get; set; }
    void Rotate(Rotation3 rotation);
    SimulatedEyesCalibrationState CalibrationState { get; set; }
    Vector3 WorldPosition { get; }
}

Microsoft.PerceptionSimulation.ISimulatedEyes.Rotation

シミュレートされた目の回転を取得します。 正のラジアンでは、軸に沿って見たときに時計回りに回転します。

Microsoft.PerceptionSimulation.ISimulatedEyes.Rotate(Microsoft.PerceptionSimulation.Rotation3)

現在の回転を基準として、シミュレートされた目を回転させます。 正のラジアンでは、軸に沿って見たときに時計回りに回転します。

パラメーター

  • rotation - 回転の量。

Microsoft.PerceptionSimulation.ISimulatedEyes.CalibrationState

シミュレートされた視点の調整状態を取得または設定します。

Microsoft.PerceptionSimulation.ISimulatedEyes.WorldPosition

世界に対するノードの位置をメートル単位で取得します。

Microsoft.PerceptionSimulation.ISimulationRecording

再生用に読み込まれた単一の記録と対話するためのインターフェイス。

public interface ISimulationRecording
{
    StreamDataTypes DataTypes { get; }
    PlaybackState State { get; }
    void Play();
    void Pause();
    void Seek(UInt64 ticks);
    void Stop();
};

Microsoft.PerceptionSimulation.ISimulationRecording.DataTypes

記録内のデータ型の一覧を取得します。

Microsoft.PerceptionSimulation.ISimulationRecording.State

記録の現在の状態を取得します。

Microsoft.PerceptionSimulation.ISimulationRecording.Play

再生を開始します。 記録が一時停止されている場合は、一時停止された場所から再生が再開されます。停止されている場合は、最初から再生が開始されます。 既に再生中の場合、この呼び出しは無視されます。

Microsoft.PerceptionSimulation.ISimulationRecording.Pause

現在の場所で再生を一時停止します。 記録が停止されている場合、この呼び出しは無視されます。

Microsoft.PerceptionSimulation.ISimulationRecording.Seek(System.UInt64)

指定した時間 (先頭から 100 ナノ秒間隔) まで記録をシークし、その位置で一時停止します。 時間が記録の末尾を越えている場合は、最後のフレームで一時停止します。

パラメーター

  • ticks - シークする時間。

Microsoft.PerceptionSimulation.ISimulationRecording.Stop

再生を停止し、位置を先頭にリセットします。

Microsoft.PerceptionSimulation.ISimulationRecordingCallback

再生中に状態の変更を受信するためのインターフェイス。

public interface ISimulationRecordingCallback
{
    void PlaybackStateChanged(PlaybackState newState);
};

Microsoft.PerceptionSimulation.ISimulationRecordingCallback.PlaybackStateChanged(Microsoft.PerceptionSimulation.PlaybackState)

ISimulationRecording の再生状態が変更されたときに呼び出されます。

パラメーター

  • newState - 記録の新しい状態。

Microsoft.PerceptionSimulation.PerceptionSimulationManager

認識シミュレーション オブジェクトを作成するためのルート オブジェクト。

public static class PerceptionSimulationManager
{
    public static IPerceptionSimulationManager CreatePerceptionSimulationManager(ISimulationStreamSink sink);
    public static ISimulationStreamSink CreatePerceptionSimulationRecording(string path);
    public static ISimulationRecording LoadPerceptionSimulationRecording(string path, ISimulationStreamSinkFactory factory);
    public static ISimulationRecording LoadPerceptionSimulationRecording(string path, ISimulationStreamSinkFactory factory, ISimulationRecordingCallback callback);

Microsoft.PerceptionSimulation.PerceptionSimulationManager.CreatePerceptionSimulationManager(Microsoft.PerceptionSimulation.ISimulationStreamSink)

シミュレートされたパケットを生成し、指定したシンクに提供するためのオブジェクトを作成します。

パラメーター

  • sink - 生成されたすべてのパケットを受信するシンク。

戻り値

作成されたマネージャー。

Microsoft.PerceptionSimulation.PerceptionSimulationManager.CreatePerceptionSimulationRecording(System.String)

受信したすべてのパケットを指定されたパスのファイルに格納するシンクを作成します。

パラメーター

  • path - 作成するファイルのパス。

戻り値

作成されたシンク。

Microsoft.PerceptionSimulation.PerceptionSimulationManager.LoadPerceptionSimulationRecording(System.String,Microsoft.PerceptionSimulation.ISimulationStreamSinkFactory)

指定したファイルから記録を読み込みます。

パラメーター

  • path - 読み込むファイルのパス。
  • factory - 必要に応じて ISimulationStreamSink を作成するために記録によって使用されるファクトリ。

戻り値

読み込まれた記録。

Microsoft.PerceptionSimulation.PerceptionSimulationManager.LoadPerceptionSimulationRecording(System.String,Microsoft.PerceptionSimulation.ISimulationStreamSinkFactory,Microsoft.PerceptionSimulation.ISimulationRecordingCallback)

指定したファイルから記録を読み込みます。

パラメーター

  • path - 読み込むファイルのパス。
  • factory - 必要に応じて ISimulationStreamSink を作成するために記録によって使用されるファクトリ。
  • callback - 記録の状態に関する更新を受け取るコールバック。

戻り値

読み込まれた記録。

Microsoft.PerceptionSimulation.StreamDataTypes

さまざまなストリーム データの型を表します。

public enum StreamDataTypes
{
    None = 0x00,
    Head = 0x01,
    Hands = 0x02,
    SpatialMapping = 0x08,
    Calibration = 0x10,
    Environment = 0x20,
    SixDofControllers = 0x40,
    Eyes = 0x80,
    DisplayConfiguration = 0x100
    All = None | Head | Hands | SpatialMapping | Calibration | Environment | SixDofControllers | Eyes | DisplayConfiguration
}

Microsoft.PerceptionSimulation.StreamDataTypes.None

ストリーム データ型がないことを示すために使用されるセンチネル値。

Microsoft.PerceptionSimulation.StreamDataTypes.Head

頭の位置と向きに関するデータのストリーム。

Microsoft.PerceptionSimulation.StreamDataTypes.Hands

手の位置とジェスチャに関するデータのストリーム。

Microsoft.PerceptionSimulation.StreamDataTypes.SpatialMapping

環境の空間マッピングに関するデータのストリーム。

Microsoft.PerceptionSimulation.StreamDataTypes.Calibration

デバイスの調整に関するデータのストリーム。 調整パケットは、リモート モードのシステムでのみ受け入れられます。

Microsoft.PerceptionSimulation.StreamDataTypes.Environment

デバイスの環境に関するデータのストリーム。

Microsoft.PerceptionSimulation.StreamDataTypes.SixDofControllers

モーション コントローラーに関するデータのストリーム。

Microsoft.PerceptionSimulation.StreamDataTypes.Eyes

シミュレートされた人の目に関するデータのストリーム。

Microsoft.PerceptionSimulation.StreamDataTypes.DisplayConfiguration

デバイスのディスプレイ構成に関するデータのストリーム。

Microsoft.PerceptionSimulation.StreamDataTypes.All

すべての記録されたデータ型を示すために使用されるセンチネル値。

Microsoft.PerceptionSimulation.ISimulationStreamSink

シミュレーション ストリームからデータ パケットを受信するオブジェクト。

public interface ISimulationStreamSink
{
    void OnPacketReceived(uint length, byte[] packet);
}

Microsoft.PerceptionSimulation.ISimulationStreamSink.OnPacketReceived(uint length, byte[] packet)

内部的に型指定され、バージョン管理される単一のパケットを受信します。

パラメーター

  • length - パケットの長さ。
  • packet - パケットのデータ。

Microsoft.PerceptionSimulation.ISimulationStreamSinkFactory

ISimulationStreamSink を作成するオブジェクト。

public interface ISimulationStreamSinkFactory
{
    ISimulationStreamSink CreateSimulationStreamSink();
}

Microsoft.PerceptionSimulation.ISimulationStreamSinkFactory.CreateSimulationStreamSink()

ISimulationStreamSink の単一インスタンスを作成します。

戻り値

作成されたシンク。