Run a Vehicle Dynamics Maneuver in 3D Environment

This example shows how to run a vehicle dynamics maneuver in a 3D environment. By integrating vehicle dynamics models with a 3D environment, you can test advanced driver assistance systems (ADAS) and automated driving (AD) perception, planning, and control software. For the 3D visualization engine platform requirements and hardware recommendations, see 3D Visualization Engine Requirements.

  1. Create and open a working copy of a maneuver reference application. For example, open the double-lane change reference application.

  2. Run the maneuver simulation. By default, the 3D environment is disabled.

    When you run the simulation, the Visualization subsystem provides driver, vehicle, and response information. The reference application logs vehicle signals during the maneuver, including steering, vehicle and engine speed, and lateral acceleration. You can use the Simulation Data Inspector to import the logged signals and examine the data.


    Driver Commands

    Driver commands:

    • Handwheel angle

    • Acceleration command

    • Brake command

    Vehicle Response

    Vehicle response:

    • Engine speed

    • Vehicle speed

    • Acceleration command

    Lane Change Scope block

    Lateral vehicle displacement versus time:

    • Red line — Cones marking lane boundary

    • Blue line — Reference trajectory

    • Green line — Actual trajectory

    Steer vs Ay Scope block

    Steering angle versus lateral acceleration

    Steer, Velocity, Lat Accel Scope block

    • SteerAngle — Steering angle versus time

    • <xdot> — Longitudinal vehicle velocity versus time

    • <ay> — Lateral acceleration versus time

    Vehicle XY Plotter

    Vehicle longitudinal versus lateral distance

    ISO 15037-1:2006 block

    Display ISO standard measurement signals in the Simulation Data Inspector, including steering wheel angle and torque, longitudinal and lateral velocity, and sideslip angle

  3. Enable the 3D visualization environment. In the Visualization subsystem, open the 3D Engine block. Set these parameters.

    • 3D Engine to Enabled.

    • Scene description to one of the scenes, for example Double lane change.

    • To position the vehicle in the scene:

      1. Select the position initialization method:

        • Recommended for scene — Set the initial vehicle position to values recommended for the scene

        • User-specified — Set your own initial vehicle position

      2. Select Apply to modify the initial vehicle position parameters.

      3. Click Update the model workspaces with the initial values to overwrite the initial vehicle position in the model workspaces with the applied values.

  4. Rerun the reference application. As the simulation runs, in the AutoVrtlEnv window, view the vehicle response.

    To change the camera views, use these key commands.

    KeyCamera View


    Back left




    Back right








    Front left




    Front right



    For example, when you run the double-lane change maneuver, use the cameras to visualize the vehicle as it changes lanes.

    • Back

    • Front left

    • Internal


    • To open and close the AutoVrtlEnv window, use the Simulink® Run and Stop buttons. If you manually close the AutoVrtlEnv window, Simulink stops the simulation with an error.

    • When you enable the 3D visualization environment, you cannot step the simulation back.

Related Topics