docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Class MagneticFieldMsg

    ROS sensor_msgs/MagneticField message.

    Inheritance
    object
    MagneticFieldMsg
    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 MagneticFieldMsg : IMessage

    Constructors

    MagneticFieldMsg()

    Row major about x, y, z axes 0 is interpreted as variance unknown

    Declaration
    public MagneticFieldMsg()

    MagneticFieldMsg(HeaderMsg, Vector3Msg, double[])

    Initializes a new instance with default values.

    Declaration
    public MagneticFieldMsg(HeaderMsg header, Vector3Msg magnetic_field, double[] magnetic_field_covariance)
    Parameters
    Type Name Description
    HeaderMsg header

    ROS message header containing timestamp and coordinate frame identifier.

    Vector3Msg magnetic_field

    Measured magnetic field vector in Tesla.

    double[] magnetic_field_covariance

    Row-major 3×3 covariance matrix for the magnetic field.

    Fields

    header

    Measurement of the Magnetic Field vector at a specific location. If the covariance of the measurement is known, it should be filled in. If all you know is the variance of each measurement, e.g. from the datasheet, just put those along the diagonal. A covariance matrix of all zeros will be interpreted as "covariance unknown", and to use the data a covariance will have to be assumed or gotten from some other source.

    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/MagneticField"
    Field Value
    Type Description
    string

    magnetic_field

    timestamp is the time the field was measured frame_id is the location and orientation of the field measurement

    Declaration
    public Vector3Msg magnetic_field
    Field Value
    Type Description
    Vector3Msg

    magnetic_field_covariance

    x, y, and z components of the field vector in Tesla If your sensor does not output 3 axes, put NaNs in the components not reported.

    Declaration
    public double[] magnetic_field_covariance
    Field Value
    Type Description
    double[]

    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 MagneticFieldMsg from the given deserializer.

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

    The deserializer.

    Returns
    Type Description
    MagneticFieldMsg

    A new MagneticFieldMsg 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)