V-Realm Builder Tutorial

From OpenMBD
Jump to: navigation, search

This page contains a tutorial for building a simple model in V-Realm Builder. The fundamental functionality of the programme is described by building a small model. The model to be built, is a ....

All figures used in this tutorial: Copyright©1996-1997, Integrated Data Systems, Inc. All Rights Reserved

Creating a New World

1. Open the V-Realm Builder programme (if there is no shortcut, use this location: "C:\Program Files\MATLAB\Rxxxx\toolbox\sl3d\vrealm\program" and open the programme from here). 2. Create a new model by selecting File -> New. The grey backdrop should change to show a black window on the right and a taskbar on the left. Save the file as 'Tutorial'.

Programme Features

A short description of the important features will be listed here.

V-Realm startup.jpeg

  • The green area is the viewer. This is where the world is shown from the selected viewpoint. As there is nothing created yet, this screen is black.
  • The red area is the building pane (component tree). This is where all components appear. These components can be objects, viewpoints, backgrounds etc. This pane is where all editing is done.
  • The yellow area is the view selector. From here, different viewpoints can be selected (after they have been created).
  • The blue area contains the important insert buttons. From here, an environment component can be added as a transform (T) or a group (G).
  • The pink area contains the buttons for (left to right) adding a background, a viewpoint, navigation info, and a viewpoint.

Building Inside the World

Now there is a basic understanding of some features, a world can be built.

1. Add a background by clicking the 'Insert Background' button (in pink area). Background button.jpeg The viewer now has a background and in the building pane, a tab 'Background' has been added. There are many ways to alter the background (like colour, angles etc.), but for this model, the default background is sufficient.

2. Adding an object: Next, an object will be added. Click Libraries -> Import From -> Object Library. This opens a new window, which contains all objects pre-loaded to the library. Select the category 'Transportation (Land)'. Select the 'Alfa-Romeo' and drag this onto the 'New World' text seen in the building pane (red area). This adds a large tree to the building pane and the Alfa-Romeo object appears in the viewer.

3. Click the box with a '-' inside to collapse the tree of the Alfa-Romeo. Now the programme screen should look like the picture below. The 'Transform' contains all components of the Alfa-Romeo. The text transform indicates that this object can be moved.

Alfa inserted.jpeg

4. Now create a new viewpoint. Select the text 'New World', so this becomes highlighted. Click 'Access/Edit Viewpoint' button File:Viewpoint button.jpeg. This creates a viewpoint attached to 'New World'. The viewpoint is created as 'Viewpoint' underneath the 'New World'. Expand the tab by clicking the '+'. First, double-click set_bind, set the Boolean to 'True' and click OK. This selects the view (so the changes made can be seen).

5. Under the viewpoint tab, 3 fields are necessary.

  • description: This is where a description of the viewpoint is made. Change the description of this viewpoint to 'World'.
  • Position: This is where the position of the camera is defined. In this case, the camera will be moved backwards. So, double-click 'position'. Check all 3 axis and for x -> 0, y -> 2, z -> 12. This zooms out the camera and moves it up. Note: In V-Realm Builder, the y-axis is vertical direction
  • Orientation: This rotates the camera. This will not be used for this viewpoint.

6. Rename the viewpoint in the main object tree to 'World'. This is done by selecting 'Viewpoint' and clicking again (not double-click). The name can then be changed.

Now there is an object, so a ground can be added.

7. Click on the 'New World' text to select the top of the tree. Now click the 'Insert Group' button (blue area) Group button.jpeg. This creates a group in which objects can be placed. A 'Group' does not contain the Transform options (movement). As the ground is not movable, a Group is sufficient.

8. Rename the Group tab (two clicks) to 'Ground'. Now expand the Ground tab. The ground will be added by adding to the children tab under Ground. Click on the 'children' tab to highlight it and then click the 'Insert Box' button Insert box.jpeg. This creates new objects under the 'children' tab and a box will appear in the viewer.

