Introduction to ROS
Lorenz Mosenlechner
Technische Universitat Munchen
July 18th, 2012
Department of InformaticsIntelligent Autonomous Systems Technische Universität München
Motivation
• Today’s robotic systems are complex.
• Many sensors.
• Highly distributed, many processes, many computers.
• Teams of engineers.
) ROS — The Robot Operating System.
Overview ROS Communication Layer ROS Build System Programming with ROS The TF Library
Lorenz Mösenlechner Introduction to ROS2
Department of InformaticsIntelligent Autonomous Systems Technische Universität München
Motivation
• Today’s robotic systems are complex.
• Many sensors.
• Highly distributed, many processes, many computers.
• Teams of engineers.
) ROS — The Robot Operating System.
Overview ROS Communication Layer ROS Build System Programming with ROS The TF Library
Lorenz Mösenlechner Introduction to ROS3
Department of InformaticsIntelligent Autonomous Systems Technische Universität München
Outline
Overview
ROS Communication Layer
ROS Build System
Programming with ROS
The TF Library
Overview ROS Communication Layer ROS Build System Programming with ROS The TF Library
Lorenz Mösenlechner Introduction to ROS4
Department of InformaticsIntelligent Autonomous Systems Technische Universität München
Outline
Overview
ROS Communication Layer
ROS Build System
Programming with ROS
The TF Library
Overview ROS Communication Layer ROS Build System Programming with ROS The TF Library
Lorenz Mösenlechner Introduction to ROS5
Department of InformaticsIntelligent Autonomous Systems Technische Universität München
What is ROS?More than just a middleware
• A “meta” operating system for robots
• A collection of packaging, softwarebuilding tools
• An architecture for distributedinter-process/inter-machinecommunication and configuration
• Development tools for system runtime anddata analysis
• A language-independent architecture(c++, python, lisp, java, and more)
Overview ROS Communication Layer ROS Build System Programming with ROS The TF Library
Lorenz Mösenlechner Introduction to ROS6
Department of InformaticsIntelligent Autonomous Systems Technische Universität München
What is ROS not?No confusion
• An actual operating system
• A programming language
• A programming environment / IDE
• A hard real-time architecture
Overview ROS Communication Layer ROS Build System Programming with ROS The TF Library
Lorenz Mösenlechner Introduction to ROS7
Department of InformaticsIntelligent Autonomous Systems Technische Universität München
What does ROS get you?All levels of development
Overview ROS Communication Layer ROS Build System Programming with ROS The TF Library
Lorenz Mösenlechner Introduction to ROS8
Department of InformaticsIntelligent Autonomous Systems Technische Universität München
What does ROS get you?All levels of development
Overview ROS Communication Layer ROS Build System Programming with ROS The TF Library
Lorenz Mösenlechner Introduction to ROS9
Department of InformaticsIntelligent Autonomous Systems Technische Universität München
What does ROS get you?All levels of development
Overview ROS Communication Layer ROS Build System Programming with ROS The TF Library
Lorenz Mösenlechner Introduction to ROS10
Department of InformaticsIntelligent Autonomous Systems Technische Universität München
What does ROS get you?All levels of development
Overview ROS Communication Layer ROS Build System Programming with ROS The TF Library
Lorenz Mösenlechner Introduction to ROS11
Department of InformaticsIntelligent Autonomous Systems Technische Universität München
What does ROS get you?All levels of development
Overview ROS Communication Layer ROS Build System Programming with ROS The TF Library
Lorenz Mösenlechner Introduction to ROS12
Department of InformaticsIntelligent Autonomous Systems Technische Universität München
What does ROS get you?All levels of development
Overview ROS Communication Layer ROS Build System Programming with ROS The TF Library
Lorenz Mösenlechner Introduction to ROS13
Department of InformaticsIntelligent Autonomous Systems Technische Universität München
What does ROS get you?All levels of development
Overview ROS Communication Layer ROS Build System Programming with ROS The TF Library
Lorenz Mösenlechner Introduction to ROS14
Department of InformaticsIntelligent Autonomous Systems Technische Universität München
What does ROS get you?All levels of development
Overview ROS Communication Layer ROS Build System Programming with ROS The TF Library
Lorenz Mösenlechner Introduction to ROS15
Department of InformaticsIntelligent Autonomous Systems Technische Universität München
What does ROS get you?All levels of development
Overview ROS Communication Layer ROS Build System Programming with ROS The TF Library
Lorenz Mösenlechner Introduction to ROS16
Department of InformaticsIntelligent Autonomous Systems Technische Universität München
What does ROS get you?All levels of development
Overview ROS Communication Layer ROS Build System Programming with ROS The TF Library
Lorenz Mösenlechner Introduction to ROS17
Department of InformaticsIntelligent Autonomous Systems Technische Universität München
What does ROS get you?All levels of development
Overview ROS Communication Layer ROS Build System Programming with ROS The TF Library
Lorenz Mösenlechner Introduction to ROS18
Department of InformaticsIntelligent Autonomous Systems Technische Universität München
The ROS CommunityResearchers using common tools to enable collaboration
79 Institutional ROS Repositories, all over the world (July, 2011)
Overview ROS Communication Layer ROS Build System Programming with ROS The TF Library
Lorenz Mösenlechner Introduction to ROS19
Department of InformaticsIntelligent Autonomous Systems Technische Universität München
www.ros.org - The ROS HubA centralized location for ROS users and developers
Overview ROS Communication Layer ROS Build System Programming with ROS The TF Library
Lorenz Mösenlechner Introduction to ROS20
Department of InformaticsIntelligent Autonomous Systems Technische Universität München
answers.ros.org - ROS Questions & AnswersCommunity-supported help for ROS users
Overview ROS Communication Layer ROS Build System Programming with ROS The TF Library
Lorenz Mösenlechner Introduction to ROS21
Department of InformaticsIntelligent Autonomous Systems Technische Universität München
ros mailing listsGetting in touch with the developer community
• ROS Users - for general ROS-related discussionshttps://code.ros.org/mailman/listinfo/ros-users
• Other Lists & List Archiveshttp://code.ros.org/lurker
Overview ROS Communication Layer ROS Build System Programming with ROS The TF Library
Lorenz Mösenlechner Introduction to ROS22
Department of InformaticsIntelligent Autonomous Systems Technische Universität München
Outline
Overview
ROS Communication Layer
ROS Build System
Programming with ROS
The TF Library
Overview ROS Communication Layer ROS Build System Programming with ROS The TF Library
Lorenz Mösenlechner Introduction to ROS23
Department of InformaticsIntelligent Autonomous Systems Technische Universität München
ROS CoreWhere it all comes together
• ROS Master
– A centralized XML-RPC server– Negotiates communication connections– Registers and looks up names for ROS graph resources
• Parameter ServerStores persistent configuration parameters and other arbitrary data
• rosoutEssentially a network-based stdout for human-readable messages
Overview ROS Communication Layer ROS Build System Programming with ROS The TF Library
Lorenz Mösenlechner Introduction to ROS24
Department of InformaticsIntelligent Autonomous Systems Technische Universität München
ROS “Graph” AbstractionNamed network resources
ROS graph resources:
• nodes
– processes– produce and consume data
• parameters
– persistent data storage– configuration, initialization settings– stored on parameter server
• topicsAsynchronous many-to-many communication streams.
• servicesSynchronous one-to-many network-based functions.
Overview ROS Communication Layer ROS Build System Programming with ROS The TF Library
Lorenz Mösenlechner Introduction to ROS25
Department of InformaticsIntelligent Autonomous Systems Technische Universität München
ROS “Graph”rxgraph: communication network visualization
Overview ROS Communication Layer ROS Build System Programming with ROS The TF Library
Lorenz Mösenlechner Introduction to ROS26
Department of InformaticsIntelligent Autonomous Systems Technische Universität München
Creating and Running ROS NodesDistributing computation with ROS
Launch files
• XML files for launching nodes
• associate a set of parameters and nodes with a single file
• hierarchically compose collections of other launch files
• automatically re-spawn nodes if they crash
• change node names, namespaces, topics, and other resource nameswithout recompiling
• easily distribute nodes across multiple machines
Overview ROS Communication Layer ROS Build System Programming with ROS The TF Library
Lorenz Mösenlechner Introduction to ROS27
Department of InformaticsIntelligent Autonomous Systems Technische Universität München
Example Launch File
Example launch file
<launch><node name=”my node” pkg=” foo ” type=” bar ”>
<remap from=”/ b a s e l a s e r / scan ” to=” scan ” /><rosparam>
u s e f o o : Truef r am e i d : b a s e l a s e r
</ rosparam></node>
</ launch>
• Launch with roslaunch package foo.launch
Overview ROS Communication Layer ROS Build System Programming with ROS The TF Library
Lorenz Mösenlechner Introduction to ROS28
Department of InformaticsIntelligent Autonomous Systems Technische Universität München
ROS Communication ProtocolsConnecting nodes over the network
• ROS Topics– Asynchronous “stream-like” communication– Strongly-typed (ROS .msg spec)– Can have one or more publishers– Can have one or more subscribers
• ROS Services– Synchronous “function-call-like” communication– Strongly-typed (ROS .srv spec)– Can have only one server– Can have one or more clients
• Actions– Built on top of topics– Long running processes– Cancellation
Overview ROS Communication Layer ROS Build System Programming with ROS The TF Library
Lorenz Mösenlechner Introduction to ROS29
Department of InformaticsIntelligent Autonomous Systems Technische Universität München
Asynchronous Distributed CommunicationROS TCP Topics
Overview ROS Communication Layer ROS Build System Programming with ROS The TF Library
Lorenz Mösenlechner Introduction to ROS30
Department of InformaticsIntelligent Autonomous Systems Technische Universität München
Asynchronous Distributed CommunicationROS TCP Topics
Overview ROS Communication Layer ROS Build System Programming with ROS The TF Library
Lorenz Mösenlechner Introduction to ROS31
Department of InformaticsIntelligent Autonomous Systems Technische Universität München
Asynchronous Distributed CommunicationROS TCP Topics
Overview ROS Communication Layer ROS Build System Programming with ROS The TF Library
Lorenz Mösenlechner Introduction to ROS32
Department of InformaticsIntelligent Autonomous Systems Technische Universität München
Asynchronous Distributed CommunicationROS TCP Topics
Overview ROS Communication Layer ROS Build System Programming with ROS The TF Library
Lorenz Mösenlechner Introduction to ROS33
Department of InformaticsIntelligent Autonomous Systems Technische Universität München
Asynchronous Distributed CommunicationROS TCP Topics
Overview ROS Communication Layer ROS Build System Programming with ROS The TF Library
Lorenz Mösenlechner Introduction to ROS34
Department of InformaticsIntelligent Autonomous Systems Technische Universität München
Asynchronous Distributed CommunicationROS TCP Topics
Overview ROS Communication Layer ROS Build System Programming with ROS The TF Library
Lorenz Mösenlechner Introduction to ROS35
Department of InformaticsIntelligent Autonomous Systems Technische Universität München
Asynchronous Distributed CommunicationROS TCP Topics
Overview ROS Communication Layer ROS Build System Programming with ROS The TF Library
Lorenz Mösenlechner Introduction to ROS36
Department of InformaticsIntelligent Autonomous Systems Technische Universität München
Asynchronous Distributed CommunicationROS TCP Topics
Overview ROS Communication Layer ROS Build System Programming with ROS The TF Library
Lorenz Mösenlechner Introduction to ROS37
Department of InformaticsIntelligent Autonomous Systems Technische Universität München
Asynchronous Distributed CommunicationROS TCP Topics
Overview ROS Communication Layer ROS Build System Programming with ROS The TF Library
Lorenz Mösenlechner Introduction to ROS38
Department of InformaticsIntelligent Autonomous Systems Technische Universität München
Asynchronous Distributed CommunicationROS TCP Topics
Overview ROS Communication Layer ROS Build System Programming with ROS The TF Library
Lorenz Mösenlechner Introduction to ROS39
Department of InformaticsIntelligent Autonomous Systems Technische Universität München
Asynchronous Distributed CommunicationROS TCP Topics
Overview ROS Communication Layer ROS Build System Programming with ROS The TF Library
Lorenz Mösenlechner Introduction to ROS40
Department of InformaticsIntelligent Autonomous Systems Technische Universität München
ROS Graph IntrospectionNo more wireshark
ROS provides several tools for analyzing the data flowing over ROScommuncation resources:
• rosnodeGives a user infomation about a node: publications, subscriptions,etc
• rostopicGives datarate, actual data, publishers, subscribes
• rosserviceEnables a user to call a ROS Service from the command line
• roswtf (wire trouble finder)Diagnoses problems with a ROS network
Overview ROS Communication Layer ROS Build System Programming with ROS The TF Library
Lorenz Mösenlechner Introduction to ROS45
Department of InformaticsIntelligent Autonomous Systems Technische Universität München
ROS GUI ToolsThere are lots. . .
Overview ROS Communication Layer ROS Build System Programming with ROS The TF Library
Lorenz Mösenlechner Introduction to ROS46
Department of InformaticsIntelligent Autonomous Systems Technische Universität München
ROS GUI ToolsThere are lots. . .
Overview ROS Communication Layer ROS Build System Programming with ROS The TF Library
Lorenz Mösenlechner Introduction to ROS47
Department of InformaticsIntelligent Autonomous Systems Technische Universität München
ROS GUI ToolsThere are lots. . .
Overview ROS Communication Layer ROS Build System Programming with ROS The TF Library
Lorenz Mösenlechner Introduction to ROS48
Department of InformaticsIntelligent Autonomous Systems Technische Universität München
rviz - 3D VisualizationModular state and sensor visualization
Overview ROS Communication Layer ROS Build System Programming with ROS The TF Library
Lorenz Mösenlechner Introduction to ROS49