introduction to ros

56
University of Hamburg MIN Faculty Department of Informatics ROS Introduction Introduction to ROS Lasse Einig, Dennis Krupke, Florens Wasserfall University of Hamburg Faculty of Mathematics, Informatics and Natural Sciences Department of Informatics Technical Aspects of Multimodal Systems April 7, 2016 L. Einig, D. Krupke, F. Wasserfall 1

Upload: others

Post on 26-Oct-2021

3 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Introduction to ROS

University of Hamburg

MIN FacultyDepartment of Informatics

ROS Introduction

Introduction to ROS

Lasse Einig, Dennis Krupke, Florens Wasserfall

University of HamburgFaculty of Mathematics, Informatics and Natural SciencesDepartment of InformaticsTechnical Aspects of Multimodal Systems

April 7, 2016

L. Einig, D. Krupke, F. Wasserfall 1

Page 2: Introduction to ROS

University of Hamburg

MIN FacultyDepartment of Informatics

Foundation ROS Introduction

Motivation

I Heterogeneity vs. HomogeneityI sensor types, actuators, ...I sensor model, kinematic chain, ...

I AbstractionI Algorithm re-usability

I 2D laser data mappingI object recognition

I DebuggingI simulation, data visualization, ...

L. Einig, D. Krupke, F. Wasserfall 2

Page 3: Introduction to ROS

University of Hamburg

MIN FacultyDepartment of Informatics

Foundation ROS Introduction

Idea

I Robot Operating SystemI Meta operating systemI Open sourceI Hardware abstraction

I portabilityI simplification of sensors and actuators

I Recurring tasks already solvedI Navigation, data filtering, object recognition ...

L. Einig, D. Krupke, F. Wasserfall 3

Page 4: Introduction to ROS

University of Hamburg

MIN FacultyDepartment of Informatics

Foundation ROS Introduction

Current State

I Multiple versions actively usedI may not be compatible to each otherI may not provide same libraries

I Linux (Ubuntu!)I Supports C/C++, Python, Java, Lisp, Octave ...

I Python for high level code/fast implementationI C/C++ for algorithms/computation

I Functions and algorithms already availableI May be difficult to findI Better than reimplementing

L. Einig, D. Krupke, F. Wasserfall 4

Page 5: Introduction to ROS

University of Hamburg

MIN FacultyDepartment of Informatics

Structure ROS Introduction

ROS System

I ROS nodesI sensorsI actuatorsI logic

I ROS coreI Communication

L. Einig, D. Krupke, F. Wasserfall 5

Page 6: Introduction to ROS

University of Hamburg

MIN FacultyDepartment of Informatics

Structure ROS Introduction

ROS Node

I Discrete part of the systemI Specialized software/algorithmI Many ROS nodes per systemI Example:

I node gets imageI runs edge detection algorithm on itI provides found edges

L. Einig, D. Krupke, F. Wasserfall 6

Page 7: Introduction to ROS

University of Hamburg

MIN FacultyDepartment of Informatics

Structure ROS Introduction

ROS Core

I Central unit, also called ROS masterI nodesI sensorsI communication

I Coordination of nodesI Communication ManagementI Exactly one per systemI Transparent to the user

L. Einig, D. Krupke, F. Wasserfall 7

Page 8: Introduction to ROS

University of Hamburg

MIN FacultyDepartment of Informatics

Structure ROS Introduction

Communication

I MessagesI standardized data types

I TopicsI n:n communication

I Services and ActionsI 1:1 communication

L. Einig, D. Krupke, F. Wasserfall 8

Page 9: Introduction to ROS

University of Hamburg

MIN FacultyDepartment of Informatics

Structure ROS Introduction

Sensors

I ExplorationI LocalizationI DetectionI One node per sensor

I provide data as topicI abstract from hardware

L. Einig, D. Krupke, F. Wasserfall 9

Page 10: Introduction to ROS

University of Hamburg

MIN FacultyDepartment of Informatics

Structure ROS Introduction

System structure

applications fetch beercapabilitiesuniverse navigation; arm; grasping

libraries tf; pcl; opencv; bullet; eigentools rxgraph; rostopic; roslaunch