9. Now, the box must be made into a road and the car placed on top. Expand the nodes under children -> Shape -> Box. Here the size can be changed. Make the dimensions x -> 60, y -> -0.1, z -> 60. (The -0.1 is the height of the road downwards).

10. Navigate to the main 'Transform' node (the car) and rename this 'Vehicle'. Expand this node and many transform nodes will appear. The first transform applies to the whole vehicle, and each of the children transforms applies to their own body. In this case, the wheels can be transformed separately, as can some other bodies.

11. Expanding the children transforms, and expanding children -> shape -> geometry, shows the node 'Indexed Face Set'. Double-clicking on this will open a window in which a geometry of an object can be seen. Search for the wheels (most likely second to last), and change the name of this transform node to 'Wheels'.

IMPORTANT: A transform can only be used in Simulink if it is renamed. If the node is called 'transform' the options cannot be selected in the VR Sink. REMEMBER THIS!

12. Now all the building is complete, some new viewpoints will be added. First select 'Vehicle'-> children and then add viewpoint. A viewpoint appears as a child of the 'Vehicle Node'. Rename this viewpoint to 'Car_rear'. The model should look like the figure below.

Viewpoint screen.jpeg

13. Expand Car_rear and set_bind to True. Then select orientation. To get to the rear of the vehicle, a 90 degrees rotation around the y-axis is used. Select y-axis and Rotation and enter y-axis -> 1 and Rotation -> -90. (Y-axis is a factor that is used for the rotation, and Rotation is the angle at which to rotate.

14. Now select position and enter x -> -20, y -> 5 and z -> 0. Also, change description to 'Rear of vehicle'.

15. Now create another viewpoint attached to the vehicle. Call this Car_top, and enter the following data:

  • Set_bind: True
  • description: Top of vehicle
  • orientation: x -> -1, Rotation -> 90.
  • position: x -> 0, y -> 50, z -> 0.

16. Finally, add a viewpoint at the side of the vehicle. Call this Car_side, and enter the following data:

  • Set_bind: True
  • description: Side of vehicle
  • orientation: all zero
  • position: x -> 0, y -> 4, z -> 20.

17. Click on the vehicle body. This expands one of the transform nodes in the component tree. This is the transform connected to the main body, which is the body we want to control. Rename the 'Transform' node to 'Vehicle_body'.

Final vrml.jpg

Now the VR world is ready to be integrated to Simulink. Save the file and close V-Realm Builder.

Integration to Simulink

This chapter will elaborate on the integration of the VR model into a Simulink model. For this, download the Simulink file and data: Media:Example.ogg.

1. Open the model in Simulink and the added MATLAB script. Run the MATLAB script to generate data used in the animation. This data is sent to the model from within the 'test' sub-component. Make sure the solver selected is Fixed-Step, auto solver, with step-size 0.01.

2. Open the sub-component 'animation_model'. This is where the animation is created using Simulink 3D animation. This component contains the from blocks for x- and y-displacement, and the heading of the vehicle. These variables will be sent to the linked parameters within the VRML model.

3. First, load the correct VRML model to the VR Sink by double-clicking the VR Sink block. This opens the block parameters. Browse for the VRML file 'Tutorial' and select this file. Now, the Virtual World Tree (green area) is filled with the nodes from the VRML file previously built.

File:Virtual World Tree.jpg

4. We want the car to move through the model. Expand the 'Vehicle' tree node and then the 'children' node. Expand 'Vehicle_body'. Here, the options to move the body can be seen. The car should move and rotate, so check the boxes for 'rotation' and 'translation'. Click 'Apply' and 'OK'. Two ports have been added to the VR Sink.

5. Now, connect the blocks as seen below. Use the 'VR Signal Expander' and 'Rotation Matrix to VRML Rotation' blocks. Use for the VR Signal Expander block, the parameters seen below.

File:Connected tutorial.jpg

File:VR signal parameters.jpg