Contenuto principale

roadrunnerAPI

RoadRunner authoring API

Since R2025a

    Description

    The roadrunnerAPI object enables you to programmatically author RoadRunner scenes and scenarios, such as by creating roads and lanes, adding actors, and building scenario logic, using MATLAB®. By authoring scenes and scenarios programmatically, you can quickly automate repetitive authoring tasks, generate variations for automated tests, and build and modify simulation parameters without switching between applications. To use the RoadRunner authoring API in MATLAB, you must first create a roadrunnerAPI object for your RoadRunner session.

    Creation

    Description

    rrApi = roadrunnerAPI(rrApp) returns the RoadRunner authoring API object rrApi for the current RoadRunner session rrApp.

    Input Arguments

    expand all

    RoadRunner application, specified as a roadrunner object.

    Properties

    expand all

    This property is read-only.

    Current RoadRunner scene, represented as a Scene (RoadRunner) object.

    Example: scn = rrApi.Scene extracts the scene object scn from the Scene property of the RoadRunner authoring API rrApi.

    This property is read-only.

    Current RoadRunner scenario, represented as a Scenario (RoadRunner Scenario) object.

    Example: scnro = rrApi.Scenario extracts the scenario object scnro from the Scenario property of the RoadRunner authoring API rrApi.

    This property is read-only.

    Current RoadRunner project, represented as a Project object.

    Examples

    collapse all

    Create a roadrunner object, specifying the path to an existing project. For example, this code shows the path to a project, on a Windows® machine, located at "C:\RR\MyProject". This code assumes that RoadRunner is installed in the default location, and returns an object, rrApp, that provides functions for performing basic tasks such as opening, closing, and saving scenes and projects.

    rrApp = roadrunner(ProjectFolder="C:\RR\MyProject");

    Note

    If you are opening RoadRunner from MATLAB for the first time, or if you have changed the RoadRunner installation location since you last opened it from MATLAB, you can use the roadrunnerSetup function to specify new default project and installation folders to use when opening RoadRunner. You can save these folders between MATLAB sessions by selecting the Across MATLAB sessions option from the corresponding drop down.

    Open an existing scene in RoadRunner by using the openScene function, specifying the roadrunner object rrApp and the filename of the specific scene that you want to open. Then, use the newScenario function to create a new scenario.

    openScene(rrApp,"ScenarioBasic.rrscene")
    newScenario(rrApp)

    Create an object for the RoadRunner authoring API, rrAPI, that references the object for the current RoadRunner instance rrApp. The rrApi object enables you to programmatically author scenes and scenarios, such as by adding and modifying roads, lanes, actors, and logic components, using MATLAB.

    rrApi = roadrunnerAPI(rrApp);
    

    Limitations

    • If you do not open RoadRunner from MATLAB using the roadrunner function, or if you open a RoadRunner session before opening MATLAB, you must add the path to the folder containing the RoadRunner authoring API to your MATLAB session before you can use the RoadRunner authoring API functions. By default, the location of the RoadRunner authoring API folder on Windows is C:\Program Files\RoadRunner R20NNx\bin\win64\Tools\MATLAB\api, where R20NNx is the release version you are using.

    Version History

    Introduced in R2025a

    See Also

    (RoadRunner Scenario) | | (RoadRunner Scenario) | (RoadRunner Scenario) | (RoadRunner Scenario)