RoadRunner Scenario Tutorial, Part 4: Programmatic Interfaces - MATLAB & Simulink
Video Player is loading.
Current Time 0:00
Duration 0:00
Loaded: 0%
Stream Type LIVE
Remaining Time 0:00
 
1x
  • Chapters
  • descriptions off, selected
  • en (Main), selected
    Video length is 3:28

    RoadRunner Scenario Tutorial, Part 4: Programmatic Interfaces

    From the series: RoadRunner Scenario Tutorial

    RoadRunner Scenario provides programmatic interfaces for performing common workflow tasks. This module demonstrates using MATLAB APIs to programmatically modify and simulate scenarios.

    Published: 5 Jun 2024

    This video will show you how to use MATLAB APIs to connect MATLAB and RoadRunner to programmatically modify and simulate scenarios using RoadRunner Scenario. You can download the MATLAB live script being used in this video to follow along. Make sure you have RoadRunner Scenario installed with an active license.

    In MATLAB, run roadrunner.connect to connect to this instance of RoadRunner. The roadrunner function will launch a new instance of RoadRunner if one isn't already running. The function returns a roadrunner object we have named rrApp.

    With this rrApp object, use API calls to open the prebuilt cut in and slow scenario. This scenario defines a car that cuts in front of an ego vehicle and then slows down. Using MATLAB, we can create a simulation object and start the simulation programmatically to visualize the scenario. You can still continue to use the simulation tool in RoadRunner Scenario to interactively start or end the simulation.

    For scenario-based testing, it is useful to create variations of a scenario. Variations allow us to see how altering scenario elements affect scenario outcomes. One way of doing this is by modifying the values of variables associated with the scenario. Variables can specify values for attributes of actors and logic components.

    This scenario comes with several variables already defined. For example, this variable specifies the initial speed of the ego vehicle. Let's create our own variable. I'll do this for the time it takes the white car to slow down to a stop, which currently has a value of 1 second.

    To create a variable, right click on a parameter. Select Create Variable, and name it accordingly. Variables can be modified from the Variables pane in RoadRunner Scenario or set programmatically in MATLAB. Note that changing these values while a simulation is running does not affect the ongoing simulation.

    To modify variables programmatically in MATLAB, use the setScenarioVariable function. For instance, you can change the time it takes the white car to slow down to a stop from 1 second to 2 seconds to achieve a smoother stop. Let's run the simulation again to observe the changes. You can similarly change other aspects of the scenario, such as transforming the ego vehicle into a delivery van.

    In addition to the MATLAB interface, a gRPC API enables programmatic control from a wide range of languages, such as Python and C++. A command-line API is also included.

    Finally, speaking of variations, consider using the test suite for Euro NCAP protocols. This support package helps you generate scenario variants for safety assessment specific to the Euro NCAP test protocols.

    Up Next:

    View full series (5 Videos)

    View more related videos