Main Content

startRoadRunnerSimulation

Start RoadRunner Scenario simulation

Since R2024b

    Description

    startRoadRunnerSimulation(osiData) starts the RoadRunner Scenario simulation, and stores the sensor view data in the specified OSI object during simulation.

    example

    Examples

    collapse all

    Create a roadrunner object to launch the RoadRunner application, which then connects to the project folder at the specified path.

    rrApp = roadrunner(ProjectFolder="C:\OsiRoadRunnerProject\");

    Open the scenario file TrajectoryCutIn.rrscenario. This scenario is included with the RoadRunner Scenario application.

    openScenario(rrApp,"TrajectoryCutIn");

    Create scenarioSim, a ScenarioSimulation object, to connect MATLAB® to the RoadRunner Scenario simulation.

    scenarioSim = createSimulation(rrApp);

    Create sensorSim, a RoadRunner SensorSimulation object, to control the sensor configuration for the RoadRunner Scenario simulation.

    sensorSim = get(scenarioSim,"SensorSimulation");

    Configure the sensor model for a radar sensor, to add to the ego vehicle, using a drivingRadarDataGenerator object.

    radar = drivingRadarDataGenerator(SensorIndex=1, ...
          MountingLocation=[2.4 0 0.2], ...
          RangeLimits=[0 100], ...
          TargetReportFormat="Detections");
    
    sensors = {radar};

    Add the sensor to the ego vehicle actor in the RoadRunner scenario. Specify the Actor ID property of the vehicle.

    egoVehicleID = 1;
    addSensors(sensorSim,sensors,egoVehicleID);

    Create osiData, a RoadRunner openSimulationInterface object, to store RoadRunner Scenario simulation data in OSI format.

    osiData = openSimulationInterface(scenarioSim,sensors);

    Start the RoadRunner simulation, storing the scenario simulation data in OSI format in the osiData object.

    startRoadRunnerSimulation(osiData);

    Specify a custom filename for an output binary file, with a .txt extension, and write the OSI data of the sensor to the OSI trace file.

    write(osiData,"testEgoFollowSpeed.txt");

    Input Arguments

    collapse all

    Open simulation interface object, specified as an openSimulationInterface object. This function starts the RoadRunner Scenario simulation and populates the SensorView property of the specified openSimulationInterface object with the sensor view data during simulation. The object stores the data as an M-by-N matrix of openstandards.osi.SensorView objects. M is the number of sensors in the scenario, and N is the number of simulation steps.

    Version History

    Introduced in R2024b