introduction to ros · 2018-04-12 · introduction to ros lasse einig, dennis krupke, florens...

53
MIN Faculty Department of Informatics 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 10, 2018 L. Einig, D. Krupke, F. Wasserfall – ROS Introduction 1 / 23

Upload: others

Post on 10-Mar-2020

19 views

Category:

Documents


1 download

TRANSCRIPT

MIN FacultyDepartment of Informatics

Introduction to ROS

Lasse Einig, Dennis Krupke, Florens Wasserfall

University of HamburgFaculty of Mathematics, Informatics and Natural SciencesDepartment of Informatics

Technical Aspects of Multimodal Systems

April 10, 2018

L. Einig, D. Krupke, F. Wasserfall – ROS Introduction 1 / 23

OutlineFoundation Structure Communication Kinematics Tool

FoundationStructureCommunicationKinematics Tool

L. Einig, D. Krupke, F. Wasserfall – ROS Introduction 2 / 23

MotivationFoundation Structure Communication Kinematics Tool

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 – ROS Introduction 3 / 23

IdeaFoundation Structure Communication Kinematics Tool

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 – ROS Introduction 4 / 23

Current StateFoundation Structure Communication Kinematics Tool

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 – ROS Introduction 5 / 23

OutlineFoundation Structure Communication Kinematics Tool

FoundationStructureCommunicationKinematics Tool

L. Einig, D. Krupke, F. Wasserfall – ROS Introduction 6 / 23

ROS SystemFoundation Structure Communication Kinematics Tool

I ROS nodesI sensorsI actuatorsI logic

I ROS coreI Communication

L. Einig, D. Krupke, F. Wasserfall – ROS Introduction 7 / 23

ROS NodeFoundation Structure Communication Kinematics Tool

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 – ROS Introduction 8 / 23

ROS CoreFoundation Structure Communication Kinematics Tool

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 – ROS Introduction 9 / 23

CommunicationFoundation Structure Communication Kinematics Tool

I MessagesI standardized data types

I TopicsI n:n communication

I Services and ActionsI 1:1 communication

L. Einig, D. Krupke, F. Wasserfall – ROS Introduction 10 / 23

SensorsFoundation Structure Communication Kinematics Tool

I ExplorationI LocalizationI DetectionI One node per sensor

I provide data as topicI abstract from hardware

L. Einig, D. Krupke, F. Wasserfall – ROS Introduction 11 / 23

System structureFoundation Structure Communication Kinematics Tool

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 OSRF

L. Einig, D. Krupke, F. Wasserfall – ROS Introduction 12 / 23

OutlineFoundation Structure Communication Kinematics Tool

FoundationStructureCommunication

MessagesTopicsServicesActions

Kinematics Tool

L. Einig, D. Krupke, F. Wasserfall – ROS Introduction 13 / 23

MessagesFoundation Structure Communication Kinematics Tool

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 – ROS Introduction 14 / 23

MessagesFoundation Structure Communication Kinematics Tool

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 – ROS Introduction 14 / 23

TopicsFoundation Structure Communication Kinematics Tool

I Published by nodesI Unique identifierI AnonymityI Open subscriptionI Sensor data

L. Einig, D. Krupke, F. Wasserfall – ROS Introduction 15 / 23

Communication – ExampleFoundation Structure Communication Kinematics Tool

ROS master

camera viewer

L. Einig, D. Krupke, F. Wasserfall – ROS Introduction 16 / 23

Communication – ExampleFoundation Structure Communication Kinematics Tool

ROS master

camera viewer

advertise(’images’)

L. Einig, D. Krupke, F. Wasserfall – ROS Introduction 16 / 23

Communication – ExampleFoundation Structure Communication Kinematics Tool

ROS mastertopic:images

camera viewer

L. Einig, D. Krupke, F. Wasserfall – ROS Introduction 16 / 23

Communication – ExampleFoundation Structure Communication Kinematics Tool

ROS mastertopic:images

camera viewer

subscribe(’images’)

L. Einig, D. Krupke, F. Wasserfall – ROS Introduction 16 / 23

Communication – ExampleFoundation Structure Communication Kinematics Tool

ROS mastertopic:images

camera viewer

subscribe(’images’)

L. Einig, D. Krupke, F. Wasserfall – ROS Introduction 16 / 23

Communication – ExampleFoundation Structure Communication Kinematics Tool

ROS mastertopic:images

camera viewerimages(tcp)

L. Einig, D. Krupke, F. Wasserfall – ROS Introduction 16 / 23

Communication – ExampleFoundation Structure Communication Kinematics Tool

ROS mastertopic:images

camera viewer

publish(img)

images(tcp)

L. Einig, D. Krupke, F. Wasserfall – ROS Introduction 16 / 23

Communication – ExampleFoundation Structure Communication Kinematics Tool

ROS mastertopic:images

camera viewer

publish(img)

images(tcp)

L. Einig, D. Krupke, F. Wasserfall – ROS Introduction 16 / 23

Communication – ExampleFoundation Structure Communication Kinematics Tool

ROS mastertopic:images

camera viewer

processorpublish(img)

images(tcp)

L. Einig, D. Krupke, F. Wasserfall – ROS Introduction 16 / 23

Communication – ExampleFoundation Structure Communication Kinematics Tool

ROS mastertopic:images

camera viewer

processorpublish(img)

subscribe(’images’)

images(tcp)

L. Einig, D. Krupke, F. Wasserfall – ROS Introduction 16 / 23

Communication – ExampleFoundation Structure Communication Kinematics Tool

ROS mastertopic:images

camera viewer

processorpublish(img)

images(tcp)

images(tcp)

