Main Content

Scene Interrogation in 3D Environment

Note

Simulating models in the 3D visualization environment requires Simulink® 3D Animation™.

The scene interrogation with camera and ray tracing reference application provides the Simulink interface with the 3D visualization environment. For the minimum hardware required to run the reference application, see Unreal Engine Simulation Environment Requirements and Limitations.

The scene interrogation with camera and ray tracing reference application contains:

  • One passenger vehicle with a simple driveline, combined slip wheel, and 3DOF vehicle dynamics model.

  • One camera mounted on the passenger vehicle rear-view mirror.

  • Steering, acceleration, gear, and braking controls.

  • Vehicle light controls.

  • 3D visualization environment configured for the Virtual Mcity scene.

Create and open a working copy of the camera and ray tracing reference application project.

Image of camera and ray tracing model

When you run the simulation, the reference application provides this vehicle and scene information.

WindowDescription

Simulation 3D Viewer

Video output of the Unreal Engine® 3D visualization environment image feedback. By default, the display shows the view from the Simulation 3D Scene Configuration block Scene view parameter SimulinkVehicle1.

To smoothly change the camera views, use these keyboard shortcuts.

Keyboard ShortcutCamera View

1

Back left

A diagram shows numbered key commands corresponding to camera views

 View Animated GIF

2

Back

3

Back right

4

Left

5

Internal

6

Right

7

Front left

8

Front

9

Front right

0

Overhead

For additional camera controls, use these keyboard shortcuts.

Keyboard ShortcutCamera Control
Tab

Cycle the view between all vehicles in the scene.

 View Animated GIF

Mouse scroll wheel

Control the camera distance from the vehicle.

 View Animated GIF

L

Toggle a camera lag effect on or off. When you enable the lag effect, the camera view includes:

  • Position lag, based on the vehicle translational acceleration

  • Rotation lag, based on the vehicle rotational velocity

This lag improves visualization of overall vehicle acceleration and rotation.

 View Animated GIF

F

Toggle the free camera mode on or off. When you enable the free camera mode, you can use the mouse to change the pitch and yaw of the camera. This mode allows you to orbit the camera around the vehicle.

 View Animated GIF

SDL Video Display

Video image output of Simulation 3D Camera Get block. By default, the display shows the view specified by these parameter settings:

  • Vehicle nameSimulinkVehicle1

  • Vehicle mounting locationRearview mirror

This table summarizes the parts of the reference application.

NameDescription

Controls

Dials and gauges that control the vehicle steering, gear, acceleration, and braking. The braking control turns on the vehicle brake lights. Setting the gear control to R turns on the vehicle reverse lights.

Sensors

The Simulation 3D Actor Transform Get block returns the translation, rotation, and scale for the vehicle passenger vehicle and four wheels from the 3D visualization environment.

The Simulation 3D Camera Get block returns the camera image from the 3D visualization environment. By default, the block returns image data for a camera location specified by these parameter settings:

  • Vehicle nameSimulinkVehicle1

  • Vehicle mounting locationRearview mirror

Dynamics and Controls

Interfaces with Simulink to calculate the dynamic response of the vehicle plant and controller. By default, the subsystem contains a simple driveline and the Vehicle 3DOF Dual Track block vehicle dynamics model.

Implements a Light Controls subsystem that you can use to control the headlights and signal lights.

Image of headlight and signal lights

Displays

The Simulation 3D Vehicle with Ground Following block implements a passenger vehicle in the 3D visualization environment. The block uses the vehicle position to adjust the vehicle elevation, roll, and pitch so that the vehicle follows the ground terrain. By default, the block has these parameter settings:

  • TypeMuscle car

  • ColorRed

  • NameSimulinkVehicle1

  • Enable light controlsOn

The Simulation 3D Scene Configuration block configures the Unreal Engine 3D visualization environment. By default, the block has these parameter settings:

  • Scene nameVirtual Mcity

  • Scene viewSimulinkVehicle1

The TransformDisplay subsystem displays the translation, rotation, and scale of the SimulinkVehicle1 vehicle body and four wheels.

The ImageDisplay subsystem displays the video image output of Simulation 3D Camera Get block in the SDL Video Display window.

Displays Subsystems

TransformDisplay Subsystem

In the TransformDisplay subsystem, the Display block provides the translation, rotation, and scale of the vehicle body and four wheels. Use the Constant block value to control the display.

  • 1 — Translation

  • 2 — Rotation

  • 3 — Scale

For example, to display translation information, set the value to 1.

Image of transform display subsystem

The display indicates that the:

  • Vehicle body is at -212.5 m, 65.66 m, and 0.0112 m along the world X-, Y-, and Z- axes, respectively.

  • Wheels are at their initial positions along the world X-, Y-, and Z- axes, respectively.

The Display block provides an array of the vehicle and wheel locations.

[VehicleXVehicleYVehicleZFrontLeftXFrontLeftYFrontLeftZFrontRightXFrontRightYFrontRightZRearLeftXRearLeftYRearLeftZRearRearXRearRearYRearRearZ]

  • Vehicle translation and rotation are along the world coordinate system axes.

  • Wheel translations and rotations are with respect to their initial positions, along the world coordinate system axes.

ImageDisplay Subsystem

In the ImageDisplay subsystem, the Level-2 MATLAB S-Function block uses the VideoDisplayMSfcnWin function to display the video image output of Simulation 3D Camera Get block.

See Also

| | | |

Related Examples

More About

External Websites