middlewaremain rosmaster; roscpp; rosbuild

I universe → robot centric, developed by communityI main → general tools, maintained by Willow Garage

L. Einig, D. Krupke, F. Wasserfall 10

Page 11: Introduction to ROS

University of Hamburg

MIN FacultyDepartment of Informatics

Communication - Messages ROS Introduction

Messages

I Fundamental communication conceptI Description of data setI Data types

I ROSI general

I HeaderI time stampI identifier

$ rosmsg show -r robot msgs/Quaternion# xyz - vector rotation axis, w - scalar term (cos(ang/2))float64 xfloat64 yfloat64 zfloat64 w

L. Einig, D. Krupke, F. Wasserfall 11

Page 12: Introduction to ROS

University of Hamburg

MIN FacultyDepartment of Informatics

Communication - Messages ROS Introduction

Messages

I Fundamental communication conceptI Description of data setI Data types

I ROSI general

I HeaderI time stampI identifier

$ rosmsg show -r robot msgs/Quaternion# xyz - vector rotation axis, w - scalar term (cos(ang/2))float64 xfloat64 yfloat64 zfloat64 w

L. Einig, D. Krupke, F. Wasserfall 11

Page 13: Introduction to ROS

University of Hamburg

MIN FacultyDepartment of Informatics

Communication - Topics ROS Introduction

Topics

I Published by nodesI Unique identifierI AnonymityI Open subscriptionI Sensor data

L. Einig, D. Krupke, F. Wasserfall 12

Page 14: Introduction to ROS

University of Hamburg

MIN FacultyDepartment of Informatics

Communication - Topics ROS Introduction

Communication - Example

ROS master

camera viewer

L. Einig, D. Krupke, F. Wasserfall 13

Page 15: Introduction to ROS

University of Hamburg

MIN FacultyDepartment of Informatics

Communication - Topics ROS Introduction

Communication - Example

ROS master

camera viewer

advertise(’images’)

L. Einig, D. Krupke, F. Wasserfall 13

Page 16: Introduction to ROS

University of Hamburg

MIN FacultyDepartment of Informatics

Communication - Topics ROS Introduction

Communication - Example

ROS mastertopic:images

camera viewer

L. Einig, D. Krupke, F. Wasserfall 13

Page 17: Introduction to ROS

University of Hamburg

MIN FacultyDepartment of Informatics

Communication - Topics ROS Introduction

Communication - Example

ROS mastertopic:images

camera viewer

subscribe(’images’)

L. Einig, D. Krupke, F. Wasserfall 13

Page 18: Introduction to ROS

University of Hamburg

MIN FacultyDepartment of Informatics

Communication - Topics ROS Introduction

Communication - Example

ROS mastertopic:images

camera viewer

subscribe(’images’)

L. Einig, D. Krupke, F. Wasserfall 13

Page 19: Introduction to ROS

University of Hamburg

MIN FacultyDepartment of Informatics

Communication - Topics ROS Introduction

Communication - Example

ROS mastertopic:images

camera viewerimages(tcp)

L. Einig, D. Krupke, F. Wasserfall 13

Page 20: Introduction to ROS

University of Hamburg

MIN FacultyDepartment of Informatics

Communication - Topics ROS Introduction

Communication - Example

ROS mastertopic:images

camera viewer

publish(img)

images(tcp)

L. Einig, D. Krupke, F. Wasserfall 13

Page 21: Introduction to ROS

University of Hamburg

MIN FacultyDepartment of Informatics

Communication - Topics ROS Introduction

Communication - Example

ROS mastertopic:images

camera viewer

publish(img)

images(tcp)

L. Einig, D. Krupke, F. Wasserfall 13

Page 22: Introduction to ROS

University of Hamburg

MIN FacultyDepartment of Informatics

Communication - Topics ROS Introduction

Communication - Example

ROS mastertopic:images

camera viewer

processorpublish(img)

images(tcp)

L. Einig, D. Krupke, F. Wasserfall 13

Page 23: Introduction to ROS

University of Hamburg

MIN FacultyDepartment of Informatics

Communication - Topics ROS Introduction

