3d simulation in ros

48
Intro Gazebo Gazebo in ROS Examples 3D Simulation in ROS Mihai Emanuel Dolha Intelligent Autonomous Systems Technische Universität München November 4, 2010 November 4, 2010 3D Simulation Mihai Emanuel Dolha

Upload: others

Post on 10-Nov-2021

7 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: 3D Simulation in ROS

Intro Gazebo Gazebo in ROS Examples

3D Simulation in ROS

Mihai Emanuel Dolha

Intelligent Autonomous SystemsTechnische Universität München

November 4, 2010

November 4, 2010

3D Simulation Mihai Emanuel Dolha

Page 2: 3D Simulation in ROS

Intro Gazebo Gazebo in ROS Examples

Outline

1. Introduction

2. Gazebo

3. Gazebo in ROS

4. Examples

November 4, 2010

3D Simulation Mihai Emanuel Dolha

Page 3: 3D Simulation in ROS

Intro Gazebo Gazebo in ROS Examples

Outline

1. Introduction

2. Gazebo

3. Gazebo in ROS

4. Examples

November 4, 2010

3D Simulation Mihai Emanuel Dolha

Page 4: 3D Simulation in ROS

Intro Gazebo Gazebo in ROS Examples

Why do we use simulators? (1/2)

November 4, 2010

3D Simulation Mihai Emanuel Dolha

Page 5: 3D Simulation in ROS

Intro Gazebo Gazebo in ROS Examples

Why do we use simulators?(2/2)

November 4, 2010

3D Simulation Mihai Emanuel Dolha

Page 6: 3D Simulation in ROS

Intro Gazebo Gazebo in ROS Examples

3D Simulator Components

November 4, 2010

3D Simulation Mihai Emanuel Dolha

Page 7: 3D Simulation in ROS

Intro Gazebo Gazebo in ROS Examples

3D Simulator Components

November 4, 2010

3D Simulation Mihai Emanuel Dolha

Page 8: 3D Simulation in ROS

Intro Gazebo Gazebo in ROS Examples

3D Simulator Components

November 4, 2010

3D Simulation Mihai Emanuel Dolha

Page 9: 3D Simulation in ROS

Intro Gazebo Gazebo in ROS Examples

3D Simulator Components

November 4, 2010

3D Simulation Mihai Emanuel Dolha

Page 10: 3D Simulation in ROS

Intro Gazebo Gazebo in ROS Examples

Outline

1. Introduction

2. Gazebo

3. Gazebo in ROS

4. Examples

November 4, 2010

3D Simulation Mihai Emanuel Dolha

Page 11: 3D Simulation in ROS

Intro Gazebo Gazebo in ROS Examples

Gazebo

I 3D multi robot simulator with dynamicsI part of the Player/Stage project

November 4, 2010

3D Simulation Mihai Emanuel Dolha

Page 12: 3D Simulation in ROS

Intro Gazebo Gazebo in ROS Examples

Physics Engine(s)

I currently supported: ODE, Bullet

I rigid body dynamicsI based on Newton’s second law:

~F = m~aI constraint formulationI collision detectionI accelerations, velocities and

poses

November 4, 2010

3D Simulation Mihai Emanuel Dolha

Page 13: 3D Simulation in ROS

Intro Gazebo Gazebo in ROS Examples

Physics Engine(s)

I currently supported: ODE, BulletI rigid body dynamics

I based on Newton’s second law:~F = m~a

I constraint formulationI collision detectionI accelerations, velocities and

poses

November 4, 2010

3D Simulation Mihai Emanuel Dolha

Page 14: 3D Simulation in ROS

Intro Gazebo Gazebo in ROS Examples

Physics Engine(s)

I currently supported: ODE, BulletI rigid body dynamicsI based on Newton’s second law:

~F = m~a

I constraint formulationI collision detectionI accelerations, velocities and

poses

November 4, 2010

3D Simulation Mihai Emanuel Dolha

Page 15: 3D Simulation in ROS

Intro Gazebo Gazebo in ROS Examples

Physics Engine(s)

I currently supported: ODE, BulletI rigid body dynamicsI based on Newton’s second law:

~F = m~aI constraint formulation

I collision detectionI accelerations, velocities and

poses

November 4, 2010

3D Simulation Mihai Emanuel Dolha

Page 16: 3D Simulation in ROS

Intro Gazebo Gazebo in ROS Examples

Physics Engine(s)

