Driving Scenario Designer App 

 August 13, 2021

By  Abhishek Tyagi


Autonomous driving has become an enormous attention seeker from industry, road authorities, associate degreed consumers. Virtual validation provides an economical and systematic means to check these systems. Such validation needs simulation environments that closely agree with real-world environments and embody management algorithms, choices for making traffic scenarios, device models, and representations of auto dynamics. This document first shows various options for generating virtual driving scenarios, drafting virtual driving scenarios using scripts and graphical user interfaces, importing scenarios from existing libraries, and generating scenarios from logged data from vehicle sensors. In a second section, let us explain how to create variations of an existing scenario programmatically. The generated scenarios may be employed in closed-loop simulations to model and check controllers.

Verification of autonomous driving systems (AD) requires, in addition to road testing, computer-based simulation in which testing and testing skills are tested under several completely different conditions. Such situations welcome events such as a photo display, a change in the color of the road marker, or unusual objects in the driving area. Compared to the ancient methods of car simulation, the simulation of AD requires a model not only of the ego car but in conjunction with the behavior of cars, pedestrians, and other athletes. The simulation should also be a model for sensors such as lidars, cameras, and radars to alter the sensitivity of the artificial hearing device. AD programs cannot be performed while they are not simulations. This paper often explains the different options for creating a situation and imitating it in MATLAB®. We usually point to 2 examples of cuboid simulation scenarios that show that they have emerged in the form of the details of the recorded car and how to systematically change the parameters of the situation to produce more traffic conditions on a fixed road. The MATLAB-supported framework provides two simulation areas where you can test algorithms: cuboids and 3D. each area has its blessings and helps in various development processes.

Cuboidal Simulation

In this case, cars and other status actors are portrayed as simple box situations. This simulation tool is helpful for quick recording situations, generating detection using low-fidelity radars and camera sensors, and test and track controls and sensor fusion algorithms.

The left side shows road topology with vehicle trajectories. The right side shows a running simulation.

The left side shows road topology with vehicle trajectories. The right side shows a running simulation.

Cuboid conditions can be created by hand typing the MATLAB code or through the Driving Scenario Designer app, which allows the user to:

• Create street and character models using a drag and drop interface.

• Prepare vision and radar sensors embedded in the ego car and use these sensors to mimic the discovery of characters and line limits in the situation.

• Upload driving conditions representing European New Car Test System (Euro NCAP®) test protocols and other reconstructed states.

• Enter OpenDRIVE® open lanes and openings in driving situations. The application supports OpenDRIVE format entries version 1.4H.

• Send activity sensor detection to MATLAB.

• Generate MATLAB code of state and senses and change the status according to the programs re-enter the app for continuous simulation.

• Repeat the Simulink® model from the standpoint sensors, and use the models produced to test your sensor mixing or motor control techniques.

3D Simulation Environment

With this option, the scenarios are presented using Unreal Engine® from Epic Games® and are displayed using realistic graphics. Synthetic high-fidelity sensor data is designed for radars, cameras, and lidars and is used for route planning, vehicle control, cognitive algorithms, and event detection systems.

3D simulation environment.

3D simulation environment.

Closed-Loop Simulations

After the visual system has been tested and developed, it can be an integral part of the vehicle control system. In this case, instead of manually setting the trajectory, the car uses a self-driving system. By combining understanding and control in a closed system, complex AD systems can be developed and tested. Creating conditions from incoming data allows for the simulation of real-time traffic conditions. In the next section, we show how we can produce a driving situation from the details of the recorded car. Status is created with GPS location recorded information and a list of recorded objects processed from the lidar sensor.


In the proposed model, we create a visual driving environment by creating a drivingScenario object containing test drive record data and OpenDRIVE files. Full description of the steps we followed, including code and login data, available. The OpenDRIVE file is a local network where data was recorded. Recorded vehicle details include:

• GPS Data: A text file containing length and length ego car connection to each timestamp.

• Lidar Asset List: A text file containing the number of non-state actors and their location in a self-driving car on each train.

• Video data: The recorded MP4 file is a forward-looking monocular camera-mounted ego car.

Producing and mimicking the driving environment, which follows Suggested steps:

a. Check the recorded car data.

b. Enter the OpenDRIVE road network to drive the situation.

c. Enter ego car data from GPS to driving mode.

d. Add non-ego characters from the list of lidar objects in the drive situation.

e. Imitate and visualize the scene.

Diagram of Data Used

Diagram of Data Used

Importing OpenDRIVE Road Network into Driving Scenario

Road network details for visibility are accessible from OpenStreetMap®. OpenStreetMap knowledge files are regenerate to OpenDRIVE files and are held on with the extension .xodr. The roadNetwork operate employed to import this road network data into driving mode:

scnrio = drivingScenario;

opnFile = 'OpenDRIVEUrban.xodr';

 roadNetwork(scenario,'OpenDRIVE', opnFile);

