.URDFModelica.Documentation.UsersGuide

Information

This is a step by step guide of how to set up a simulation of a robot described as URDF file. Please refer to the URDF export function of CAD software for how to create the URDF (XML) file and associated meshes. The ROS 2 documentation export page may be of good advice.

Prerequisites

The library has been developed and tested on OpenModelica v1.24.0 and Dymola 2024x, Visualizers from the DLR Visualization 2 library only work with Dymola. Similarly, the generic robot simulation from a single record only works with Dymola.

The Python code has been developed and tested with Python 3.12 from the official sources. The module urdf_parser_py has been installed with pip.

User's guide

Given a valid URDF robot. You may need to change paths for visual meshes. Note that not all file types are supported by visualization, .stl in ASCII mode has been successfully tested. Collision currently (first version of the library) are not simulated, only their geometry visualized on top of the visual robot model. This can be disabled through a Boolean parameter. Mobile robots additionally are not fixed to space but free to move, the leaves of their kinematic chains (in general wheels) are prevented from falling beneath the (x, y) plane at z=0. Stationary robots are connected to the multibody World. It's best to save all files in the resources folder of the library. Note also that all names will be converted to title form (First letter upper case, the rest lower case) and should not contain "-" (minus) signs.

Open a terminal, cmd respectively, and navigate to the folder with the URDF file. Run the Python script python urdf_to_package.py

A new package will be created there with subpackages that each contain one parameter record and one model for each link, respectively joint. Three further files are

Mobile robot example: python ..\urdf_to_package.py -i physics.urdf -o physics.mo -r C:\Username\ModelicaLibraries -p URDFModelica\Examples

Stationary robot example: python ..\urdf_to_package.py -i ur10e.urdf -r C:\Username\ModelicaLibraries -p URDFModelica\Examples -s

Stationary robot example with DLR Visualization 2: python ..\urdf_to_package.py -i ur10e.urdf -r C:\Username\ModelicaLibraries -p URDFModelica\Examples -s -v

There is a last input argument to the Python script python urdf_to_package.py

Alternative: Simulation Based on URDF Robot Record

The Python script also outputs one file with all joint and link records along with connection matrices (option -o). This is used as record for a generic robot model as demonstrated in the example. A robot is a model with two arrays of variable length, joints and links, that are connected together but following a matrix to get the correct siblings. Similarly, for continuous, revolute and prismatic joints that must be actuated. For this the generic joint model that contains all joint types in one model must be used and it is not possible to modify individual robot parts.


Generated at 2025-10-07T18:21:17Z by OpenModelicaOpenModelica 1.25.4 using GenerateDoc.mos