I currently supported: ODE, BulletI rigid body dynamicsI based on Newton’s second law:

~F = m~aI constraint formulationI collision detection

I accelerations, velocities andposes

November 4, 2010

3D Simulation Mihai Emanuel Dolha

Page 17: 3D Simulation in ROS

Intro Gazebo Gazebo in ROS Examples

Physics Engine(s)

I currently supported: ODE, BulletI rigid body dynamicsI based on Newton’s second law:

~F = m~aI constraint formulationI collision detectionI accelerations, velocities and

poses

November 4, 2010

3D Simulation Mihai Emanuel Dolha

Page 18: 3D Simulation in ROS

Intro Gazebo Gazebo in ROS Examples

Physics Engine(s)

I ConstraintsI jointsI contacts

I Collision detectionI continuous or discreteI broad phase and narrow phase

November 4, 2010

3D Simulation Mihai Emanuel Dolha

Page 19: 3D Simulation in ROS

Intro Gazebo Gazebo in ROS Examples

Rendering Engine

Ogre3DI Object-Oriented Graphics

Rendering EngineI based on OpenGL

November 4, 2010

3D Simulation Mihai Emanuel Dolha

Page 20: 3D Simulation in ROS

Intro Gazebo Gazebo in ROS Examples

Modelling in Gazebo

Gazebo modelI other modelsI bodies

I pose,massI geometries

I collision shapeI visual shape

I sensorsI jointsI controllers

November 4, 2010

3D Simulation Mihai Emanuel Dolha

Page 21: 3D Simulation in ROS

Intro Gazebo Gazebo in ROS Examples

Sensors in Gazebo

Laser sensorsI provided by physics

engineI raycastingI zero sweeping

durationI noise freeI real world data is

much more cluttered

November 4, 2010

3D Simulation Mihai Emanuel Dolha

Page 22: 3D Simulation in ROS

Intro Gazebo Gazebo in ROS Examples

Sensors in Gazebo

CamerasI provided by

rendering engineI ideal pinhole

camerasI noise free and in

focusI no calibration

neededI real world like

texturing, shadingand lighting requireeffort

November 4, 2010

3D Simulation Mihai Emanuel Dolha

Page 23: 3D Simulation in ROS

Intro Gazebo Gazebo in ROS Examples

Modeling in Gazebo

World files

November 4, 2010

3D Simulation Mihai Emanuel Dolha

Page 24: 3D Simulation in ROS

Intro Gazebo Gazebo in ROS Examples

Communication in Gazebo

Controllers and interfaces

I clients write commands on interfacesI controllers get commands from interfacesI commands are processed, then applied to simulated modelI current model status and results are send to client

November 4, 2010

3D Simulation Mihai Emanuel Dolha

Page 25: 3D Simulation in ROS

Intro Gazebo Gazebo in ROS Examples

Communication in Gazebo

Controllers and interfacesI clients write commands on interfaces

I controllers get commands from interfacesI commands are processed, then applied to simulated modelI current model status and results are send to client

November 4, 2010

3D Simulation Mihai Emanuel Dolha

Page 26: 3D Simulation in ROS

Intro Gazebo Gazebo in ROS Examples

Communication in Gazebo

Controllers and interfacesI clients write commands on interfacesI controllers get commands from interfaces

I commands are processed, then applied to simulated modelI current model status and results are send to client

November 4, 2010

3D Simulation Mihai Emanuel Dolha

Page 27: 3D Simulation in ROS

Intro Gazebo Gazebo in ROS Examples

Communication in Gazebo

Controllers and interfacesI clients write commands on interfacesI controllers get commands from interfacesI commands are processed, then applied to simulated model

I current model status and results are send to client

November 4, 2010

3D Simulation Mihai Emanuel Dolha

Page 28: 3D Simulation in ROS

Intro Gazebo Gazebo in ROS Examples

Communication in Gazebo

Controllers and interfacesI clients write commands on interfacesI controllers get commands from interfacesI commands are processed, then applied to simulated modelI current model status and results are send to client

November 4, 2010

3D Simulation Mihai Emanuel Dolha

Page 29: 3D Simulation in ROS

Intro Gazebo Gazebo in ROS Examples

Outline

1. Introduction

2. Gazebo

3. Gazebo in ROS

4. Examples

November 4, 2010

3D Simulation Mihai Emanuel Dolha

Page 30: 3D Simulation in ROS

Intro Gazebo Gazebo in ROS Examples

