docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Class SensorHelper

    Utility methods related to ISensor implementations.

    Inheritance
    object
    SensorHelper
    Inherited Members
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: Unity.MLAgents.Sensors
    Assembly: Unity.ML-Agents.dll
    Syntax
    public static class SensorHelper

    Methods

    CompareObservation(ISensor, float[,,], out string)

    Generates the observations for the provided sensor, and returns true if they equal the expected values. If they are unequal, errorMessage is also set. This should not generally be used in production code. It is only intended for simplifying unit tests.

    Declaration
    public static bool CompareObservation(ISensor sensor, float[,,] expected, out string errorMessage)
    Parameters
    Type Name Description
    ISensor sensor

    ISensor to generate observation from.

    float[,,] expected

    The expected observations.

    string errorMessage

    The error message to throw if sensor observation doesn't match.

    Returns
    Type Description
    bool

    True if the generated observation for the provided sensor equal the expected values, False if not.

    CompareObservation(ISensor, float[], out string)

    Generates the observations for the provided sensor, and returns true if they equal the expected values. If they are unequal, errorMessage is also set. This should not generally be used in production code. It is only intended for simplifying unit tests.

    Declaration
    public static bool CompareObservation(ISensor sensor, float[] expected, out string errorMessage)
    Parameters
    Type Name Description
    ISensor sensor

    The ISensor to compare observation from.

    float[] expected

    The expected observations.

    string errorMessage

    The error message to throw if sensor observation doesn't match.

    Returns
    Type Description
    bool

    True if the observations for the provided sensor equal the expected values, False if not.

    In This Article
    Back to top
    Copyright © 2025 Unity Technologies — Trademarks and terms of use
    • Legal
    • Privacy Policy
    • Cookie Policy
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)