This model shows how to test a closed-loop ADAS (advanced driver assistance system) algorithm in Simulink®. To test the scenario, you use a driving scenario that was saved from the Driving Scenario Designer app. In this model, you read in a scenario using a Scenario Reader block, and then visually verify the performance of the algorithm, an autonomous emergency braking (AEB) system, on the Bird's-Eye Scope.
Before beginning this example, add the example file folder to the MATLAB® search path.
This example uses a driving scenario that is based on one of the prebuilt Euro NCAP test protocol scenarios that you can access through the Driving Scenario Designer app. For more details on these scenarios, see Generate Synthetic Detections from a Euro NCAP Scenario.
Open the scenario file in the app.
Click Run to simulate the scenario. In this scenario, the ego vehicle collides with a pedestrian child who is crossing the street.
In the model used in this example, you use an AEB sensor fusion algorithm to detect the pedestrian child and test whether the ego vehicle brakes in time to avoid a collision.
The model implements the AEB algorithm described in the Autonomous Emergency Braking with Sensor Fusion example. Open the model.
A Scenario Reader block reads the actors and roads from the specified scenario file and outputs the non-ego actors. This block is located in the Vehicle Environment > Actors and Sensor Simulation subsystem. Open this subsystem.
open_system('AEBTestBenchExample/Vehicle and Environment/Actors and Sensor Simulation')
In the Scenario Reader block, the Driving scenario file name parameter specifies the name of the scenario file. You can specify a scenario file that is on the MATLAB search path, such as the scenario file used in this example, or the full path to a scenario file.
The Scenario Reader block outputs the poses of the non-ego actors in the scenario. These poses are passed to vision and radar sensors, whose detections are used to determine the behavior of the AEB controller.
The actor poses are output in vehicle coordinates, where:
The X-axis points forward from the ego vehicle.
The Y-axis points to the left of the ego vehicle.
The origin is located at the center of the rear axle of the ego vehicle.
If a scenario has multiple ego vehicles, in the Scenario Reader block, set the Coordinate system of outputs parameter to
World coordinates instead of
Vehicle Coordinates. In the world coordinate system, the actors and lane boundaries are in the world coordinates of the driving scenario. The Bird's-Eye Scope does not support visualization of world coordinates.
Although this scenario includes a predefined ego vehicle, the Scenario Reader block is configured to ignore this ego vehicle definition. Instead, the ego vehicle is defined in the model and specified as an input to the Scenario Reader block (the Source of ego vehicle parameter is set to
Input port). As the simulation advances, the AEB algorithm determines the pose and trajectory of the ego vehicle. If you are developing an open-loop algorithm, where the ego vehicle is predefined in the driving scenario, set the Source of ego vehicle parameter to
Scenario file. For an example, see Test Open-Loop ADAS Algorithm Using Driving Scenario.
To visualize the scenario, use the Bird's-Eye Scope. From the Simulink model toolbar, click the Bird's-Eye Scope button. Then, click Find Signals, and run the simulation. With the AEB algorithm, the ego vehicle brakes in time to avoid a collision.
When you are done verifying the algorithm, remove the example file folder from the MATLAB search path.