Main Content

roadrunner.connect

Connect to open instance of RoadRunner using MATLAB

Since R2022a

    Description

    rrApp = roadrunner.connect returns an rrApp object for the most recently opened instance of RoadRunner.

    example

    rrApp = roadrunner.connect(apiPort) returns an rrApp object for an open RoadRunner application running an API server on the specified IP network port, apiPort.

    example

    rrApp = roadrunner.connect(apiPort,cosimPort) returns an rrApp object for an open RoadRunner application. It optionally specifies the scenario simulation API server port using cosimPort.

    example

    Examples

    collapse all

    Connect to the last opened instance of RoadRunner application using MATLAB.

    Use the connect function to connect to the last opened instance of RoadRunner. This call returns an object rrApp that provides functions for performing basic workflow tasks such as opening, closing, and saving scenes and projects.

    rrApp = roadrunner.connect();

    Connect to an open instance of RoadRunner application running on the specified IP Network Port.

    Call the connect function and pass it the apiPort as an argument. This call returns an rrApp object for an open RoadRunner application running on API server on the specified IP network port.

    apiPort = 28703;
    rrApp = roadrunner.connect(apiPort);

    Connect to an open instance of RoadRunner application running on the specified IP network and scenario simulation API server ports.

    Call the connect function and pass it the apiPort and cosimPort as arguments. The apiPort specifies the IP network port and the cosimPort specifies the scenario simulation API server port respectively for the RoadRunner application. This call returns an rrApp object for an open RoadRunner application running on API server on the specified IP network and scenario simulation ports.

    apiPort = 35707;
    cosimPort = 35706;
    rrApp = roadrunner.connect(apiPort,cosimPort); 

    Input Arguments

    collapse all

    IP network port for RoadRunner API server, specified as a default value of 35707. This server receives commands from the RoadRunner service methods for importing and exporting scenes and scenarios. The API server runs locally at localhost:apiPort after you open a RoadRunner project. Specify apiPort as an integer in the range [1024, 65535]. If apiPort is unspecified, a default value of 35707 is used for connecting.

    Example: roadrunner.connect(54321)

    Data Types: int

    IP network port for RoadRunner Scenario co-simulation server, specified as a default value of 35706. This server receives commands for co-simulation with MATLAB® and Simulink® and with external simulators such as CARLA (requires RoadRunner Scenario). Specify cosimPort as an integer in the range [1024, 65535]. If apiPort is unspecified, a default value of 35706 is used for connecting.

    Example: roadrunner.connect(54321,54322)

    Data Types: int

    Output Arguments

    collapse all

    RoadRunner application associated with a project, returned as a roadrunner object. This object provides functions for performing common workflow tasks such as opening, closing, and saving scenes and projects. rrApp provides functions that support importing data from files and exporting scenes to other formats from RoadRunner.

    Version History

    Introduced in R2022a