Communication - Example

ROS mastertopic:images

camera viewer

processorpublish(img)

subscribe(’images’)

images(tcp)

L. Einig, D. Krupke, F. Wasserfall 13

Page 24: Introduction to ROS

University of Hamburg

MIN FacultyDepartment of Informatics

Communication - Topics ROS Introduction

Communication - Example

ROS mastertopic:images

camera viewer

processorpublish(img)

images(tcp)

images(tcp)

L. Einig, D. Krupke, F. Wasserfall 13

Page 25: Introduction to ROS

University of Hamburg

MIN FacultyDepartment of Informatics

Communication - Services ROS Introduction

Services

I 2 message typesI request and response

I Synchronous protocolI client sends requestI client waits for serverI server replies

$ rosservice type add two ints | rossrv showint64 aint64 b- - -int64 sum

L. Einig, D. Krupke, F. Wasserfall 14

Page 26: Introduction to ROS

University of Hamburg

MIN FacultyDepartment of Informatics

Communication - Services ROS Introduction

Services

I 2 message typesI request and response

I Synchronous protocolI client sends requestI client waits for serverI server replies

$ rosservice type add two ints | rossrv showint64 aint64 b- - -int64 sum

L. Einig, D. Krupke, F. Wasserfall 14

Page 27: Introduction to ROS

University of Hamburg

MIN FacultyDepartment of Informatics

Communication - Services ROS Introduction

Communication - Example

ROS mastertopic:images

camera viewer

processor

client

publish(img)

images(tcp)

images(tcp)

L. Einig, D. Krupke, F. Wasserfall 15

Page 28: Introduction to ROS

University of Hamburg

MIN FacultyDepartment of Informatics

Communication - Services ROS Introduction

Communication - Example

ROS mastertopic:images

camera viewer

processor

client

publish(img)

wait for service(’process’)

images(tcp)

images(tcp)

L. Einig, D. Krupke, F. Wasserfall 15

Page 29: Introduction to ROS

University of Hamburg

MIN FacultyDepartment of Informatics

Communication - Services ROS Introduction

Communication - Example

ROS mastertopic:images

camera viewer

processor

client

publish(img)

wait for service(’process’)Service(’process’,srv.Proc)

images(tcp)

images(tcp)

L. Einig, D. Krupke, F. Wasserfall 15

Page 30: Introduction to ROS

University of Hamburg

MIN FacultyDepartment of Informatics

Communication - Services ROS Introduction

Communication - Example

ROS mastertopic:images

service:process

camera viewer

processor

client

publish(img)

images(tcp)

images(tcp)

L. Einig, D. Krupke, F. Wasserfall 15

Page 31: Introduction to ROS

University of Hamburg

MIN FacultyDepartment of Informatics

Communication - Services ROS Introduction

Communication - Example

ROS mastertopic:images

service:process

camera viewer

processor

client

publish(img)

ServiceProxy(’process’,srv.Proc)

images(tcp)

images(tcp)

L. Einig, D. Krupke, F. Wasserfall 15

Page 32: Introduction to ROS

University of Hamburg

MIN FacultyDepartment of Informatics

Communication - Services ROS Introduction

Communication - Example

ROS mastertopic:images

service:process

camera viewer

processor

client

publish(img)

request

images(tcp)

images(tcp)

L. Einig, D. Krupke, F. Wasserfall 15

Page 33: Introduction to ROS

University of Hamburg

MIN FacultyDepartment of Informatics

Communication - Services ROS Introduction

Communication - Example

ROS mastertopic:images

service:process

camera viewer

processor

client

publish(img)

images(tcp)

images(tcp)

L. Einig, D. Krupke, F. Wasserfall 15

Page 34: Introduction to ROS

University of Hamburg

MIN FacultyDepartment of Informatics

Communication - Services ROS Introduction

Communication - Example

ROS mastertopic:images

service:process

camera viewer

processor

client

publish(img)

response

images(tcp)

images(tcp)

L. Einig, D. Krupke, F. Wasserfall 15

Page 35: Introduction to ROS

University of Hamburg

MIN FacultyDepartment of Informatics

