pcg_gazebo_pkgs
A PYTHON LIBRARY FOR SCRIPTING AND RAPID-PROTOTYPINGOF SIMULATED GAZEBO MODELS AND WORLDS

Musa Morena Marcusso Manhães
Bosch Corporate Research – Renningen, Germany
Robotics Systems Department (CR/AER)ROSCon 2019 - MacauINTRODUCTION

Procedural Generation for Gazebo
Motivation
 Problems: How to do rapid-prototyping of simulations inGazebo (specially for non-simulation experts)
 How to quickly design and create new and/or
multiple simulations with different
[1]

[1]

[1]

 Approach Use scripting language Create abstractions of Gazebo model, worldsand configuration data structures (e.g. physicsengine configuration)

Physics engine parameters

 Use of SDF and URDF formats to import/export
model and world descriptions

Robot components and structures

 Algorithmically generate of scenes, models andparameter configuration sets for a simulation

Objects placements

 Idea: Procedural Generation for Gazebo
 Technique from gaming development[1][1] Source: https://www.iconfinder.com/iconsets/brainy-mixed
License: https://creativecommons.org/licenses/by/3.0/

3Musa Morena Marcusso Manhães | 31.10.2019
ROSCon 2019 Macau© Robert Bosch GmbH 2019. All rights reserved, also regarding any disposal, exploitation, reproduction, editing, distribution, as well as in the event of applications for industrial property rights.

Procedural Generation for Gazebo
Detailed goals Rapid-prototyping of simulation scenarios
 Create abstractions to simulation entities (e.g. models, sensors, physics engine parameters) that can be easily manipulated Allow scripting of Gazebo simulations (generation of models, setting/accessing parameters in runtime, interacting withsimulation via script)‒ Easy factory functions to create simulation models to populate scenarios (e.g. geometric primitives, derived from meshes)‒ Also useful in e.g. machine learning algorithms, reinforcement learning, optimization

 Integration of scripted simulations in automated simulation-based tests‒ Generation of simulation scenarios for testing of, for example, motion planners and SLAM algorithms

 More control over the robot descriptions
 XML parsers for SDF and URDF
 Extend templating options for robot descriptions
 Improve conversion between URDF and SDF formats for better use of Gazebo’s features

4

Musa Morena Marcusso Manhães | 31.10.2019
ROSCon 2019 Macau© Robert Bosch GmbH 2019. All rights reserved, also regarding any disposal, exploitation, reproduction, editing, distribution, as well as in the event of applications for industrial property rights.

pcg_gazebo_pkgs
generators[1]

parsers

simulation
[1]

[1]

task_manager[1]

model_factory

physics

model_group_generator

modelssdf

process_manager

world_generator

links

urdf

stagesassets_manager

jointssdf_config

tasks

engines_manager

sensors

constraints_manager

lightsjinja

properties

xacro

importer/exportergazebo_proxy

template_processors

converters
sdf2urdf
urdf2sdf[1] Source: https://www.iconfinder.com/iconsets/brainy-mixed
License: https://creativecommons.org/licenses/by/3.0/

5Musa Morena Marcusso Manhães | 31.10.2019
ROSCon 2019 Macau© Robert Bosch GmbH 2019. All rights reserved, also regarding any disposal, exploitation, reproduction, editing, distribution, as well as in the event of applications for industrial property rights.

FEATURES

Inspection of Gazebo models
Visualizing models already in the database The library loads the paths ofall static Gazebo models inthe current catkin workspace
 $HOME/.gazebo/models
 /usr/share/gazebo$GAZEBO_VERSION/models

 They can be loaded using
their tag into a
SimulationModel object[1][2][1] Source: https://app.ignitionrobotics.org/chapulina/fuel/models/JanSport%20Backpack%20Red
License: Creative Commons – Public Domain[2] Source: https://app.ignitionrobotics.org/openrobotics/fuel/models/Toolbox
License: Creative Commons – Public Domain

7Musa Morena Marcusso Manhães | 31.10.2019
ROSCon 2019 Macau© Robert Bosch GmbH 2019. All rights reserved, also regarding any disposal, exploitation, reproduction, editing, distribution, as well as in the event of applications for industrial property rights.

Inspection of Gazebo models
Inspecting SDF from a SimulationModel object

The SDF elements can be accessed

The SDF elements also be altered and thevia their Python object abstraction

object again exported into a XML file

SimulationModel objects can be converted
into a SDF object
8Musa Morena Marcusso Manhães | 31.10.2019
ROSCon 2019 Macau© Robert Bosch GmbH 2019. All rights reserved, also regarding any disposal, exploitation, reproduction, editing, distribution, as well as in the event of applications for industrial property rights.

Creating models using Jupyter notebooks
Experimenting with friction parameters Create instances of thesame box model withdifferent friction
coefficients
 Inspect the resulting SDF
file Spawn to Gazebo

 Apply wrench to eachmodel

9

Musa Morena Marcusso Manhães | 31.10.2019
ROSCon 2019 Macau© Robert Bosch GmbH 2019. All rights reserved, also regarding any disposal, exploitation, reproduction, editing, distribution, as well as in the event of applications for industrial property rights.

Creating models using Jupyter notebooks
Mobile base tutorial Start a Gazebo
 Create mobile base links
 Chassis
 Wheels
 Caster wheel

 Set friction coefficients for casterwheels to zero for both bullet andode For links from geometry primitives,