Overview

I stack:simulator_gazebo

I actively maintainedand developed

I improved modelingmechanism

I integrated in theROS comunicationmechanisms

November 4, 2010

3D Simulation Mihai Emanuel Dolha

Page 31: 3D Simulation in ROS

Intro Gazebo Gazebo in ROS Examples

Modeling using URDF

I URDF Description:

< robot name=" t e s t _ r o b o t ">< l i n k name=" l i n k 1 " / >< l i n k name=" l i n k 2 " / >< l i n k name=" l i n k 3 " / >< l i n k name=" l i n k 4 " / >

< j o i n t name=" j o i n t 1 " type="cont inuous ">

<parent l i n k =" l i n k 1 " / >< c h i l d l i n k =" l i n k 2 " / >

< / j o i n t >

< j o i n t name=" j o i n t 2 " type="cont inuous ">

<parent l i n k =" l i n k 1 " / >< c h i l d l i n k =" l i n k 3 " / >

< / j o i n t >

< j o i n t name=" j o i n t 3 " type="cont inuous ">

<parent l i n k =" l i n k 3 " / >< c h i l d l i n k =" l i n k 4 " / >

< / j o i n t >< / robot>

November 4, 2010

3D Simulation Mihai Emanuel Dolha

Page 32: 3D Simulation in ROS

Intro Gazebo Gazebo in ROS Examples

Modeling

I Gazebo URDF extension

<gazebo re ference=" f i nge r_ t i p_camera_ l i nk "><sensor:camera name=" f inger_t ip_camera_sensor ">

<imageSize>640 480< / imageSize><imageFormat>L8< / imageFormat><hfov>90< / hfov><nearCl ip>0.01< / nearCl ip>< f a r C l i p >100< / f a r C l i p ><updateRate>20.0< / updateRate><con t ro l l e r : r os_camera name=" f i n g e r _ t i p _ c a m e r a _ c o n t r o l l e r " p lug in ="

l ibros_camera . so "><alwaysOn> t rue < / alwaysOn><updateRate>20.0< / updateRate><topicName>f inger_ t ip_cam / image< / topicName><frameName> f i nge r_ t i p_camera_ l i nk < / frameName>< in te r face :camera name=" f i nge r_ t i p_camera_ i face " / >

< / con t ro l l e r : r os_camera >< / sensor:camera>< t u r n G r a v i t y O f f > t rue < / t u r n G r a v i t y O f f >< ma te r i a l >PR2/ Blue< / ma te r i a l >

< / gazebo>

November 4, 2010

3D Simulation Mihai Emanuel Dolha

Page 33: 3D Simulation in ROS

Intro Gazebo Gazebo in ROS Examples

Modeling

I Loading a URDF model in Gazebo

<launch>

< !−− send pr2 u rd f to param server −−><param name=" r o b o t _ d e s c r i p t i o n " command=" $( f i n d xacro ) / xacro . py ’ $ ( f i n d

p r2_desc r i p t i on ) / robots / pr2 . u rd f . xacro ’ " / >

< !−− push r o b o t _ d e s c r i p t i o n to f a c t o r y and spawn robot i n gazebo −−><node name=" pr2_gazebo_model " pkg=" gazebo " type=" spawn_model " args=" $( optenv

ROBOT_INITIAL_POSE) −unpause −u rd f −param r o b o t _ d e s c r i p t i o n −model pr2 "respawn=" f a l s e " output= " screen " / >

< / launch>

November 4, 2010

3D Simulation Mihai Emanuel Dolha

Page 34: 3D Simulation in ROS

Intro Gazebo Gazebo in ROS Examples

Communication & Control

I robot description on parameter serverI the controller manager:

I loads controllersI creates a robot state object

I client nodes publish their commands on topicsI controllers read the topics, process the command and

push it to the robot stateI the controller manager gets the commands from the robot

state and sends them to the hardware or to the simulatedmodel

November 4, 2010

3D Simulation Mihai Emanuel Dolha

Page 35: 3D Simulation in ROS

Intro Gazebo Gazebo in ROS Examples

Communication & Control

I robot description on parameter server

I the controller manager:I loads controllersI creates a robot state object

I client nodes publish their commands on topicsI controllers read the topics, process the command and

push it to the robot stateI the controller manager gets the commands from the robot

state and sends them to the hardware or to the simulatedmodel

November 4, 2010

3D Simulation Mihai Emanuel Dolha

