Main Content

createSimulation

Create RoadRunner Scenario simulation using MATLAB

Since R2022a

    Description

    rrSim = createSimulation(rrApp) creates and returns a scenario simulation object for the current scenario.

    example

    Examples

    collapse all

    Create a scenario simulation object in RoadRunner Scenario using MATLAB.

    Call the roadrunner function and pass in the location where you want to create the project. This example assumes that RoadRunner is installed in its default location in Windows.

    Specify the path to an existing project. For example, this code shows the path to a project located at "C:\RR\MyProject". This call returns an object rrApp that provides functions for performing basic workflow tasks such as opening, closing, and saving scenes and projects

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

    Open an existing scenario in RoadRunner Scenario by calling the openScenario function and passing it the rrApp object and the specific scenario filename that you want to open. This call opens the desired scenario in the RoadRunner Scenario application through MATLAB.

    filename = "MyScenario.rrscenario";
    openScenario(rrApp,filename);

    Create a scenario simulation object by calling the createSimulation function and passing it the rrApp object. This call returns a simulation object rrSim for the current scenario, through which you can control the simulation programmatically.

    rrSim = createSimulation(rrApp);
    Connection status: 1
    Connected to RoadRunner Scenario server on localhost:61720, with client id {fb457314-9501-4395-af0d-5a51912f14f9}
    

    Input Arguments

    collapse all

    RoadRunner application associated with a project, specified 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.

    Output Arguments

    collapse all

    RoadRunner Scenario simulation object, specified as a ScenarioSimulation (Automated Driving Toolbox) object. This object enables you to control a simulation, access and modify the runtime parameters of a simulation, and report custom diagnostic messages during a simulation.

    Limitations

    • Each MATLAB® instance can connect with only one RoadRunner Scenario cosimulation server.

    Tips

    Version History

    Introduced in R2022a