getProtoMessage
Description
Examples
Get OSI Protocol Buffer Message
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], ... FieldOfView =[40 5], ... 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);
Use the ScenarioSimulation
object, to step through the RoadRunner scenario, and get the OSI protocol buffer message from the openSimulationInterface
object at each simulation step.
set(scenarioSim,SimulationCommand="Start"); set(scenarioSim,SimulationCommand="Pause"); pause(0.5); while ~isequal(get(scenarioSim,"SimulationStatus"),"Stopped") osiProtoMessage = getProtoMessage(osiData); set(scenarioSim,SimulationCommand="Step"); end
Input Arguments
osiData
— Open simulation interface object
openSimulationInterface
object
Open simulation interface object, specified as an openSimulationInterface
object. This function returns the
SensorView
property of the specified
openSimulationInterface
object at each simulation step.
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 (한국어)