Page 36: 3D Simulation in ROS

Intro Gazebo Gazebo in ROS Examples

Communication & Control

I robot description on parameter serverI the controller manager:

I loads controllersI creates a robot state object

I client nodes publish their commands on topicsI controllers read the topics, process the command and

push it to the robot stateI the controller manager gets the commands from the robot

state and sends them to the hardware or to the simulatedmodel

November 4, 2010

3D Simulation Mihai Emanuel Dolha

Page 37: 3D Simulation in ROS

Intro Gazebo Gazebo in ROS Examples

Communication & Control

I robot description on parameter serverI the controller manager:

I loads controllers

I creates a robot state objectI client nodes publish their commands on topicsI controllers read the topics, process the command and

push it to the robot stateI the controller manager gets the commands from the robot

state and sends them to the hardware or to the simulatedmodel

November 4, 2010

3D Simulation Mihai Emanuel Dolha

Page 38: 3D Simulation in ROS

Intro Gazebo Gazebo in ROS Examples

Communication & Control

I robot description on parameter serverI the controller manager:

I loads controllersI creates a robot state object

I client nodes publish their commands on topicsI controllers read the topics, process the command and

push it to the robot stateI the controller manager gets the commands from the robot

state and sends them to the hardware or to the simulatedmodel

November 4, 2010

3D Simulation Mihai Emanuel Dolha

Page 39: 3D Simulation in ROS

Intro Gazebo Gazebo in ROS Examples

Communication & Control

I robot description on parameter serverI the controller manager:

I loads controllersI creates a robot state object

I client nodes publish their commands on topics

I controllers read the topics, process the command andpush it to the robot state

I the controller manager gets the commands from the robotstate and sends them to the hardware or to the simulatedmodel

November 4, 2010

3D Simulation Mihai Emanuel Dolha

Page 40: 3D Simulation in ROS

Intro Gazebo Gazebo in ROS Examples

Communication & Control

I robot description on parameter serverI the controller manager:

I loads controllersI creates a robot state object

I client nodes publish their commands on topicsI controllers read the topics, process the command and

push it to the robot state

I the controller manager gets the commands from the robotstate and sends them to the hardware or to the simulatedmodel

November 4, 2010

3D Simulation Mihai Emanuel Dolha

Page 41: 3D Simulation in ROS

Intro Gazebo Gazebo in ROS Examples

Communication & Control

I robot description on parameter serverI the controller manager:

I loads controllersI creates a robot state object

I client nodes publish their commands on topicsI controllers read the topics, process the command and

push it to the robot stateI the controller manager gets the commands from the robot

state and sends them to the hardware or to the simulatedmodel

November 4, 2010

3D Simulation Mihai Emanuel Dolha

Page 42: 3D Simulation in ROS

Intro Gazebo Gazebo in ROS Examples

Communication & Control

I pr2_teleop publishes commands on topic(/base_contrller/command)

I base_controller computes commands for each wheel andupdates the commands on the robot state

I the gazebo_ros_controller_manager checks the robotstate for commands and sends them to the joints of thesimulated model

I for controlling the real hardware: pr2_controller_managerI real world / simulator switching is done by the env. var.

ROBOT

November 4, 2010

3D Simulation Mihai Emanuel Dolha

Page 43: 3D Simulation in ROS

Intro Gazebo Gazebo in ROS Examples

Outline

1. Introduction

2. Gazebo

3. Gazebo in ROS

4. Examples

November 4, 2010

3D Simulation Mihai Emanuel Dolha

Page 44: 3D Simulation in ROS

Intro Gazebo Gazebo in ROS Examples

The PR2 pluging in

November 4, 2010

3D Simulation Mihai Emanuel Dolha

Page 45: 3D Simulation in ROS

Intro Gazebo Gazebo in ROS Examples

Naive physics simulation

November 4, 2010

3D Simulation Mihai Emanuel Dolha

Page 46: 3D Simulation in ROS

Intro Gazebo Gazebo in ROS Examples

Naive physics simulation

November 4, 2010

3D Simulation Mihai Emanuel Dolha

Page 47: 3D Simulation in ROS

Intro Gazebo Gazebo in ROS Examples

Human character simulation

November 4, 2010

3D Simulation Mihai Emanuel Dolha

Page 48: 3D Simulation in ROS

Intro Gazebo Gazebo in ROS Examples

Thank you

Questions?

November 4, 2010

3D Simulation Mihai Emanuel Dolha