docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Connect to a live Robot Operating System environment

    Bridge a Simulation Pro scene to a running ROS environment using the ROS Endpoint Connector.

    The RosEndpointConnector provides a TCP connection to a ROS TCP Endpoint bridge, implementing IConnector for both ROS 1 and ROS 2.

    Add the component

    Add RosEndpointConnectorComponent to a GameObject in your scene:

    1. Create an empty GameObject (for example ROS Connection).
    2. Add the Ros Endpoint Connector Component component to it.
    3. Set Endpoint IP Address and Endpoint Port to match your ROS TCP Endpoint server.
    4. Set Is Ros 2 to match the ROS version used by the endpoint.

    ConnectorInjector discovers this component automatically. All PublisherBehaviour, SubscriberBehaviour, and AutoPublisher instances in the scene will use it without additional configuration.

    For the full list of inspector properties, refer to ROS Endpoint Connector reference

    Connection lifecycle

    • Connect() starts a background thread that maintains the TCP connection and reconnects on failure.
    • Disconnect() cancels the background thread and closes the socket.
    • When a connection is established, all registered publishers and subscribers are automatically re-registered with the endpoint.
    • When the connection is lost, subscriber and publisher registrations are reset and will be re-sent on reconnection.

    Check connection state

    if (connector.HasConnectionError)
        Debug.LogWarning("ROS connection error!");
    

    HasConnectionError is true while the connector is actively trying to reconnect after a failure.

    Additional resources

    • Troubleshooting the ROS Endpoint Connector
    • ROS Endpoint Connector reference
    • Introduction to messaging
    • Set up publishers and subscribers workflow
    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)