startRoadRunnerSimulation
Description
Examples
Generate OSI Trace File Using Single Sensor
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
osiData
— Open simulation interface object
openSimulationInterface
object
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
See Also
Objects
Functions
External Websites
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
Asia Pacific
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)