Communication - Actions ROS Introduction

ActionsI 3 message types

I goal and resultI optional feedback

I Asynchronous protocolI client sends goalI server may respond with feedbackI server delivers result

I Interruptible

# Define the goaluint32 dishwasher id # Specify which dishwasher we want to use- - -# Define the resultuint32 total dishes cleaned- - -# Define a feedback messagefloat32 percent complete

L. Einig, D. Krupke, F. Wasserfall 16

Page 36: Introduction to ROS

University of Hamburg

MIN FacultyDepartment of Informatics

Communication - Actions ROS Introduction

ActionsI 3 message types

I goal and resultI optional feedback

I Asynchronous protocolI client sends goalI server may respond with feedbackI server delivers result

I Interruptible

# Define the goaluint32 dishwasher id # Specify which dishwasher we want to use- - -# Define the resultuint32 total dishes cleaned- - -# Define a feedback messagefloat32 percent complete

L. Einig, D. Krupke, F. Wasserfall 16

Page 37: Introduction to ROS

University of Hamburg

MIN FacultyDepartment of Informatics

Communication - Actions ROS Introduction

Communication - Example

ROS mastertopic:images

service:process

camera viewer

processor

client

publish(img)

images(tcp)

images(tcp)

L. Einig, D. Krupke, F. Wasserfall 17

Page 38: Introduction to ROS

University of Hamburg

MIN FacultyDepartment of Informatics

Communication - Actions ROS Introduction

Communication - Example

ROS mastertopic:images

service:process

camera viewer

processor

client

publish(img)

ActionClient

(’process’,ProcAction)

images(tcp)

images(tcp)

L. Einig, D. Krupke, F. Wasserfall 17

Page 39: Introduction to ROS

University of Hamburg

MIN FacultyDepartment of Informatics

Communication - Actions ROS Introduction

Communication - Example

ROS mastertopic:images

service:process

camera viewer

processor

client

publish(img)

wait for server(’process’)

images(tcp)

images(tcp)

L. Einig, D. Krupke, F. Wasserfall 17

Page 40: Introduction to ROS

University of Hamburg

MIN FacultyDepartment of Informatics

Communication - Actions ROS Introduction

Communication - Example

ROS mastertopic:images

service:process

camera viewer

processor

client

publish(img)

wait for server(’process’) ActionServer(’process’,ProcAction)

images(tcp)

images(tcp)

L. Einig, D. Krupke, F. Wasserfall 17

Page 41: Introduction to ROS

University of Hamburg

MIN FacultyDepartment of Informatics

Communication - Actions ROS Introduction

Communication - Example

ROS mastertopic:images

service:processaction:process

camera viewer

processor

client

publish(img)

images(tcp)

images(tcp)

L. Einig, D. Krupke, F. Wasserfall 17

Page 42: Introduction to ROS

University of Hamburg

MIN FacultyDepartment of Informatics

Communication - Actions ROS Introduction

Communication - Example

ROS mastertopic:images

service:processaction:process

camera viewer

processor

client

publish(img)

goal

images(tcp)

images(tcp)

L. Einig, D. Krupke, F. Wasserfall 17

Page 43: Introduction to ROS

University of Hamburg

MIN FacultyDepartment of Informatics

Communication - Actions ROS Introduction

Communication - Example

ROS mastertopic:images

service:processaction:process

camera viewer

processor

client

publish(img)

feedback(20%)

images(tcp)

images(tcp)

L. Einig, D. Krupke, F. Wasserfall 17

Page 44: Introduction to ROS

University of Hamburg

MIN FacultyDepartment of Informatics

Communication - Actions ROS Introduction

Communication - Example

ROS mastertopic:images

service:processaction:process

camera viewer

processor

client

publish(img)

feedback(40%)

abort

images(tcp)

images(tcp)

L. Einig, D. Krupke, F. Wasserfall 17

Page 45: Introduction to ROS

University of Hamburg

MIN FacultyDepartment of Informatics

Communication - Actions ROS Introduction

Communication - Example

ROS mastertopic:images

service:processaction:process

camera viewer

processor

client

publish(img)

feedback(60%)

