Read data from virtual world to Simulink model
Simulink® 3D Animation™
The VR Source provides access to virtual world fields, as chosen in the Block Parameters dialog box as input signals during simulation.
The VR Source block supports several activities. For example, use the VR Source block to:
Provide interactivity between a user navigating the virtual world and the Simulink model. The VR Source block can register user interaction with the virtual world. The block can pass to the model those values which then can affect the simulation of the model.
Read into the model events from the virtual world, such as time ticks or outputs from scripts.
Read into the model static information about the virtual world (for example, the size of a box defined in the virtual world 3D file).
Access values of 3D object nodes that are not driven by simulation, but whose monitoring is essential.
For an example of how to use the VR Source block, see the
the Setpoint subsystem in the
The current internal viewer window (
You cannot use the Simulink Coder™ software to compile a model that includes a VR Source block.
A VR Source block outputs signals of type double.
Source file — Virtual world 3D 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,
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.
Note 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 you want.
Allow variable-size output signals — Specify the type of signals allowed out of this port.
By default, the VR Source block does not allow variable-size signals. If you enable this parameter, then the VR Source block allows variable-size signals for fields that can change dimensions during simulation. These fields include MFxxx fields that can have a variable number of elements (typically, MFFloat or MFVec3f). The SFImage is the only SFxxx field that can map to a variable-size signal. For details about these data types, see Field Data Types.
Note: The signal dimensions of a variable-size output signal of a VR Source block must be the same size as, or smaller than, the initial state of the signal.
Virtual World 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 MATLAB® 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 readable values have check boxes. Use these check boxes to select the fields that you want the Simulink software to monitor and to use to input values. For each field that you select in the Virtual World Tree box, Simulink creates an output port in the VR Source block. Simulink creates the output ports in the same order as the selected fields appear in the virtual world 3D file.
Fields whose values cannot be read (because their parent nodes do not have names, or because their values cannot be imported to Simulink) 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.