docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Class RosTopicState

    Tracks the per-topic state for a single ROS topic within a RosEndpointConnector, implementing both IPublisher and ITopicInfo.

    Inheritance
    object
    RosTopicState
    Implements
    IPublisher
    ITopicInfo
    Inherited Members
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: Unity.SimulationPro.RosIntegrations
    Assembly: Unity.SimulationPro.RosIntegrations.dll
    Syntax
    public class RosTopicState : IPublisher, ITopicInfo
    Remarks

    A RosTopicState is created by RosEndpointConnector the first time a topic is subscribed to, published on, or registered as a service. It manages publisher registration, subscriber callbacks, service implementation dispatch, and per-topic message statistics.

    Properties

    Connector

    Gets the IConnector that owns this topic state.

    Declaration
    public IConnector Connector { get; }
    Property Value
    Type Description
    IConnector

    IsPublisher

    Gets a value indicating whether this topic has been registered as a publisher.

    Declaration
    public bool IsPublisher { get; }
    Property Value
    Type Description
    bool

    IsSubscriber

    Gets a value indicating whether this topic has at least one active subscriber registration.

    Declaration
    public bool IsSubscriber { get; }
    Property Value
    Type Description
    bool

    LastReceivedAtWallTime

    Gets the wall-clock time at which the most recent message was received on this topic.

    Declaration
    public DateTime LastReceivedAtWallTime { get; }
    Property Value
    Type Description
    DateTime

    LastSentAtWallTime

    Gets the wall-clock time at which the most recent message was sent on this topic.

    Declaration
    public DateTime LastSentAtWallTime { get; }
    Property Value
    Type Description
    DateTime

    MessageTypeId

    Gets the ROS message type identifier associated with this topic.

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

    SentSubscriberRegistration

    Gets a value indicating whether the subscriber registration message has been sent to the endpoint.

    Declaration
    public bool SentSubscriberRegistration { get; }
    Property Value
    Type Description
    bool

    ServiceResponseTopic

    Gets the companion RosTopicState used to receive service responses on this topic. Only set when this state represents a service client.

    Declaration
    public RosTopicState ServiceResponseTopic { get; }
    Property Value
    Type Description
    RosTopicState

    Topic

    Gets the ROS topic name this state object represents.

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

    Methods

    AddSubscriber(Action<IMessage>)

    Adds a callback that is invoked each time a message is received on this topic, and sends the subscriber registration to the endpoint if a connection is active.

    Declaration
    public void AddSubscriber(Action<IMessage> callback)
    Parameters
    Type Name Description
    Action<IMessage> callback

    The callback to invoke with each incoming IMessage.

    Publish(IMessage)

    Enqueues message for delivery to the ROS endpoint on this topic.

    Declaration
    public void Publish(IMessage message)
    Parameters
    Type Name Description
    IMessage message

    The message to publish.

    SetMessagePool(IMessagePool)

    Assigns a message pool to this topic's outgoing queue, enabling pre-allocated message reuse.

    Declaration
    public void SetMessagePool(IMessagePool messagePool)
    Parameters
    Type Name Description
    IMessagePool messagePool

    The pool to use for allocating outgoing messages.

    Implements

    IPublisher
    ITopicInfo
    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)