Grey humanoid robot kneeling to pick up a book in a library aisle
AI-generated image · Source

Explainers

What is ROS 2?

ROS 2 is robot middleware, not a particular humanoid and not a manufacturer. This page follows the official ROS 2 documentation for the Humble release, including the basic concepts overview, the pages on nodes, interfaces, discovery, and parameters, and the beginner tutorial Understanding nodes. The definitions below are the ones in those documents. This is not a setup guide and not a comparison of robot brands.

The official one-sentence definition

The basic concepts page states the definition directly: “ROS 2 is a middleware based on a strongly-typed, anonymous publish/subscribe mechanism that allows for message passing between different processes.” At the heart of any ROS 2 system, it says, is the ROS graph. “The ROS graph refers to the network of nodes in a ROS system and the connections between them by which they communicate.”

The Understanding nodes tutorial uses a similar picture. The ROS graph, it writes, is “a network of ROS 2 elements processing data together at the same time.” It “encompasses all executables and the connections between them if you were to map them all out and visualize them.” A full robotic system, the tutorial says, “is comprised of many nodes working in concert.” In ROS 2, “a single executable (C++ program, Python program, etc.) can contain one or more nodes.”

What a node is

The nodes page says a node is a participant in the ROS 2 graph that uses a client library to communicate with other nodes. Nodes can communicate with other nodes within the same process, in a different process, or on a different machine. “Nodes are typically the unit of computation in a ROS graph; each node should do one logical thing.” The beginner tutorial gives examples of that modular purpose: controlling wheel motors, or publishing sensor data from a laser range-finder.

The same nodes page lists the ways a node talks. Nodes can publish to named topics to deliver data to other nodes, or subscribe to named topics to get data from other nodes. They can act as a service client so that another node performs a computation on their behalf, or as a service server to provide functionality to other nodes. For long-running computations, a node can act as an action client or an action server. Nodes can also provide configurable parameters to change behavior during run-time. “Nodes are often a complex combination of publishers, subscribers, service servers, service clients, action servers, and action clients, all at the same time.”

Connections between nodes, the nodes page says, are established through a distributed discovery process. In the C++ client library rclcpp, a node can also create secondary instances known as subordinate nodes, or sub-nodes, using rclcpp::Node::create_sub_node(). A subordinate node shares the parent node’s context, node interfaces (including logging, parameters, timers, and clock), and ROS graph identity, while specifying an additional relative sub-namespace. The documentation presents sub-nodes as a way for internal subsystems in the same process to publish or subscribe under scoped names without creating separate nodes.

Topics, services, and actions

The interfaces page says interfaces in ROS define how nodes exchange data, and that nodes typically communicate through three types. Topics are for continuous data streams. Services are for synchronous request/response interactions — “short tasks which happen immediately.” Actions are for long-running tasks with feedback — “tasks that may take some time to complete.” For consistent communication, each interface uses definitions provided in .msg, .srv, or .action files.

A topic, the same page says, is meant for continuous data streams, for example streaming sensor data or the status of a robot. Topics implement a publish/subscribe pattern: a node publishes data to a topic, and other nodes subscribe to receive that data. The main characteristics listed are asynchronous, one-way communication, and that multiple publishers and subscribers can share the same topic. Topic keys, the page adds, identify individual publishers on a topic so nodes and tools can distinguish where messages come from when several publishers share the same topic.

A service is meant for synchronous request/response interactions, for example sending a query that asks for the configuration of a specific robot. A client sends a request, and a server replies with a response. The documentation calls this ideal for short-lived operations that require confirmation, or that provide a result in response to a request.

An action is meant for long-running tasks with feedback, for example moving a robot to a specific position, or asking it to perform a complex motion. Actions allow clients to send goals, receive feedback during the execution, cancel if needed, and return a result if available. The listed characteristics are that the interface is asynchronous, with feedback and a result, and that it is suitable for operations that take time.

A comparison table on the same page summarizes the differences. Topics use a publish/subscribe pattern, are one-way, do not provide a result, are typically used for continuous data, and do not support cancellation. Services use request/response, are two-way, provide a result, are typically used for quick queries, and do not support cancellation. Actions use a goal/feedback/result pattern, are two-way with feedback, provide a result, are typically used for long-running tasks, and do support cancellation. Those are the documentation’s categories, not a requirement that every humanoid use all three.

Discovery and parameters

The discovery page says discovery of nodes happens automatically through the underlying middleware of ROS 2. When a node is started, it advertises its presence to other nodes on the network with the same ROS domain, set with the ROS_DOMAIN_ID environment variable. Nodes respond to this advertisement with information about themselves so that the appropriate connections can be made. Nodes periodically advertise their presence so that connections can be made with entities found later, and they advertise to other nodes when they go offline. “Nodes will only establish connections with other nodes if they have compatible Quality of Service settings.” The page illustrates this with a talker-listener demo in which a C++ talker and a Python listener discover each other automatically and begin to exchange messages on the same topic.

Parameters, according to the parameters page, are associated with individual nodes and are used to configure nodes at startup and during runtime, without changing the code. The lifetime of a parameter is tied to the lifetime of the node, though the node could implement persistence to reload values after a restart. Parameters are addressed by node name, node namespace, parameter name, and, optionally, a parameter namespace. Each parameter consists of a key, a value, and a descriptor. The key is a string; the value is one of a listed set of types, including bool, int64, float64, string, and several array types. By default, the page says, a node needs to declare all of the parameters it will accept during its lifetime, so that the type and name are well defined at startup. External processes can perform parameter operations via parameter services that are created by default when a node is instantiated.

How to read this page

In the official Humble documentation, ROS 2 is middleware: a typed, anonymous publish/subscribe system for passing messages between processes, organized as a graph of nodes. A node should do one logical thing, and it may publish, subscribe, call services, provide services, send or receive actions, and expose parameters. Topics carry continuous streams; services handle short request/response work; actions handle longer tasks with feedback and cancellation. Nodes find one another by discovery inside a ROS domain, and they connect only with compatible quality-of-service settings.

This page does not say that every humanoid runs ROS 2, and it does not tell a reader how to install a distribution. The sources are the official ROS 2 Humble pages linked above: the basic concepts overview, nodes, interfaces, discovery, parameters, and the Understanding nodes tutorial.

← All news