Importing Vehicle Data

The car's ego information is collected from the GPS sensing element and hold on as a document. The file has the latitude, longitude, and timestamp values of the vehicle. The flight waypoints of the vehicle are drawn from the recorded GPS. The geodetic2enu function is used to convert the green GPS coordinates from the Cartesian east-north-north system. Modified links define ego car modes.

The ego car's faster and faster car prices are calculated on each sensor data train and used to build the ego car route. The ego car travels along the speed lane at a specified speed.

Simulating Scenario

 As a final step, we can simulate the Scenario to visualize the topology of the road and the actors moving along each trajectory. Animated scene simulations can be compared with reference images recorded by a monocular camera.
Camera view during Scenario

Camera view during Scenario


Once the visual condition has been created, we can easily find the difference by systematically changing the character's parameters such as speed, size, and cross-section of the radar.

In this section, we have introduced the following steps to create a variant of the driving mode system:

1.Send a MATLAB function that creates a MATLAB code that matches the actual situation.

2. Modify the task assigned to create a variation of the original position.

3. Call the task to produce a representative drivingScenario object situation.

4. Import the state element into the Driving Scenario Designer application to simulate a modified scenario or generate other scenarios. Alternatively, to simulate a changed scenario in Simulink, insert an object into the Simulink model with the scenario reader block.

Export MATLAB Function

After matters are viewed and mimicked, they are often sent to the MATLAB program line, mistreatment the MATLAB shipping choice available within the Driving situation Designer app. The work done contains the following information:

Scenario - Streets and character characters

Ego Vehicle - Ego vehicle is defined in the state.

Creating Scenario Variations

By changing the code in the MATLAB exported functionality, it can vary widely for one situation. One common possibility is to check the ego automotive at a different speed. For example, in each MATLAB task, the speed of an ego car is set at a constant value of 10 meters per second (speed = 10). Speed fluctuations can be converted into a work input argument by:

• Contains ego speed as input argument

• Elimination of the constantly changing variable speed

• egoSpeed is used instead of speed to calculate the path of the ego car

To generate additional variations, consider:

• Changing the boundaries of roads and railways to assess the impact on the availability of the route

• Changing the way cars are moved or started

• Changing the size of the vehicles

A variation can be made with the adapted function if different parameter values define the environment and vehicles.

Importing Scenario

The drivingScenarioDesigner function is used to import mode to an application by specifying the Scenario driver object as an installation argument.

Import Scenario into Simulink

The situation Reader block imports a changed version into a Simulink model. This block browses the methods and characters from the standing file keep from the drivingScenario application or variable stored within the MATLAB space or the model workspace. Once the situation Reader block has been put in on the Simulink model and is about to read the specified flexibility, the simulation results are often viewed with Bird'-Eye Scope.


  • In few easy steps, we manage to create a road and actor model by dragging and dropping.
  • We mounted and configured radar and vision sensors on the ego vehicle.
  • We simulate the detection of objects and lanes.
  • Also, we auto-generated code for our Scenario and brought all of our sensor data into MATLAB. With this data, you can design scenarios to test your autonomous driving algorithm.

Get instant access to the code, model, or application of the video or article you found helpful! Simply purchase the specific title, if available, and receive the download link right away! #MATLABHelper #CodeMadeEasy

Ready to take your MATLAB skills to the next level? Look no further! At MATLAB Helper, we've got you covered. From free community support to expert help and training, we've got all the resources you need to become a pro in no time. If you have any questions or queries, don't hesitate to reach out to us. Simply post a comment below or send us an email at [email protected].

And don't forget to connect with us on LinkedIn, Facebook, and Subscribe to our YouTube Channel! We're always sharing helpful tips and updates, so you can stay up-to-date on everything related to MATLAB. Plus, if you spot any bugs or errors on our website, just let us know and we'll make sure to fix it ASAP.

Ready to get started? Book your expert help with Research Assistance plan today and get personalized assistance tailored to your needs. Or, if you're looking for more comprehensive training, join one of our training modules and get hands-on experience with the latest techniques and technologies. The choice is yours – start learning and growing with MATLAB Helper today!

Education is our future. MATLAB is our feature. Happy MATLABing!

About the author 

Abhishek Tyagi

Abhishek Tyagi is an aspiring Automotive engineer who enjoys connecting the dots: be it ideas from different disciplines, people from different teams, or applications from different industries. He has strong technical skills and an academic background in engineering, statistics, and machine learning.

{"email":"Email address invalid","url":"Website address invalid","required":"Required field missing"}

MATLAB Helper ®

Follow: YouTube Channel, LinkedIn Company, Facebook Page, Instagram Page

Join Community of MATLAB Enthusiasts: Facebook Group, Telegram, LinkedIn Group

Use Website Chat or WhatsApp at +91-8104622179