Lecture 4
3D Visualization
with Modelica
1 Copyright © Open Source Modelica Consortium
Application of Modelica in Robotics Models
Real-time Training Simulator for Flight, Driving
• Using Modelica models
generating real-time
code
• Different simulation
environments (e.g.
Flight, Car Driving,
Helicopter)
• Developed at DLR
Munich, Germany
• Dymola Modelica tool
(Movie demo next page)
Courtesy of Tobias Bellmann, DLR,
Oberphaffenhofen, Germany
2 Copyright © Open Source Modelica Consortium
DLR Real-time Training Simulator Movie Demo
3 Copyright © Open Source Modelica Consortium
OMEdit 3D Visualization of Multi-Body Systems
• Built-in feature of OMEdit to
animate MSL-Multi-Body
shapes
• Visualization of simulation
results
• Animation of geometric Simulate
with
primitives and CAD-Files Animation
New
Animation
Window
4 Copyright © Open Source Modelica Consortium
OpenModelica 3D Animation Demo
(V6Engine and Excavator)
5 Copyright © Open Source Modelica Consortium
OpenModelica 3D Animation – Excavator
6 Copyright © Open Source Modelica Consortium
The Mechanics.MultiBody Library has
Pre-defined Geometric Shapes
Default visualization shapes for
Body, BodyShape, BodyBox, and BodyCylinder
• Geometric primitives Visualization body shapes for BodyShape
and CAD-Files: depending on the value of shapeType
7 Copyright © Open Source Modelica Consortium
Visualization using Third-Party Libraries:
DLR Visualization Library
• Advanced, model-integrated
and vendor-unspecific
visualization tool for
Modelica models
• Offline, online and real-time
animation
• Video-export function
• Commercial library, feature
reduced free Community
Edition exists
Courtesy of Dr. Tobias Bellmann (DLR)
8 Copyright © Open Source Modelica Consortium
DLR Visualization Library – More Details
• Advanced, model-integrated and vendor-unspecific visualization tool for
Modelica models. especially useful in the mechanical, fluid and
electrical area. Most components are attached to a Modelica model with a
Frame connector of the Modelica.Mechanics.MultiBody library
• Offline, online and real-time animation
• Visualizers for basic shapes, CAD files (.3ds, .obj, .dxf, .stl, .vrml and
more), flexible bodies and surfaces, text, light, energy-/mass-flow
visualizers, analogue instruments and weather effects. A camera system.
• Buttons, Checkboxes and Sliders are available for the creation of
graphical user interfaces. control the simulation interactively.
• Support for multi-camera scenes, a fullscreen mode, several monitors,
replays and stereo/wireframe modes. Based on the OpenSceneGraph
• Video-export as MPEG4, Windows Media Video, Flash Video
9 Copyright © Open Source Modelica Consortium
DLR Visualization Library – Modelica Components
10 Copyright © Open Source Modelica Consortium
DLR Visualization Library – DLR SimVis Viewer
Example
View
11 Copyright © Open Source Modelica Consortium
Exercise 4.1: Use 3D Visualization for Robot model
• Open the
Modelica.Mechanics.MultiBody.Examples.Systems.
RobotR3.fullRobot
example in OMEdit
• Press Simulate with Animation
• Replay the animation
• Compare with the plot
12 Copyright © Open Source Modelica Consortium
Exercise 4.2: Visualization using the
DLR Visualization Community Edition (1)
• UnpackVisualizationCommunityEdition.zip
• Open the library in OMEdit, by doing load
library on the Visualization subdirectory
• Simulate(->) the EMotor example
• The DLR SimVis visualization app should
start automatically
• Export the animation
(File→Export Replay as Video, use an
absolute file path to find the created file)
Please note: As of OpenModelica
v1.12 support for the library is only
partial and it is not yet as stable, fast
and complete as for the Dymola tool
(work in progress!)
13 Copyright © Open Source Modelica Consortium
Exercise 4.2 Cont’: Visualization using the
DLR Visualization Community Edition (2)
Goal: Instead of OMEdit, use OMShell for
running the examples
• Enter the Visualization directory in the
accompanying files and use an editor to
open the OpenModelica scripting file
runVisualizationCommunityExamples.mos
• Change the “libraryPath” variable in the
script to the respective library path on
your machine
• Start the OMShell tool
• You can copy-paste the commands from
the scripting file into the OMShell tool
14 Copyright © Open Source Modelica Consortium