introduction to ros - tams.informatik.uni-hamburg.de€¦ · ros introduction introduction to ros...
TRANSCRIPT
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 6, 2015
L. Einig, D. Krupke, F. Wasserfall 1
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
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
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
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
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
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
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
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
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
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
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
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
University of Hamburg
MIN FacultyDepartment of Informatics
Communication - Topics ROS Introduction
Communication - Example
ROS master
camera viewer
L. Einig, D. Krupke, F. Wasserfall 13
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
University of Hamburg
MIN FacultyDepartment of Informatics
Robots ROS Introduction
Turtle-Bot
I Basic robot platformI Capabilities
I KinectI navigationI transportI mappingI swarm tasks
Source: http://wiki.ros.org/Robots/TurtleBot
L. Einig, D. Krupke, F. Wasserfall 18
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 19
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 20
University of Hamburg
MIN FacultyDepartment of Informatics
Kinect ROS Introduction
Kinect - example
Source: TAMS, Uni Hamburg
L. Einig, D. Krupke, F. Wasserfall 21
University of Hamburg
MIN FacultyDepartment of Informatics
Kinect ROS Introduction
Kinect - example
Source: TAMS, Uni Hamburg
L. Einig, D. Krupke, F. Wasserfall 22
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 23
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 23
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 24
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 25
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 26
University of Hamburg
MIN FacultyDepartment of Informatics
Mapping, Localization and Navigation ROS Introduction
Key questions
I MappingI How to build a map?
I (Self-)LocalizationI How to find own position?
I NavigationI How to move from one
position on the map toanother? Source: Wikipedia
L. Einig, D. Krupke, F. Wasserfall 27
University of Hamburg
MIN FacultyDepartment of Informatics
Mapping, Localization and Navigation ROS Introduction
Mapping
How to solve theproblem with the map
L. Einig, D. Krupke, F. Wasserfall 28
University of Hamburg
MIN FacultyDepartment of Informatics
Mapping, Localization and Navigation ROS Introduction
MappingSolution
I Gather 3D informationI using available sensorsI kinect, laser scanner
I Create a part of mapI from observable area
I Fuse map partsI using additional informationI e.g. odometry
L. Einig, D. Krupke, F. Wasserfall 29
University of Hamburg
MIN FacultyDepartment of Informatics
Mapping, Localization and Navigation ROS Introduction
Self-Localization
We already have a map
L. Einig, D. Krupke, F. Wasserfall 30
University of Hamburg
MIN FacultyDepartment of Informatics
Mapping, Localization and Navigation ROS Introduction
Self-LocalizationSolution
Estimate robot position from 3D information and odometry
Problems:I odometry errorI occlusionI sensor noise
Solutions:I modeling the odometry errorI probabilistic algorithmsI preprocessing (e.g. smoothing)
Source: http://thecorpora.com/blog/wp-content/uploads/2012/03/Qbo-robot-Xtion-3D-sensor.jpg
L. Einig, D. Krupke, F. Wasserfall 31
University of Hamburg
MIN FacultyDepartment of Informatics
Mapping, Localization and Navigation ROS Introduction
Navigation
We know where we are
L. Einig, D. Krupke, F. Wasserfall 32
University of Hamburg
MIN FacultyDepartment of Informatics
Mapping, Localization and Navigation ROS Introduction
NavigationSolution
Find path from current position to goal position
Prerequisites:I precise mapI precise current position on the mapI appropriate way-points
L. Einig, D. Krupke, F. Wasserfall 33