L. Einig, D. Krupke, F. Wasserfall – ROS Introduction 16 / 23

ServicesFoundation Structure Communication Kinematics Tool

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 – ROS Introduction 17 / 23

ServicesFoundation Structure Communication Kinematics Tool

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 – ROS Introduction 17 / 23

Communication – ExampleFoundation Structure Communication Kinematics Tool

ROS mastertopic:images

camera viewer

processor

client

publish(img)

images(tcp)

images(tcp)

L. Einig, D. Krupke, F. Wasserfall – ROS Introduction 18 / 23

Communication – ExampleFoundation Structure Communication Kinematics Tool

ROS mastertopic:images

camera viewer

processor

client

publish(img)

wait_for_service(’process’)

images(tcp)

images(tcp)

L. Einig, D. Krupke, F. Wasserfall – ROS Introduction 18 / 23

Communication – ExampleFoundation Structure Communication Kinematics Tool

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 – ROS Introduction 18 / 23

Communication – ExampleFoundation Structure Communication Kinematics Tool

ROS mastertopic:images

service:process

camera viewer

processor

client

publish(img)

images(tcp)

images(tcp)

L. Einig, D. Krupke, F. Wasserfall – ROS Introduction 18 / 23

Communication – ExampleFoundation Structure Communication Kinematics Tool

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 – ROS Introduction 18 / 23

Communication – ExampleFoundation Structure Communication Kinematics Tool

ROS mastertopic:images

service:process

camera viewer

processor

client

publish(img)

request

images(tcp)

images(tcp)

L. Einig, D. Krupke, F. Wasserfall – ROS Introduction 18 / 23

Communication – ExampleFoundation Structure Communication Kinematics Tool

ROS mastertopic:images

service:process

camera viewer

processor

client

publish(img)

images(tcp)

images(tcp)

L. Einig, D. Krupke, F. Wasserfall – ROS Introduction 18 / 23

Communication – ExampleFoundation Structure Communication Kinematics Tool

ROS mastertopic:images

service:process

camera viewer

processor

client

publish(img)

response

images(tcp)

images(tcp)

L. Einig, D. Krupke, F. Wasserfall – ROS Introduction 18 / 23

ActionsFoundation Structure Communication Kinematics Tool

I 3 message typesI 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 – ROS Introduction 19 / 23

ActionsFoundation Structure Communication Kinematics Tool

I 3 message typesI 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 – ROS Introduction 19 / 23

Communication – ExampleFoundation Structure Communication Kinematics Tool

ROS mastertopic:images

service:process

camera viewer

processor

client

publish(img)

images(tcp)

images(tcp)

L. Einig, D. Krupke, F. Wasserfall – ROS Introduction 20 / 23

Communication – ExampleFoundation Structure Communication Kinematics Tool

ROS mastertopic:images

service:process

camera viewer

processor

client

publish(img)

ActionClient

(’process’,ProcAction)

images(tcp)

images(tcp)

L. Einig, D. Krupke, F. Wasserfall – ROS Introduction 20 / 23

Communication – ExampleFoundation Structure Communication Kinematics Tool

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 – ROS Introduction 20 / 23

Communication – ExampleFoundation Structure Communication Kinematics Tool

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 – ROS Introduction 20 / 23

Communication – ExampleFoundation Structure Communication Kinematics Tool

ROS mastertopic:images

service:processaction:process

camera viewer

processor

client

publish(img)

images(tcp)

images(tcp)

L. Einig, D. Krupke, F. Wasserfall – ROS Introduction 20 / 23

Communication – ExampleFoundation Structure Communication Kinematics Tool

ROS mastertopic:images

service:processaction:process

camera viewer

processor

client

publish(img)

goal

images(tcp)

images(tcp)

L. Einig, D. Krupke, F. Wasserfall – ROS Introduction 20 / 23

Communication – ExampleFoundation Structure Communication Kinematics Tool

ROS mastertopic:images

service:processaction:process

camera viewer

processor

client

publish(img)

feedback(20%)

images(tcp)

images(tcp)

L. Einig, D. Krupke, F. Wasserfall – ROS Introduction 20 / 23

Communication – ExampleFoundation Structure Communication Kinematics Tool

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 – ROS Introduction 20 / 23

Communication – ExampleFoundation Structure Communication Kinematics Tool

ROS mastertopic:images

service:processaction:process

camera viewer

processor

client

publish(img)

feedback(60%)

images(tcp)

images(tcp)

L. Einig, D. Krupke, F. Wasserfall – ROS Introduction 20 / 23

Communication – ExampleFoundation Structure Communication Kinematics Tool

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 – ROS Introduction 20 / 23

Communication – ExampleFoundation Structure Communication Kinematics Tool

ROS mastertopic:images

service:processaction:process

camera viewer

processor

client

publish(img)

result

images(tcp)

images(tcp)

L. Einig, D. Krupke, F. Wasserfall – ROS Introduction 20 / 23

OutlineFoundation Structure Communication Kinematics Tool

FoundationStructureCommunicationKinematics Tool

L. Einig, D. Krupke, F. Wasserfall – ROS Introduction 21 / 23

Kinematics ToolFoundation Structure Communication Kinematics Tool

I Visualization for kinematics of robot models

L. Einig, D. Krupke, F. Wasserfall – ROS Introduction 22 / 23

PropertiesFoundation Structure Communication Kinematics Tool

I Obeys physical constraints of the robot modelI Based on 100 Hz control loopI Forward control by sending joint target messagesI Offers IK solving serviceI Simple setupI Programmable in Python and C++

I Samples only in Python

L. Einig, D. Krupke, F. Wasserfall – ROS Introduction 23 / 23