Documentation Center

  • Trial Software
  • Product Updates

VR Sink

Write data from Simulink model to virtual world

Library

Simulink® 3D Animation™

Description

The VR Sink block writes values from its ports to virtual world fields specified in the Block Parameters dialog box.

For an example of how to use the VR Sink block, see the Foucault Pendulum Model with Virtual Reality SceneFoucault Pendulum Model with Virtual Reality Scene example.

The VR Sink block is equivalent to the VR To Video block, except that the Show video output port parameter for the VR Sink block is cleared by default.

The VR Sink block cannot be compiled by the Simulink Coder™ software, but it can be used as a SimViewing device on the host computer.

    Note:   The current internal viewer window (vrfigure) properties are saved together with the Simulink model. The next time you open the model, the internal viewer window opens with the same parameters that were last saved, such as position, size, and navigation mode. When closing the viewer window, the Simulink software does not alert you if these properties have changed.

The VR Sink block is a Sim Viewing Device. You can include it in models that you compile with Simulink Coder software. If you use External mode to compile, build, and deploy the model on a target platform, such as Simulink Real-Time™ or Real-Time Windows Target™, some sink blocks and Sim Viewing Device blocks stay in Normal mode during simulation, receive data from the target, and display that data. For more information, see Sim Viewing Devices in External Mode in the Simulink documentation.

Data Type Support

A VR Sink block accepts all meaningful data types on input. The block converts these data types to natural VRML types, as necessary. These data types include logicals, many types of signed and unsigned integers, singles, and doubles. The MATLAB® and Simulink interfaces also accept matrices. For further details, see VRML Data Types.

Block Parameters Dialog Box

Source file — VRML file name specifying the virtual world that connects to this block. By default, the full path to the associated .wrl file appears in this text box. If you enter only the file name in this box, the software assumes that the .wrl file resides in the same folder as the model file.

  • Click the New to open an empty default VRML editor. When you either enter a source file name or use the Browse button, the New button becomes an Edit button.

  • Click the Edit button to launch the default VRML editor with the source file open.

  • Click the View button to view the world in the Simulink 3D Animation Viewer or a Web browser.

  • Click the Reload button reloads the world after you change it.

Open VRML Viewer automatically — If you select this check box, the default VRML viewer displays the virtual world after loading the Simulink model.

Allow viewing from the Internet — If you select this check box, the virtual world is accessible for viewing on a client computer. If you do not select this check box, then the world is visible only on the host computer. This parameter is equivalent to the RemoteView property of a vrworld object.

Description — Description that is displayed in all virtual reality object listings, in the title bar of the Simulink 3D Animation Viewer, and in the list of virtual worlds on the Simulink 3D Animation HTML page. This parameter is equivalent to the Description property of a vrworld object.

Sample time — Enter the sample time or -1 for inherited sample time.

To achieve a smooth simulation, MathWorks® recommends that you explicitly set the Sample time parameter. You can change the value of this parameter to achieve the specific visual experience that you want.

Show video output port — Enables a port to output an RGB video stream for further 2D video processing.

Video output signal dimensions — Dimensions ([vertical horizontal]) of the video output signal in pixels (default is [200 320]).

Setup and preview video output — Opens a figure window for navigation and viewing.

VRML Tree — This box shows the structure of the VRML file and the virtual world itself.

Nodes that have names are marked with red arrows. You can access them from the Simulink 3D Animation interface. Nodes without names, but whose children are named, are also marked with red arrows. This marking scheme makes it possible for you to find all accessible nodes by traversing the tree using arrows. Other nodes have a blue dot before their names.

Fields with values that you set have check boxes. Use these check boxes to select the fields whose values you want the Simulink software to update. For every field that you select, an input port is created in the block. Input ports are assigned to the selected nodes and fields in the order that corresponds to the VRML file.

Fields whose values cannot be written (because their parent nodes do not have names, or because they are not of VRML data class eventIn or exposedField) have an X-shaped icon.

Show node types — If you select this check box, node types are shown in the VRML tree.

Show field types — If you select this check box, field types are shown in the VRML tree.

Was this topic helpful?