Write data from Simulink model to virtual world
Simulink® 3D Animation™
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 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.
The current internal viewer window (
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 Simulink Desktop Real-Time™, 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 (Simulink).
A VR Sink block accepts all meaningful data types on input. The block converts these data types to natural virtual world 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 Virtual World Data Types.
Source file — File name specifying the virtual world that connects to this block. By default, the full path to the associated virtual world 3D file appears in this text box. If you enter only the file name in this box, the software assumes that the virtual world 3D file resides in the same folder as the model file. You can specify a VRML file or an X3D file.
Click the New to open an empty default virtual world 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 virtual world 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 Viewer automatically — If you select this check box, the default virtual world 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
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
Sample time — Enter the sample time
-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
Setup and preview video output — Opens a figure window for navigation and viewing.
Virtual Scene Tree — This box shows the structure of the virtual world 3D 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 virtual world 3D file.
Fields whose values cannot be written (because their parent
nodes do not have names, or because they are not of virtual world
have an X-shaped icon.
Show node types — If you select this check box, node types are shown in the virtual scene tree.
Show field types — If you select this check box, field types are shown in the virtual scene tree.