User`s guide

1 Getting Started
1-28
Inverted Pendulum Example (vrpend)
The vrpend example illustrates the various ways a dynamic model in the Simulink
interface can interact with a virtual reality scene. It is the model of a two-dimensional
inverted pendulum controlled by a PID controller. What distinguishes this model from
common inverted pendulum models are the methods for setting the set point. You
visualize and interact with a virtual world by using a Trajectory Graph and VR Sink
blocks. The Trajectory Graph block allows you to track the history of the pendulum
position and change the set point in three ways:
Mouse — Click and drag a mouse pointer in the Trajectory Graph two-dimensional
window
Input Signal — External Trajectory Graph input in this model (driven by a random
number generator)
VR Sensor — Activates the input from a VRML TouchSensor
When the pointing device in the VRML viewer moves over an active TouchSensor area,
the cursor shape changes. The triggering logic in this model is set to apply the new set
point value with a left mouse button click.
Notice the pseudoorthographic view defined in the associated VRML file. You achieve
this effect by creating a viewpoint that is located far from the object of interest with a
very narrow view defined by the VRML FieldOfView parameter. An orthographic view
is useful for eliminating the panoramic distortion that occurs when you are using a wide-
angle lens. The disadvantage of this technique is that locating the viewpoint at a distance
makes the standard viewer navigation tricky or difficult in some navigation modes, such
as the Examine mode. If you want to navigate around the virtual pendulum bench, you
should use some other viewpoint.
Solar System Example (vrplanets)
The vrplanets example shows the dynamic representation of the first four planets of
the solar system, Moon orbiting around Earth, and Sun itself. The model uses the real
properties of the celestial bodies. Only the relative planet sizes and the distance between
the Earth and the Moon are adjusted, to provide an interesting view.
Several viewpoints are defined in the virtual world, both static and attached to an
observer on Earth. You can see that the planet bodies are not represented as perfect
spheres. Using the VRML Sphere graphic primitive, which is rendered this way,
simplified the model. If you want to make the planets more realistic, you could use the
more complex IndexedFaceSet node type.