Operating systems
The primary goal of ROS is to support code reuse in robotics research and development. ROS is a distributed framework of processes (Nodes) that enables executables to be individually designed and loosely coupled at runtime. These processes can be grouped into Packages and Stacks, which can be easily shared and distributed. ROS also supports a federated system of code Repositories that enable collaboration to be distributed as well. This design, from the filesystem level to the community level, enables independent decisions about development and implementation, but all can be brought together with ROS infrastructure tools.
In support of this primary goal of sharing and collaboration, there are several other goals of the ROS framework.
Thin: ROS is designed to be as thin as possible – we won't wrap your main() – so that code written for ROS can be used with other robot software frameworks. A corollary to this is that ROS is easy to integrate with other robot software frameworks: ROS has already been integrated with OpenRAVE, Orocos, and Player.
ROS-agnostic libraries: the preferred development model is to write ROS-agnostic libraries with clean, functional interfaces.
Language independence: the ROS framework is easy to implement in any modern programming language. We have already implemented it in Python, C++, and Lisp, and we have experimental libraries in Java and Lua.
Easy testing: ROS has a builtin unit/integration test framework called roster that makes it easy to bring up and tear down test fixtures.
Scaling: ROS is appropriate for large runtime systems and large development processes.
Operating Systems
ROS currently only runs on Unix-based platforms. Software for ROS is primarily tested on Ubuntu and Mac OS X systems, though the ROS community has been contributing support for Fedora, Gentoo, Arch Linux and other Linux platforms.
While a port to Microsoft Windows for ROS is possible, it has not yet been fully explored.
ROS Architecture
ROS has three levels of architecture: the Filesystem level, the Computation Graph level, and the Community level. These levels and concepts are summarised below, and later sections go into each of these in greater detail.
In addition to the three levels of concepts, ROS also defines two types of names – Package Resource Names and Graph Resource Names – which are discussed below.
ROS Filesystem Level
The filesystem level concepts mainly cover ROS resources that you encounter on disk, such as:
packages – packages are the main unit for organising software in ROS. A package may contain ROS runtime processes (nodes), a ROS-dependent library, datasets, configuration files, or anything else that is usefully organised together. Packages are the most atomic build item and release the item in ROS. Meaning that the most granular thing you can build and release is a package;
metapackages – metapackages are specialised Packages which only serve to represent a group of related other packages. Most commonly metapackages are used as a backwards compatible placeholder for converted rosbuild Stacks;
package manifests – manifests (package.xml) provide metadata about a package, including its name, version, description, license information, dependencies, and other meta information like exported packages. The package.xml package manifest is defined in REP-0127;
repositories – a collection of packages which share a common VCS system. Packages which share a VCS share the same version and can be released together using the catkin release automation tool bloom. Often these repositories will map to converted rosbuild Stacks. Repositories can also contain only one package;
message (msg) types – message descriptions, stored in my_package/msg/MyMessageType.msg, define the data structures for messages sent in ROS;
service (srv) types – service descriptions, stored in my_package/srv/MyServiceType.srv, define the request and response data structures for services in ROS.
Computation Graph Level
The Computation Graph is the peer-to-peer network of ROS processes that are processing data together. The basic Computation Graph concepts of ROS are nodes, Master, Parameter Server, messages, services, topics, and bags, all of which provide data to the Graph in different ways.
These concepts are implemented in the ros_comm repository.
Nodes: nodes are processes that perform a computation. ROS is designed to be modular at a fine-grained scale; a robot control system usually comprises many nodes. For example, one node controls a laser range-finder, one node controls the wheel motors, one node performs localisation, one node performs path planning, one Node provides a graphical view of the system, and so on. A ROS node is written with the use of a ROS client library, such as roscpp or rospy.
Master: the ROS Master provides name registration and lookup to the rest of the Computation Graph. Without the Master, nodes would not be able to find each other, exchange messages, or invoke services.
Parameter server: the parameter Server allows data to be stored by key in a central location. It is currently part of the Master.
Messages: modes communicate with each other by passing messages. A message is simply a data structure, comprising typed fields. Standard primitive types (integer, floating point, boolean, etc.) are supported, as are arrays of primitive types. Messages can include arbitrarily nested structures and arrays (much like C structs).
Topics: messages are routed via a transport system with publish/subscribe semantics. A node sends out a message by publishing it on a given topic. The topic is a name that is used to identify the content of the message. A node that is interested in a particular kind of data will subscribe to the appropriate topic. There may be multiple concurrent publishers and subscribers for a single topic, and a single node may publish and/or subscribe to various topics. In general, publishers and subscribers are not aware of each others' existence. The idea is to decouple the production of information from its consumption. Logically, one can think of a topic as a strongly typed message bus. Each bus has a name, and anyone can connect to the bus to send or receive messages as long as they are the right type.
Services: the publish/subscribe model is a very flexible communication paradigm, but it's many-to-many, one-way transport is not appropriate for request/reply interactions, which are often required in a distributed system. Request/reply is done via services, which are defined by a pair of message structures: one for the request and one for the response. A providing node offers a service under a name, and a client uses the service by sending the request message and awaiting the reply. ROS client libraries generally present this interaction to the programmer as if it were a remote procedure call.
Bags: bags are a format for saving and playing back ROS message data. Bags are an essential mechanism for storing data, such as sensor data, that can be difficult to collect but is necessary for developing and testing algorithms.
The ROS Master acts as a name service in the ROS Computation Graph. It stores topics and services registration information for ROS nodes. Nodes communicate with the Master to report their registration information. As these nodes communicate with the Master, they can receive information about other registered nodes and make connections as appropriate. The Master will also make callbacks to these nodes when this registration information changes, which allows nodes to dynamically create connections as new nodes are run.
Nodes connect to other nodes directly; the Master only provides lookup information, much like a DNS server. Nodes that subscribe to a topic will request connections from nodes that publish that topic and will establish that connection over an agreed upon connection protocol. The most common protocol used in a ROS is called TCPROS, which uses standard TCP/IP sockets.
This architecture allows for decoupled operation, where the names are the primary means by which more extensive and more complex systems can be built. Names have a crucial role in ROS: nodes, topics, services, and parameters all have names. Every ROS client library supports command-line remapping of names, which means a compiled program can be reconfigured at runtime to operate in a different Computation Graph topology.
The ROS Community Level concepts are ROS resources that enable separate communities to exchange software and knowledge. These resources include:
the ROS wiki – the ROS community Wiki is the main forum for documenting information about ROS. Anyone can sign up for an account and contribute their own documentation, provide corrections or updates, write tutorials, and more;