User`s guide

Virtual Reality World and Dynamic System Examples
1-21
Portal Crane with Joystick Control (vrcrane_joystick)
The vrcrane_joystick example illustrates how a Simulink model can interact with
a virtual world. The portal crane dynamics are modeled in the Simulink interface and
visualized in virtual reality. The model uses the Joystick Input block to control the
setpoint. Joystick 3 axes control the setpoint position and button 1 starts the crane. This
example requires a standard joystick with at least three independent axes connected to
the PC.
To minimize the number of signals transferred between the Simulink model and the
virtual reality world, and to keep the model as simple and flexible as possible, only the
minimum set of moving objects properties are sent from the model to the VR Sink block.
All other values that are necessary to describe the virtual reality objects movement are
computed from this minimum set using VRMLScript in the associated VRML file.
For details on how the crane model hierarchy and scripting logic is implemented, see the
associated commented VRML file portal_crane.wrl.
Virtual Control Panel (vrdemo_panel)
The vrdemo_panel example shows the use of sensing objects that are available in the
3D World Editor Components library. These objects combine VRML sensors with logic
that changes their visual appearance based on user input. The VRML sensor values can
be read into Simulink by the VR Source block. The logic is implemented using VRML
Scripts and Routes.
The control panel contains a pushbutton, switch button, toggle switch, and a 2-D
setpoint selection area. Outputs of these elements are read into a Simulink model and
subsequently displayed using standard sinks, or used as inputs of blocks that control
back some objects in the virtual world.
Pushbutton, switch button, and toggle switches have the state outputs, which are of
boolean type. Their values are displayed using the Scope.
Two outputs of the 2D setpoint area are used to achieve the following behavior. The value
of the "SetPoint_Changed" eventOut is continuously updated when the pointer is over the
sensor area. This value is triggered by the second output - "isActive" that is true only on
clicking the pointer button. Triggered value - coordinates of the active point on the sensor
plane are displayed using the XY Graph and sent back to the virtual world in two ways:
as a position of green cone marker and as text that the VR Text Output block displays on
the control panel.