the inertial tensors will be computed
using the dimensions of thegeometry
 Create joints
 Spawn to Gazebo

10

Musa Morena Marcusso Manhães | 31.10.2019
ROSCon 2019 Macau© Robert Bosch GmbH 2019. All rights reserved, also regarding any disposal, exploitation, reproduction, editing, distribution, as well as in the event of applications for industrial property rights.

Model factory
Using model factory functions
 Complete single-link models can becreaters using thepcg_gazebo.creators submodule Primitives box, sphere, cylinder areavailable and generated data includes

Inertial tensor based on the geometry’s
dimensions

Visual and collision information

 extrude allows the generation of models
from meshes extruded from shapely
geometry objects
 mesh creators allow the computation of
approximated geometries using the input
mesh that can be used as simplified
collision geometry and input forcomputation of the moments of inertia
 Models can be parametrized with fixedvalue inputs or lambda functions

11

Musa Morena Marcusso Manhães | 31.10.2019
ROSCon 2019 Macau© Robert Bosch GmbH 2019. All rights reserved, also regarding any disposal, exploitation, reproduction, editing, distribution, as well as in the event of applications for industrial property rights.

Model group generators
Generating sets of dynamically generated models
Model group
generator asset

At each model_group instance createdfrom the model_group_generator, allmodel descriptions containing lambda
functions will be recomputed

full_crate
1*••12crateball*cuboid*cylinderMultiple instances of ball,cuboid, cylinder generatedusing the random_pose engine
with spatial constraints

ball, cuboid and cylinder properties represented by lambda functions
New model properties are generated each time an instance of the model iscreatedMusa Morena Marcusso Manhães | 31.10.2019
ROSCon 2019 Macau© Robert Bosch GmbH 2019. All rights reserved, also regarding any disposal, exploitation, reproduction, editing, distribution, as well as in the event of applications for industrial property rights.

SDF Jinja TemplatesTemplating robot descriptions
Processing the Jinja template, generate SDF and instantiate a SimulationModel object

Creating a static Gazebo model with metadata in the $HOME/.gazebo/models folder

Exporting the URDF file for the kobuki robot
kobuki robot description written
as a SDF Jinja template

Spawn the model to a running instance of Gazebo

13Musa Morena Marcusso Manhães | 31.10.2019
ROSCon 2019 Macau© Robert Bosch GmbH 2019. All rights reserved, also regarding any disposal, exploitation, reproduction, editing, distribution, as well as in the event of applications for industrial property rights.

World generators
Generating world configurations

Original setup
14

Musa Morena Marcusso Manhães | 31.10.2019
ROSCon 2019 Macau© Robert Bosch GmbH 2019. All rights reserved, also regarding any disposal, exploitation, reproduction, editing, distribution, as well as in the event of applications for industrial property rights.

Collision geometries

World generators
Workspaces and pose randomization with collision checking

Handbags

Shoes

Skateboard

Living room
15

Musa Morena Marcusso Manhães | 31.10.2019
ROSCon 2019 Macau© Robert Bosch GmbH 2019. All rights reserved, also regarding any disposal, exploitation, reproduction, editing, distribution, as well as in the event of applications for industrial property rights.

World generators
Pose randomization

Dining room
Kitchen
Living room
16

Musa Morena Marcusso Manhães | 31.10.2019
ROSCon 2019 Macau© Robert Bosch GmbH 2019. All rights reserved, also regarding any disposal, exploitation, reproduction, editing, distribution, as well as in the event of applications for industrial property rights.

World generators
Generating grid maps from Gazebo worlds via ray tracing
ΔzΔz, list of models to exclude from grid map

17

Musa Morena Marcusso Manhães | 31.10.2019
ROSCon 2019 Macau© Robert Bosch GmbH 2019. All rights reserved, also regarding any disposal, exploitation, reproduction, editing, distribution, as well as in the event of applications for industrial property rights.

World generators
Generating grid maps from Gazebo worlds via ray tracing

18

Musa Morena Marcusso Manhães | 31.10.2019
ROSCon 2019 Macau© Robert Bosch GmbH 2019. All rights reserved, also regarding any disposal, exploitation, reproduction, editing, distribution, as well as in the event of applications for industrial property rights.

TL;DR

TL;DR pcg_gazebo_pkgs can be used for testing simulation scenarios without editing XML files
 Scripting can be used to generate assets and interact with the simulation
 Dynamic model and world generation allows generation of large number of assets with small effort
for testing robotics systems solutions in various contexts
 Python libraries can be used on the simulation building process, along with Jupyter notebooks
 Model editing and inspection
 sdf2urdf and urdf2sdf give more possibilities of ways to represent the robot description
 Package available at https://github.com/boschresearch/pcg_gazebo_pkgs under
Apache-2.0 license

20

Musa Morena Marcusso Manhães | 31.10.2019
ROSCon 2019 Macau© Robert Bosch GmbH 2019. All rights reserved, also regarding any disposal, exploitation, reproduction, editing, distribution, as well as in the event of applications for industrial property rights.

THANK YOU

CONTACT
Musa Morena Marcusso Manhães (musa.marcusso@de.bosch.com)
REPOSITORY
https://github.com/boschresearch/pcg_gazebo_pkgs