Gerald Steinbauer
Institute for Software Technology
1
Mobile Robots - ROS
Mobile Robots Robot Operating System (ROS)
Gerald Steinbauer
Institute for Software Technology
Gerald Steinbauer
Institute for Software Technology
2
Mobile Robots - ROS
Motivation
Beer me
https://www.youtube.com/watch?v=c3Cq0sy4TBs
Gerald Steinbauer
Institute for Software Technology
3
Mobile Robots - ROS
Robotics is Easy …
environment/world
sensing
information
extraction
raw data
acting
path
execution
actuator
commands
domain
model
environment
model
path
planning
navigation
perc
eption
modelli
ng
behavio
r contr
ol
planning reasoning
cognition
task
Gerald Steinbauer
Institute for Software Technology
4
Mobile Robots - ROS
Course Outline
1. Robot Operating System
2. Locomotion
3. Sensors
4. Localization
5. Environment Modelling - Mapping
6. Reactive Navigation
Gerald Steinbauer
Institute for Software Technology
5
Mobile Robots - ROS
Literature
Introduction to Autonomous
Mobile Robots. 2nd Edition.
Roland Siegwart, Illah Reza
Nourbakhsh, Davide
Scaramuzza. MIT Press.
2011.
Gerald Steinbauer
Institute for Software Technology
6
Mobile Robots - ROS
Function versus Operation
Function
Artificial Intelligence View
How to organize:
• Knowledge Representation
• Decision Making
• Problem Abstraction
• Behavior Execution
• Control
• Temporal Issues
Operation
Software Engineering View
How to organize:
• Data Transport
• Interfaces and Objects
• Program Execution
• Configuration
• Programming
• Development
two sides of the same medal Today
Gerald Steinbauer
Institute for Software Technology
7
Mobile Robots - ROS
Operation Architectures
Structure and Support
of Software Operation and
Data/Command Exchange
Support Operation and
Experiments
Support Development
Support for Functional
Architectures
Gerald Steinbauer
Institute for Software Technology
8
Mobile Robots - ROS
Robot Operating System (ROS)
• framework for the development of robot
software
• provides OS-like functionality
• originally developed by Stanford AI Lab
(SAIL) and Willow Garage
• meanwhile maintained by the Open
Source Robotics Foundation
• open source robotics framework
• used by several leading robotics labs
• provides a lot of functionality on various
levels
Gerald Steinbauer
Institute for Software Technology
9
Mobile Robots - ROS
runs on several robot platforms
Gerald Steinbauer
Institute for Software Technology
10
Mobile Robots - ROS
provides a lot of functionality
• many research groups provide their results as open
source ROS packages: • motion planning and navigation
• localization
• exploration and mapping
• arm navigation and object manipulation
• 3D perception and object manipulation
• high-level control and knowledge representation
• …
Gerald Steinbauer
Institute for Software Technology
11
Mobile Robots - ROS
Design Principles of ROS
• peer-to-peer – several independent processes and hosts
• multi-lingual – communication is based on XML-RPC
– supports C++, Phyton, Octave, LISP
– defined data types, proprietary message definition files (IDL)
• tool-based – Linux philosophy with small building blocks
• thin – functionality is packed in stand-alone libraries, also 3rd party
– uses its own build system
• open-source
Gerald Steinbauer
Institute for Software Technology
12
Mobile Robots - ROS
OS
ROS
Message
Passing
Word
Processing
Web Browser
GUI Memory
Management
File System Scheduler Drivers
Visualization
Navigation Task Executive
Simulation Manipulation
Client
Libratries
Gerald Steinbauer
Institute for Software Technology
13
Mobile Robots - ROS
ROS - Operation
• ROS is definitely on the operational side
• supports message transport • publisher/subscriber (nodes, messages, topics)
• client/server (services, action-server)
• runtime execution • threads and related techniques
• (re-)configuration
• supports development • reusable classes and libraries
• definition of interfaces
• debugging, logging and visualization tools
• build system
• …
Gerald Steinbauer
Institute for Software Technology
14
Mobile Robots - ROS
ROS Eco-System I
universe
main
robot centric
general
Gerald Steinbauer
Institute for Software Technology
15
Mobile Robots - ROS
ROS Eco-System II
capabilities
middleware
navigation, arm, grasping
tools universe
main
libs
apps fetch beer
tf, pcl, opencv, bullet, eigen
rqt_graph, rostopic, roslaunch
rosmaster, roscpp, rosbuild
Gerald Steinbauer
Institute for Software Technology
16
Mobile Robots - ROS
Beer Me (Bottom Up)
middleware
capabilities
tools
libs
apps Beer
Me
Gerald Steinbauer
Institute for Software Technology
17
Mobile Robots - ROS
Beer Me (Top Down)
Beer
Me
Open Fridge Delivery
Face
Recognition Beer
Identification
PCL
TF
navigation OpenCV SMACH
arm navigation web interface collision space
roscpp common_msg rospy rosmaster actionlib
Gerald Steinbauer
Institute for Software Technology
18
Mobile Robots - ROS
ROS Versions • ROS Box Turtle (March 2010)
• ROS C Turtle (August 2010)
• ROS Diamondback (March 2011)
• ROS Electric Emys (August 2011)
• ROS Fuerte Turtle (April 2012)
• ROS Groovy Galapagos (December 2012)
• ROS Hydro Medusa (April 2013)
• ROS Indigo Igloo (July 2014)
• ROS Jade Turtle (May 2015)
• ROS Kinetic Kame (May 2016)
Gerald Steinbauer
Institute for Software Technology
19
Mobile Robots - ROS
Building Blocks of ROS
a node is an executable that uses ROS to
communicate with other nodes and does
computation
nodes can publish messages to a topic as
well subscribe to a topic to receive
messages (one-to-many communication)
messages are ROS data type used when
subscribing or publishing to a topic
a service is a node with one defined input
and one defined output message type
the master is a node that is the name
service for ROS
it helps nodes find other nodes
rosout is the decentralized ROS
equivalent of stdout/stderr
the parameter server provides and
manages parameter across the network
roscore is master + rosout + parameter
server
concept:
com
puta
tion g
raph
basic
infr
astr
uctu
re
Gerald Steinbauer
Institute for Software Technology
20
Mobile Robots - ROS
File Organization in ROS
a bag is a file format in ROS for recording
and replaying ROS message data
a package is an organization unit in ROS
the goal is to provide functionality
it can contain nodes, libraries, data,
messages, configurations …
Gerald Steinbauer
Institute for Software Technology
21
Mobile Robots - ROS
Naming in ROS
• hierarchical naming structure
• used for all resources • nodes
• parameter
• topics
• services
• nodes may have a name space /node_name/topic_name
• parameter are hierarchically organized as well /p3at/odometry/frequency
• can be used like a Linux file system (relative, global)
Gerald Steinbauer
Institute for Software Technology
22
Mobile Robots - ROS
Navigation the ROS File System
• a number of command-line tools makes live easier
• changing into a package directory • roscd package_name
• building packages (own build system) • catkin_make
• Running a node • rosrun package_name node_name
• running a larger project • roslaunch package_name launch_file
Gerald Steinbauer
Institute for Software Technology
23
Mobile Robots - ROS
Transport Mechanisms
• all architectures comprise different modules
• they need to exchange commands and data
• Client-Server • components directly talk to each other
• components are aware of each other
• remote method invocation (RPC, CORBA, ROS services)
+ explicit return value
• Publisher-Subscriber • messages are broadcasted – multiple recipients
• components are usually not aware of each other
• central message routing (IPC, ROS topics)
single point of failure
Gerald Steinbauer
Institute for Software Technology
24
Mobile Robots - ROS
Publisher – Subscriber Communication
Gerald Steinbauer
Institute for Software Technology
25
Mobile Robots - ROS
Synchronous Service (Blocking)
Gerald Steinbauer
Institute for Software Technology
26
Mobile Robots - ROS
Actions (Non-Blocking)
Gerald Steinbauer
Institute for Software Technology
27
Mobile Robots - ROS
Action Interface
Action
Client
Action
Server
goal
cancel
status
status
feedback
from client
from server
action protocol relies on ROS topics to transport messages (publisher/subscriber)
Gerald Steinbauer
Institute for Software Technology
28
Mobile Robots - ROS
Simple Messages
• simple data structures that are passed between nodes
• defined in package-name/msg/*.msg files, sent over topics
• basic data types: • int{8,16,32,64}
• float{32,64}
• string
• time
• Duration
• array[]
• Example: Point:msg • float64 x
• float64 y
• float64 z
• messages can be nested • Point p
Gerald Steinbauer
Institute for Software Technology
29
Mobile Robots - ROS
ROS Service Definitions
• used for ROS Services
• defined in package-name/srv/*.srv
• Service = Request msg + Response msg
• messages are auto-generated from the definition
int64 A
int64 B
---
int64 Sum
Gerald Steinbauer
Institute for Software Technology
30
Mobile Robots - ROS
ROS Action Definitions
• used for ROS Actions
• defined in package-name/action/*.action
• Action = Goal msg + Result msg + Status msg +
Chancel msg
• messages are auto-generated from the definition # Define the goal
uint32 dishwasher_id
# Specify which dishwasher we want to use
---
# Define the result
uint32 total_dishes_cleaned
---
# Define a feedback message
float32 percent_complete
Gerald Steinbauer
Institute for Software Technology
31
Mobile Robots - ROS
Parameters
• have unique names
• can represent primitive data types: • integers
• floats
• boolean
• dictionaries
• maps, etc
• can be set and remapped at runtime
• stored on the parameter server
• dynamic re-configuration – notify nodes about
parameter changes
Gerald Steinbauer
Institute for Software Technology
32
Mobile Robots - ROS
Parameter Setting
• nodes can set parameters on the server
• any other nodes can read them
• also command-line tool
Talker Listener
ROS
Master
Gerald Steinbauer
Institute for Software Technology
33
Mobile Robots - ROS
Working with Topics
• the command-line tools rostopic makes live easier
• list all available topics • rostopic list
• showing messages on a topic • rostopic echo topic_name
• showing message type of a topic • rostopic type topic_name
• …
Gerald Steinbauer
Institute for Software Technology
34
Mobile Robots - ROS
Computation Graph – Localization Example
robot laser imu map
localization
path
planner
Gerald Steinbauer
Institute for Software Technology
35
Mobile Robots - ROS
Tools in ROS
rqt_graph display a visualization of a ROS
computation graph
client library supports the development of
nodes
allows easy access to topics, paramter, …
C++ & Phyton
rviz is a 3d visualization tool
it is online configurable and is able to
display sensor data, point clouds, paths,
coordinate systems
ROS is able to record and playback all
topics in an transparent way and in the
proper timing
Gerald Steinbauer
Institute for Software Technology
36
Mobile Robots - ROS
ROS - Function
• ROS supports the functional view to some extent
• behavioral control • local path planner
• obstacle avoidance
• trajectory generation
• executive • global path planner
• SMACH – state machine for task-level control
• planning • Cognitive Robot Abstract Machine (CARM) by TUM
• Knowledge Processing for Autonomous Personal Robots
(KnowRob) by TUM
Gerald Steinbauer
Institute for Software Technology
37
Mobile Robots - ROS
Launch Files
• it’s a pain to start up larger project form scratch at the
command-line
• the tool roslaunch allows to script start up procedures
• allows to specify nodes, configurations, renaming …
• follows a XML-syntax <launch>
<param name="foo" value="$(optenv NUM_CPUS 1)" />
<param name=“foofile" value="$(find foo_pkg)/foo.xml" />
<node name=“foo" pkg=“foo_pkg" type=“foo.py" />
<node name=“bar" pkg=“bar_pkg" type=“bar" />
</launch>
Gerald Steinbauer
Institute for Software Technology
38
Mobile Robots - ROS
tf
• robots usually have a number of
data (2D and 3D senor data, poses,
…) in various static and variable
coordinate systems
• data in ROS are relative to a
coordinate system called “frame”
• data stay in their producing frame
• data are transformed in a target
frame on purpose only
• the tf library and a set of tools take
care about transformations
Gerald Steinbauer
Institute for Software Technology
39
Mobile Robots - ROS
Transformation Basics
+X
+Y
+Z
roll
pitch
yaw
right hand rule
roll, pitch, yaw
Euler angles
[x,y,z,w]
ROS uses Quarterions
Gerald Steinbauer
Institute for Software Technology
40
Mobile Robots - ROS
Transform Chains
• frames can build transformation chains
• tree-like structure
• transformation between any frames automatically
calculated by tf – if connected by a tree (a forest is
possible too)
[Andreasson et al. 2008]
map kinect
frame
laser
frame
plate
frame
base
frame odometry
frame
Gerald Steinbauer
Institute for Software Technology
41
Mobile Robots - ROS
Transformation Tree
odom base_link
laser_base_link
kinect_base_link
map
plate_link
odom
kinect:_base_link laser_base_link
base_link
map plate_link
Gerald Steinbauer
Institute for Software Technology
42
Mobile Robots - ROS
Transformation Transport
Gerald Steinbauer
Institute for Software Technology
43
Mobile Robots - ROS
tf tools • in program code
• instantiate a transform listener
• retrieve transformation for particular frames and time stamps
• transform data
• you may also provide transformations using a transform broadcaster
• numerous helper functions to deal with transformations
• tf_echo • command-line tool to display transformation messages for particular frames
• tf_monitor • command-line tool to display all transformation messages
• view_frames • listens to tf topic for some time and
generates a transformation tree with
some statisitcs
• rviz • graphical tool to visualize all kind of data and
robots
Gerald Steinbauer
Institute for Software Technology
44
Mobile Robots - ROS
Useful Features in ROS
• coordination transformation with tf
– manage several reference frames
– automated conversion
• unified data types for similar
sensors and actuators
– e.g. point clouds for laser scanner
– e.g. velocity_command for robot
platforms
• remote access from other hosts
– transparent network
Gerald Steinbauer
Institute for Software Technology
45
Mobile Robots - ROS
Supported Hardware
• ROS provides a huge and continuously growing set
of standard nodes for robots und sensors – Willow Garage PR2
– Pioneer Robot Family
– Aldebaran Nao
– Lego NXT
– Festo Robotino
– Sick Laser Scanner Family
– Hokuyo Laser Scanner
– GPS (NMEA)
– Katana Arm
– Cameras with various interface
– Microsoft Kinect
– ….
Gerald Steinbauer
Institute for Software Technology
46
Mobile Robots - ROS
Functionality in ROS
• mapping (gmapping) – based on the free gmapping
– simple generation of 2d maps
• navigation – complete navigation stack
– allows autonomous navigation
• arm navigation (MoveIt!) based on OMPL
• organization of behaviors – standard templates for behaviors
(actionlib)
• decision making – finite state machine (SMACH)
Gerald Steinbauer
Institute for Software Technology
47
Mobile Robots - ROS
ROS Build System - catkin
catkin
– official build system of ROS
– Cmake with some custom Cmake macros and Python scripts
– supports for automatic 'find package' infrastructure and
building multiple, dependent projects at the same time
– simplifies the build process of ROS’s large, complex, and
highly heterogeneous code ecosystem
advantages of using catkin
– enables to use packages after building (without installation)
– generates find_package() code for your package
– generates pkg-config files for your package
– handles build order of multiple packages
– handles transitive dependencies
Gerald Steinbauer
Institute for Software Technology
48
Mobile Robots - ROS
catkin workspace
• one central folder for your packages
• holds your packages as sources • in the standard subfolder src
• one subfolder per package
• packages can be grouped together under a common subfolder
• creates a temporary build and install folder
• central point for building your packages
• tool support to initialize your workspace
• multiple workspaces are possible
Gerald Steinbauer
Institute for Software Technology
49
Mobile Robots - ROS
Overview of a catkin package
package.xml
– contains the meta information of a package
• name, description, version, maintainer(s), license
• opt. authors, url's, dependencies, plugins, etc...
CMakeLists.txt
– the main CMake file to build the package
– calls catkin-specific functions/macros
• “read" the package.xml
• find other catkin packages to access libraries / include directories
• export items for other packages depending on you
Gerald Steinbauer
Institute for Software Technology
50
Mobile Robots - ROS
Dependency Management: package.xml
(c) ETH Zürich http://wiki.ros.org/catkin/package.xml
Gerald Steinbauer
Institute for Software Technology
51
Mobile Robots - ROS
Dependency Management: CMakeLists.txt
(c) ETH Zürich http://wiki.ros.org/catkin/CMakeLists.txt
Gerald Steinbauer
Institute for Software Technology
52
Mobile Robots - ROS
Other common files in a package
Common source layout – include/PkgNamespace/
– src/
– setup.py
ROS specific subfolders – msg/
– srv/
– launch/
– scripts/
the recommended folder name equals the package
name
Gerald Steinbauer
Institute for Software Technology
53
Mobile Robots - ROS
Additional Information
• ROS wiki (http://www.ros.org/wiki/)
• ROS answers (http://answers.ros.org)
• ROS tutorials (http://www.ros.org/wiki/ROS/Tutorials)
Gerald Steinbauer
Institute for Software Technology
54
Mobile Robots - ROS
Other Robotic Software Frameworks
• represent the other operation architecture
• some also implement some parts of the function
architecture
• hot topic since decades
• the holy grail not yet found
• examples • Player
• ORCA
• Miro
• Fawkes
• IDEA
• ROS
Gerald Steinbauer
Institute for Software Technology
55
Mobile Robots - ROS
Middleware for Robots (Miro)
• open-source robotics framework
• initiated by University of Ulm
• strong focus on software development issues
• use ACE and TAO (CORBA) mechanisms
• provides • a lot of basic functionality for operation
• hardware abstraction
• some tool support for developers
• supports behavior and executive level
• language and OS independence
• too complicated and small community
• still used by NASA Ames for rover prototypes
Gerald Steinbauer
Institute for Software Technology
56
Mobile Robots - ROS
Player
• popular open-source robotics middleware
• provides mainly simple interfaces to actors and
sensors
• allows for hardware abstraction
• client/server architecture
• communication over sockets
• OS and language independent
• good simulation tools: stage (2d) and gazebo (3d)
Gerald Steinbauer
Institute for Software Technology
57
Mobile Robots - ROS
Fawkes
• open-source robotic framework
• driven by RWTH Aachen
• strong focus on software development
• component-based software (plug-ins)
• blackboard architecture
• looks for • simplicity and integration
• low overhead
• scalability
• clear concepts and styles
• somehow integration of function components
Gerald Steinbauer
Institute for Software Technology
58
Mobile Robots - ROS
Fawkes - Main Control Loop
• monolith control loop
• hooks are executed in
an known given order
• within hooks concurrent
threads
• strict timing (i.e. 20-
40Hz)
• less flexible
• but allows some soft
guarantees on
execution [Niemüller et. al SIMPAR 10]
Gerald Steinbauer
Institute for Software Technology
59
Mobile Robots - ROS
Literature
• Niemüller, T., A. Ferrein, D. Beck, and G. Lakemeyer . Design Principles of the
Component-Based Robot Software Framework FawkeS. Simulation, Modeling,
and Programming for Autonomous Robots Proceedings of the 2nd International
Conference on Simulation, Modeling and Programming for Autonomous Robots
(SIMPAR 2010). vol. 6472. Lecture Notes in Computer Science. Springer, pp.
300–311. 2010.
Gerald Steinbauer
Institute for Software Technology
60
Mobile Robots - ROS
Questions?
Thank you!