images(tcp)

images(tcp)

L. Einig, D. Krupke, F. Wasserfall 17

Page 46: Introduction to ROS

University of Hamburg

MIN FacultyDepartment of Informatics

Communication - Actions ROS Introduction

Communication - Example

ROS mastertopic:images

service:processaction:process

camera viewer

processor

client

publish(img)

feedback(80%)

wait for result

images(tcp)

images(tcp)

L. Einig, D. Krupke, F. Wasserfall 17

Page 47: Introduction to ROS

University of Hamburg

MIN FacultyDepartment of Informatics

Communication - Actions ROS Introduction

Communication - Example

ROS mastertopic:images

service:processaction:process

camera viewer

processor

client

publish(img)

result

images(tcp)

images(tcp)

L. Einig, D. Krupke, F. Wasserfall 17

Page 48: Introduction to ROS

University of Hamburg

MIN FacultyDepartment of Informatics

Simulations ROS Introduction

Simulations

I Important development toolI protects expensive hardwareI develop and test without robotI high-level test

I Simulates sensor dataI clean data

I TurtlesimI ROS learning tool

I GazeboI ROS simulator

I RVizI ROS data visualization

L. Einig, D. Krupke, F. Wasserfall 18

Page 49: Introduction to ROS

University of Hamburg

MIN FacultyDepartment of Informatics

Simulations ROS Introduction

Simulations

I Important development toolI protects expensive hardwareI develop and test without robotI high-level test

I Simulates sensor dataI clean data

I TurtlesimI ROS learning tool

I GazeboI ROS simulator

I RVizI ROS data visualization

L. Einig, D. Krupke, F. Wasserfall 18

Page 50: Introduction to ROS

University of Hamburg

MIN FacultyDepartment of Informatics

Simulations ROS Introduction

Turtle Sim

I Learning platformI 2D turtle

I moveI turnI draw

I CommunicationI ROS structure

Source: http://wiki.ros.org/turtlesim

L. Einig, D. Krupke, F. Wasserfall 19

Page 51: Introduction to ROS

University of Hamburg

MIN FacultyDepartment of Informatics

Simulations ROS Introduction

Gazebo

I 3D rigid body simulatorI Simulates robots, environment and sensor data

Source: Lasse EinigL. Einig, D. Krupke, F. Wasserfall 20

Page 52: Introduction to ROS

University of Hamburg

MIN FacultyDepartment of Informatics

Simulations ROS Introduction

RViz

I 3D visualization environmentI Different data can be shown

I Laser scan data, map, ...

Source: http://wiki.ros.org/turtlebot gazebo

L. Einig, D. Krupke, F. Wasserfall 21

Page 53: Introduction to ROS

University of Hamburg

MIN FacultyDepartment of Informatics

Kinect ROS Introduction

Microsoft Kinect

I Motion sensing device for the XBox 360 by MicrosoftI Range camera technology by PrimeSenseI 3D depth information from infrared structured light

Source: https://msdn.microsoft.com

L. Einig, D. Krupke, F. Wasserfall 22

Page 54: Introduction to ROS

University of Hamburg

MIN FacultyDepartment of Informatics

Kinect ROS Introduction

Kinect - technical details

I ResolutionI 640 x 480 @ 30 Hz colorI 320 x 240 @ 30 Hz depth

I FOV of 57° horizontally and 43° verticallyI Range ∼0.7 - 6 m

I up to 3.5 m realisticI Physical tilt range ±31°I Microphone array with 16 bit @ 16 kHz

I supports single speaker voice recognitionI OpenNI and Freenect drivers

L. Einig, D. Krupke, F. Wasserfall 23

Page 55: Introduction to ROS

University of Hamburg

MIN FacultyDepartment of Informatics

Kinect ROS Introduction

Kinect - example

Source: TAMS, Uni Hamburg

L. Einig, D. Krupke, F. Wasserfall 24

Page 56: Introduction to ROS

University of Hamburg

MIN FacultyDepartment of Informatics

Kinect ROS Introduction

Kinect - example

Source: TAMS, Uni Hamburg

L. Einig, D. Krupke, F. Wasserfall 25