Main Content

openSimulationInterface

Store RoadRunner Scenario simulation data in ASAM Open Simulation Interface (OSI) format

Since R2024b

    Description

    An openSimulationInterface object enables you to store and write RoadRunner Scenario simulation data, such as ground truth information and sensor view information, in the ASAM Open Simulation Interface (OSI)® V3.5.0 format. The OSI format is an open file format designed to focus on the environmental perception of automated driving functions. It enables automated driving functions to easily work with many different driving simulation frameworks. OSI includes an object-based environment description that uses the Google® Protocol Buffer (protobuf) message format. You can simulate the specified scenario and populate the SensorView property of the object with information from the environmental perception of the specified sensors in OSI format by using the startRoadRunnerSimulation object function. You can also write the OSI data of each sensor to a distinct binary file by using the write object function.

    Creation

    Description

    osiData = openSimulationInterface(scenarioSim,sensors) creates an empty openSimulationInterface object associated with the specified scenario simulation scenarioSim. The object adds the specified sensors sensors to the simulation.

    example

    Input Arguments

    expand all

    RoadRunner Scenario simulation for which to store the OSI data, specified as a ScenarioSimulation object.

    Sensors to add to the RoadRunner Scenario simulation, specified as one of these options:

    Each detection generator must have a unique sensor ID, specified by its SensorIndex property.

    Properties

    expand all

    Ground truth message of the OSI data, specified as an array of openstandards.osi.GroundTruth objects. This message describes the simulated environment of a scenario, detailing all the simulated objects surrounding an ego vehicle within the combined field of view of its attached sensors. For more information on the properties of this object, see the attributes of the OSI GroundTruth message.

    Sensor view message of the OSI data, specified as an array of openstandards.osi.SensorView objects. The sensor view message derives from the ground truth message, and includes information from the environmental perception of the sensors attached to the ego vehicle during scenario simulation. The sensor models use the sensor view information as input, to simulate actual sensors. For more information on the properties of this object, see the attributes of the OSI SensorView message.

    Sensor data message of the OSI data, specified as an array of openstandards.osi.SensorData objects. The sensor data message contains information from the environmental perception of the sensors attached to the ego vehicle during scenario simulation. The sensor models process the sensor data information to replicate the output of the real sensors. For more information on the properties of this object, see the attributes of the OSI SensorData message.

    Traffic command message of the OSI data, specified as an array of openstandards.osi.TrafficCommand objects. This message contains control commands to control the traffic participant models in a scenario. For more information on the properties of this object, see the attributes of the OSI TrafficCommand message.

    Traffic update message of the OSI data, specified as an array of openstandards.osi.TrafficUpdtae objects. The traffic participant models of a scenario provide the traffic update message. This message updates their positions, states, and future trajectories in the simulation environment. For more information on the properties of this object, see the attributes of the OSI TrafficUpdate message.

    Object Functions

    startRoadRunnerSimulationStart RoadRunner Scenario simulation
    writeWrite OSI data to binary file
    getProtoMessageGet OSI protocol buffer (protobuf) message at each simulation step

    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");

    Version History

    Introduced in R2024b