docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Class RangeMsg

    ROS sensor_msgs/Range message.

    Inheritance
    object
    RangeMsg
    Implements
    IMessage
    Inherited Members
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    Namespace: Unity.SimulationPro.Foundation.SensorMessages
    Assembly: Unity.SimulationPro.Foundation.dll
    Syntax
    [Serializable]
    public class RangeMsg : IMessage

    Constructors

    RangeMsg()

    Initializes a new instance with default values.

    Declaration
    public RangeMsg()

    RangeMsg(HeaderMsg, byte, float, float, float, float)

    Initializes a new instance with default values.

    Declaration
    public RangeMsg(HeaderMsg header, byte radiation_type, float field_of_view, float min_range, float max_range, float range)
    Parameters
    Type Name Description
    HeaderMsg header

    ROS message header containing timestamp and coordinate frame identifier.

    byte radiation_type

    Sensor radiation type code (ultrasound, infrared, etc.).

    float field_of_view

    Angular field of view of the sensor in radians.

    float min_range

    Minimum valid range in meters.

    float max_range

    Maximum valid range in meters.

    float range

    Measured range value in meters.

    Fields

    INFRARED

    Radiation type constant for infrared sensors.

    Declaration
    public const byte INFRARED = 1
    Field Value
    Type Description
    byte

    ULTRASOUND

    timestamp in the header is the time the ranger returned the distance reading Radiation type enums If you want a value added to this list, send an email to the ros-users list

    Declaration
    public const byte ULTRASOUND = 0
    Field Value
    Type Description
    byte

    field_of_view

    Angular field of view of the sensor in radians.

    Declaration
    public float field_of_view
    Field Value
    Type Description
    float

    header

    Single range reading from an active ranger that emits energy and reports one range reading that is valid along an arc at the distance measured. This message is not appropriate for laser scanners. See the LaserScan message if you are working with a laser scanner. This message also can represent a fixed-distance (binary) ranger. This sensor will have min_range===max_range===distance of detection. These sensors follow REP 117 and will output -Inf if the object is detected and +Inf if the object is outside of the detection range.

    Declaration
    public HeaderMsg header
    Field Value
    Type Description
    HeaderMsg

    k_MessageTypeId

    Identifier for this message type.

    Declaration
    public static readonly MessageTypeId k_MessageTypeId
    Field Value
    Type Description
    MessageTypeId

    k_MessageTypeName

    The ROS message type name string used for serialization and topic matching.

    Declaration
    public const string k_MessageTypeName = "sensor_msgs/Range"
    Field Value
    Type Description
    string

    max_range

    Maximum valid range value in meters. Fixed-distance rangers require min_range == max_range.

    Declaration
    public float max_range
    Field Value
    Type Description
    float

    min_range

    Minimum valid range value in meters.

    Declaration
    public float min_range
    Field Value
    Type Description
    float

    radiation_type

    Radiation type field.

    Declaration
    public byte radiation_type
    Field Value
    Type Description
    byte

    range

    Measured range value in meters. Returns -Inf if object is detected (for fixed-distance rangers) or +Inf if outside detection range.

    Declaration
    public float range
    Field Value
    Type Description
    float

    Properties

    MessageTypeId

    Gets the unique runtime identifier for this message type.

    Declaration
    public MessageTypeId MessageTypeId { get; }
    Property Value
    Type Description
    MessageTypeId

    MessageTypeName

    Gets the ROS message type name for this message.

    Declaration
    public string MessageTypeName { get; }
    Property Value
    Type Description
    string

    Methods

    Deserialize(IMessageDeserializer)

    Deserializes a RangeMsg from the given deserializer.

    Declaration
    public static RangeMsg Deserialize(IMessageDeserializer deserializer)
    Parameters
    Type Name Description
    IMessageDeserializer deserializer

    The deserializer.

    Returns
    Type Description
    RangeMsg

    A new RangeMsg instance.

    Register()

    Registers this message type with the MessageTypeRegistry.

    Declaration
    [InitializeOnLoadMethod]
    public static void Register()

    ToString()

    Returns a human-readable string representation of this message.

    Declaration
    public override string ToString()
    Returns
    Type Description
    string

    A string representation of this instance.

    Overrides
    object.ToString()

    WriteTo(IMessageSerializer)

    Serializes this message to the given serializer.

    Declaration
    public void WriteTo(IMessageSerializer serializer)
    Parameters
    Type Name Description
    IMessageSerializer serializer

    The serializer.

    Implements

    IMessage
    In This Article
    Back to top
    Copyright © 2026 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)