收藏 分销(赏)

MATLAB-Virtual-Reality-Toolbox(matlab虚拟实验平台).doc

上传人:仙人****88 文档编号:11814763 上传时间:2025-08-14 格式:DOC 页数:9 大小:74.50KB 下载积分:10 金币
下载 相关 举报
MATLAB-Virtual-Reality-Toolbox(matlab虚拟实验平台).doc_第1页
第1页 / 共9页
MATLAB-Virtual-Reality-Toolbox(matlab虚拟实验平台).doc_第2页
第2页 / 共9页


点击查看更多>>
资源描述
MATLAB Virtual Reality Toolbox Installing a VRML Plug-In (Windows) When you install the Virtual Reality Toolbox, the Virtual Reality Toolbox viewer is set as the default viewer. If you want to use a Web browser as a VRML viewer, use the following procedure to install the blaxxun Contact plug-in. You can use this plug-in with either Microsoft Internet Explorer or Netscape Navigator. The blaxxun Contact plug-in is the only supported VRML plug-in. Note    The blaxxun Contact installer installs the plug-in for the current default browser only. If you change the default browser, you need to complete the install procedure a second time. The blaxxun Contact executable files are located at C:\<MATLAB root>\toolbox\vr\blaxxun. You must use blaxxun Contact 4.4 with Version 3.0 of the Virtual Reality Toolbox. This version of the blaxxun Contact VRML plug-in is distributed with the Virtual Reality Toolbox. You can download blaxxun Contact 4.4 from If you have the MATLAB Web Server installed on your machine, make sure that the Web Server is stopped before you install the blaxxun Contact plug-in. Also, verify that you are connected to the Internet before starting this installation procedure: 1.Start MATLAB. 2.In the MATLAB Command Window, type :vrinstall -install viewer MATLAB displays the message :Do you want to use OpenGL or Direct3d acceleration? (o/d) 3.Check the graphic card manual to determine the acceleration method to select. If you are not sure, select Direct 3d by typing :d The blaxxun installer starts running and displays the following dialog box. 4.Follow the instructions on the remaining screens. 5.In the MATLAB Command Window, type :vrinstall -check If the viewer installation was successful,MATLAB displays the following message: VRML viewer: installed If the viewer installation was unsuccessful, MATLAB displays the message:VRML viewer: not installed Known Issue with the blaxxun Contact Plug-In The blaxxun Contact VRML plug-in can fail to update the virtual scene when used with the Virtual Reality Toolbox 3.0 and Microsoft Internet Explorer 5.5 and above. Netscape users do not experience this problem. If you are using Internet Explorer 5.5 or above, you must manually change a network security setting before you can use blaxxun Contact 4.4 with the Virtual Reality Toolbox Version 3.0. Upgrading your version of blaxxun Contact does not resolve this problem. Changing the Default Network Security Setting You must change your default network security setting before using the blaxxun Contact plug-in with Internet Explorer 5.5 and above to ensure that the virtual scene is updated appropriately: 1.Open Internet Explorer. 2.From the Tools menu, choose Internet Options. The Internet Options dialog box opens. 3.Click the Security tab. 4.Select the Custom Level button. The Security Settings dialog box opens. 5.Scroll down until you see Microsoft VM. The first subheading is Java permissions. 6.Select Custom. The Java Custom Settings button appears in the lower left of the Security Settings dialog box. 7.Click Java Custom Settings. The Local intranet dialog box opens. 8.Click the Edit Permissions tab. 9.Scan the main headings and subheadings (marked with a lock icon) until you see Access to all Network Addresses. 10.Under Access to all Network Addresses, select Enable. 11.Click OK. The Local intranet dialog box closes. 12.In the Security Settings dialog box, click OK. You are asked if you want to change the security settings for this zone. 13.Select Yes. 14.In the Internet Options dialog box, select OK. Setting the Default Viewer of Virtual Scenes If you install a VRML plug-in in your Web browser, it is possible to view virtual scenes with either the Virtual Reality Toolbox viewer or your Web browser. You determine the viewer used to display your scene using the vrsetpref and vrgetpref commands. The following procedure assumes that you are working on a PC platform: 1.At the MATLAB command prompt, type :vrinstall -check to determine whether blaxxun Contact is installed. MATLAB displays: VRML viewer: installed VRML editor: installed The viewer and editor are installed. If the viewer is not installed, see Installing a VRML Plug-In (Windows). 2.Determine your default viewer by typing :vrgetpref MATLAB displays :ans = DefaultFigurePosition: [5 25 400 320] DefaultPanelMode: 'halfbar' DefaultViewer: 'internal' Editor: [1x60 char] HttpPort: 8123 TransportBuffer: 5 VrPort: 8124 The DefaultViewer property is set to 'internal'. The Virtual Reality Toolbox viewer is the default viewer for viewing virtual scenes. Any virtual scenes that you open are displayed in the viewer. 3.For example, at the MATLAB command prompt, type :vrbounce The Bouncing Ball demo is loaded and the virtual scene is displayed in the Virtual Reality Toolbox viewer. 4.Change the default viewer to your Web browser by typing : vrsetpref('DefaultViewer','web') The default Windows system VRML plug-in is used. The blaxxun Contact VRML plug-in sets itself as the default VRML plug-in during its installation. 5.At the MATLAB command prompt, type: vrbounce The Bouncing Ball demo is loaded and the virtual scene is displayed in your Web browser. 6.Reset the Virtual Reality Toolbox viewer as your default viewer by typing vrsetpref('DefaultViewer','factory') 7.All virtual scenes are displayed by the Virtual Reality Toolbox viewer. In the vrbounce model window, double-click the VR Sink block. A Block Parameters dialog box opens. The target of the View button is determined by the DefaultViewer property. If the DefaultViewer property is set to 'internal', clicking the View button opens the virtual world in the Virtual Reality Toolbox viewer. If the DefaultViewer property is set to 'web', clicking the View button opens the virtual world in your Web browser. Installing VRML Editor (Windows) When you install the Virtual Reality Toolbox, files are copied to your hard drive for V-Realm Builder, but the installation is not complete. Installing the VRML editor writes a key to the Windows registry, making extra library files in V-Realm Builder available for you to use, and it associates the Edit button in Virtual Reality Toolbox blocks with this editor: 1.Start MATLAB. 2.In the MATLAB Command Window, type: vrinstall -install editor or type :vrinstall('-install','editor') MATAB displays the following messages: Starting editor installation... Done. 3.Type :vrinstall -check If the editor installation was successful, MATLAB displays the following message: VRML editor: installed Setting the Default Editor of Virtual Scenes You can edit virtual scenes with a VRML authoring tool, such as V-Realm Builder, or with any text editor, as the VRML language is written in text files. You determine the editor that is used to edit your scene by using the vrsetpref and vrgetpref commands. The following procedure demonstrates how to change your editor from V-Realm Builder to a text editor. It assumes that you are working on a PC platform: 1.At the MATLAB command prompt, type: vrinstall -check to determine whether V-Realm Builder is installed. MATLAB displays:VRML viewer: installed VRML editor: installed The viewer and editor are installed. If the editor is not installed, see Installing VRML Editor (Windows). 2.Determine your default editor by typing :a = vrgetpref MATLAB displays :a = DefaultFigurePosition: [5 25 400 320] DefaultPanelMode: 'halfbar' DefaultViewer: 'web' Editor: [1x60 char] HttpPort: 8123 TransportBuffer: 5 VrPort: 8124 The variable a is a structure array. You need to index into it to determine the Editor property. 3.To determine your default editor, type :a.Editor MATLAB displays :ans ="%matlabroot\toolbox\vr\vrealm\program\vrbuild2.exe" "%file" This is the path to the V-Realm Builder executable file. V-Realm Builder is the current VRML editor. 4.Verify that V-Realm Builder is your default editor. At the MATLAB command prompt, type:vrpend The Inverted Pendulum demo loads and the pendulum is visible in the viewer. 5.In the vrpend model window, double-click the VR Sink block. The Block Parameters dialog box opens. 6.Click Edit. The vrpend model opens in the V-Realm Builder authoring tool. 7.Change the default editor to the MATLAB editor by typing vrsetpref('Editor','%matlabroot\bin\win32\meditor.exe %file') You can set your editor to any text editor you want to use by specifying the path to the executable of the text editor. 8.Within the vrpend demo, open the VR Sink Block Parameters dialog box. 9.Click the Edit button. The MATLAB editor opens and is now set as your default VRML editor. 10.To reset the V-Realm Builder authoring tool as your default VRML editor, type : vrsetpref('Editor','factory') Clicking the Edit button now launches V-Realm Builder. What Is the Virtual Reality Toolbox? The Virtual Reality Toolbox is a solution for viewing and interacting with dynamic systems in a three-dimensional virtual reality environment. It extends the capabilities of MATLAB and Simulink into the world of virtual reality graphics. l Virtual worlds -- Create virtual worlds or three-dimensional scenes using standard Virtual Reality Modeling Language (VRML) technology. l Dynamic systems -- Create and define dynamic systems with MATLAB and Simulink. l Animation -- View moving three-dimensional scenes driven by signals from the Simulink environment. l Manipulation -- Change the position and properties of objects in a virtual world, or change parameters in your Simulink model while running a simulation. To provide a complete working environment, the Virtual Reality Toolbox includes additional components: l VRML viewer -- Use either the Virtual Reality Toolbox viewer or, for PC platforms, the blaxxun Contact plug-in for Web browsers to display your virtual worlds. l VRML editor -- For PC platforms, use V-Realm Builder to create and edit VRML code. For UNIX or Linux platforms, use the MATLAB text editor to write VRML code to create virtual worlds. Associating a Virtual World with Simulink With the Virtual Reality Toolbox you can interface a Simulink block diagram with a virtual world. The example in this section explains how to display a simulated virtual world on a host computer. This is the recommended way to view associated virtual worlds on the host computer.This section includes the following topics: l Adding a Virtual Reality Toolbox Block -- Connect a Simulink model to a virtual world l Changing the Virtual World Associated with a Simulink Block -- Change the virtual world associated with a Simulink model, and change the signals passed between Simulink and the virtual world Adding a Virtual Reality Toolbox Block Simulating a Simulink model generates signal data for a dynamic system. By connecting the Simulink model to a virtual world, you can use this data to control and animate the virtual world. After you create a virtual world and a Simulink model, you can connect the two with Virtual Reality Toolbox blocks. The example in this procedure simulates a plane taking off and lets you view it in a virtual world: 1.In the MATLAB Command Window, type :vrtut2 A Simulink model opens without a Virtual Reality Toolbox block that connects the model to a virtual world. 2.From the Simulation menu, select Normal, then click Start. Observe the results of the simulation in the scope windows. 3.In the MATLAB Command Window, type :vrlib The Virtual Reality Toolbox library opens. 4.From the Library window, drag and drop the VR Sink block to the Simulink diagram. You can then close the Library: vrlib window. Now you are ready to select a virtual world for the visualization of your simulation. A simple virtual world with a runway and a plane is in the VRML file vrtkoff.wrl. 5.In the Simulink model, double-click the block labeled VR Sink. The Block Parameters: VR Sink dialog box opens. 6.In the Description text box, enter a brief description of the model. This description appears on the list of available worlds served by the Virtual Reality Toolbox server. For example, type :VR Plane taking off 7.Click the Browse button. The Select World dialog box opens. Find the directory <matlab root>\toolbox\vr\vrdemos. Select the file vrtkoff.wrl, and click Open. 8.In the Block Parameters: VR Sink dialog box, click Apply. A VRML tree appears on the right side, showing the structure of the associated virtual reality scene. 9.Select Show node types. On the left of the Plane Transform node, click the + square. The Plane Transform tree expands. Now you can see what characteristics of the plane can be driven from Simulink. This model computes the position and the pitch of the plane. 10.In the Plane Transform tree, select the translation and rotation fields The selected fields are marked with checks. These fields represent the position (translation) and the pitch (rotation) of the plane. 11.Click OK. In the Simulink diagram, the VR Sink block is updated with two inputs. The first input is Plane rotation. The rotation is defined by a four-element vector. The first three numbers define the axis of rotation. In this example, it should be [1 0 0] for the x-axis. The pitch of the plane is expressed by the rotation about the x-axis. The last number is the rotation angle around the x-axis, in radians. 12.In the Simulink model, connect the line going to the Scope block labeled Display Pitch to the Plane rotation input. The second input is Plane translation. This input describes the plane's position in the virtual world. This position consists of three coordinates, x, y, z. The connected vector must have three values. In this example, the runway is in the x-z plane. The y-axis defines the altitude of the plane. 13.In the Simulink model, connect the line going to the Scope block labeled Display Position to the Plane translation input. After connecting the signals and removing the Scope blocks, your model should look similar to the figure shown. Note    Virtual world degrees of freedom have different requested input vector sizes depending on the associated VRML field types. If the vector size of the connected signal does not match the associated VRML field size, an Incorrect input vector size error is reported when you start the simulation. 14.Double-click the VR Sink block in the Simulink model. Select the View button. A viewer window containing the plane's virtual world opens. 15.From the Simulation menu of the model file, click Start. A plane, moving right to left, starts down the runway and takes off into the air. Changing the Virtual World Associated with a Simulink Block Sometimes you might wan
展开阅读全文

开通  VIP会员、SVIP会员  优惠大
下载10份以上建议开通VIP会员
下载20份以上建议开通SVIP会员


开通VIP      成为共赢上传

当前位置:首页 > 包罗万象 > 大杂烩

移动网页_全站_页脚广告1

关于我们      便捷服务       自信AI       AI导航        抽奖活动

©2010-2026 宁波自信网络信息技术有限公司  版权所有

客服电话:0574-28810668  投诉电话:18658249818

gongan.png浙公网安备33021202000488号   

icp.png浙ICP备2021020529号-1  |  浙B2-20240490  

关注我们 :微信公众号    抖音    微博    LOFTER 

客服