This blog will provide an overview of how three of MathWorks’ platforms — MATLAB, Simulink and RoadRunner — integrate with and support workflows for autonomous vehicle (AV) developers using NVIDIA DRIVE Sim, a platform for scalable, physically accurate, and diverse simulation.
This two-part blog series covers the two ways MathWorks platforms support AV developers using NVIDIA DRIVE Sim or deploying algorithms to NVIDIA hardware.
- Part 1 – Integration with DRIVE Sim for environment modeling and vehicle dynamics: How MathWorks tools integrate with DRIVE Sim to:
- Part 2 – Deploy algorithms to DRIVE platforms: How to generate optimized CUDA code from MATLAB code and Simulink models using GPU Coder and Embedded Coder for deployment to NVIDIA DRIVE hardware.
AV developers need to develop realistic 3D environments to simulate and test their perception, planning, and control algorithms. One of the primary challenges they face is that real-world roads are complex, and it is extremely time consuming to create simulation-ready 3D scenes. RoadRunner is an interactive editor to design 3D scenes for simulating and testing automated driving systems. Developers can customize roadway scenes by creating region-specific road signs and markings, as well as insert signs, signals, guardrails, road damage, foliage, buildings, and other 3D models.
Complex real-world road network (left) and simulation-ready environment in RoadRunner (right)
An AV developer can create the 3D environment below in under 30 minutes using the DRIVE Sim connector to RoadRunner to export it to NVIDIA Omniverse for simulation or integration with other 3D production pipelines.
3D environment to be created in RoadRunner and exported to Omniverse using DRIVE Sim connector to RoadRunner.
The environment above can be divided into the following components:
- Add roads, lanes, and sidewalks
- Create junctions
- Add junction markings and props
- Place foliage
Let’s start by creating the road network along with the relevant lane markings and sidewalks. To do this, the Road Plan Tool in RoadRunner is used to create and layout roads. Then the Lane Tool is used to configure the different lanes and setup attributes of the road including direction of travel and lane type. In this example, the width of the lanes is changed and the sidewalk is removed from one side to match the aerial image. It’s common for RoadRunner users to leverage aerial or lidar imagery of a scene to stencil over their road networks.
Now that the road network is set up, the T-junction can then be created. RoadRunner automatically creates junctions when roads intersect; in this case, the T-junction is created using the Custom Junction Tool. RoadRunner includes a variety of junction tools to customize appearance and behavior in simulation.
With the road network and junction created, some foliage can be inserted to model the environment more closely. The RoadRunner Asset Library provides a pre-built set of props while import assets can be created externally into RoadRunner. For this scene, a collection of objects are used called a Prop Set. Prop sets can be dragged onto an existing prop polygon or the Prop Polygon Tool can be used to fill a new area.
Now with the 3D environment ready to go, the scene can be exported from RoadRunner to Omniverse using the DRIVE Sim connector to RoadRunner. The example so far was based on a simple scene. Here are some images of the results from RoadRunner when modeling a more complex scene:
Here are the same images from DRIVE Sim after using the DRIVE Sim connector to RoadRunner. DRIVE Sim uses Omniverse RTX rendering for physics-based simulation of lights, materials and sensors based on real-time raytracing.
In order to perform vehicle level studies, developers need to decide the level of fidelity required for the vehicle model itself. In some cases, the vehicle model can be trivial. For example, traffic simulations often treat each vehicle as a simple mass moving through space along a specified trajectory. In cases such as emergency braking tests, however, a higher fidelity model of the vehicle is needed. Vehicle Dynamics Blockset is a Simulink add-on product designed to help with these kinds of problems. Below are a few examples of how this works.
Vehicle Dynamics Blockset comes with several pre-built reference applications that make it easier to get started. For example, the Constant Radius Maneuver includes a vehicle model, complete with a driver, controllers, sensors, powertrain, wheels, brakes, steering, suspension and chassis.
These kinds of vehicle models can be quite detailed and can be parameterized to reflect the system of interest more accurately. For example, the Mapped SI Engine model can be used below to calibrate the engine by importing test data.
In a similar way, developers can use the Kinematics & Compliance reference application to import data from a suspension test or multibody dynamics simulation, fit a response surface model, and parameterize a mapped suspension model that closely mimics the real system’s behavior.
Having parameterized the vehicle model, let’s run some experiments to characterize its behavior. The Constant Radius reference application includes a Reference Generator which allows the developer to select from a list of pre-defined standardized tests such as a double lane change, or slowly increasing steer maneuver. This process starts with a constant radius test to assess the vehicle’s ability to hold a fixed turn radius at the specified speed. By sweeping through higher and higher vehicle speeds, signals like vehicle speed, lateral acceleration and vehicle slip can be reviewed to determine if the vehicle met the system requirements.
After testing a suite of handling maneuvers, the Braking Test Maneuver can be run to assess the vehicle’s stopping distance from a specified initial speed. This reference application includes features like an ABS controller and a dialog to specify surface conditions for running a split-mu test.
With this braking test, results can be compared across different braking controllers and different conditions to assess the vehicle’s performance. For example, the results below indicate that the ABS controller successfully prevents the rear wheels from locking up during the emergency braking event, thereby improving the stopping distance.
Because Vehicle Dynamics Blockset is built on Simulink, these kinds of simulations can be run on the NVDIA DRIVE Sim platform. This adds a whole new degree of performance and flexibility, allowing developers to run studies much more efficiently while leveraging the other capabilities available through the DRIVE Sim ecosystem.
Check out the second part of this series on deploying algorithms created in MATLAB and Simulink to NVIDIA DRIVE platforms.
To learn more about how to use the different MathWorks platforms for automated driving development, and how other AV developers use MathWorks platforms in their development, register for MATLAB Expo on 4th and 5th May 2021. The events include talks from other MathWorks users in automated driving including:
- General Motors
- Flux Auto
- Porsche Engineering
- Renault Nissan
Technical presentations from MathWorks engineers on automated driving include:
- What’s New in MATLAB, Simulink and RoadRunner for Automated Driving
- Designing and Evaluating Sensor Fusion Algorithms for Automated Driving
- Developing Virtual Scenes for Automated Driving Testing
- Developing a Motion Planner for Highway Lane Change Maneuvers
To leave a comment, please click here to sign in to your MathWorks Account or create a new one.