The Robot Operating System (ROS) is an open-source software suite designed to streamline robotics development.
If you're using ROS 1, check out The Building Blocks of ROS 1 instead.
Note: ROS 2 has integrated several packages described in this post (e.g. rqt_console
, rqt_graph
, rqt_plot
, etc.) as plugins in the rqt
meta-package. For the purposes of this post (i.e. covering different features in discrete steps), we've opted to call out the individual packages in the CLI commands (e.g. ros2 run rqt_graph rqt_graph
vs. rqt
). Check out the rqt
docs for more information.
If you’ve kept up-to-date on tech’s latest robotics projects or tinkered around with your own robot kit, you’ve probably come across mentions of ROS 2.
At its core, the Robot Operating System (ROS) is an open source software suite built to simplify robotics development. It provides a collection of tools that runs everything from low-level device control, hardware abstractions, and package management. Due to its distributed design, users can pick and choose what parts of ROS to integrate into their own projects.
ROS was born in 2007, out of roboticists’ desire to more easily share resources and build upon each other’s work. These experts experienced firsthand how difficult it was building software for an increasingly diverse array of robots across a variety of platforms, and realized that no one person was equipped to tackle the field’s challenges alone. They hoped a deliberately modular framework like ROS would foster more collaborative robotics development and encourage code reuse among the community’s brightest minds.
The ROS 2 Project emerged around 2015, when ROS 1's commercial shortcomings were becoming ever more apparent. By leveraging what was great about ROS 1 and improving what wasn't, ROS 2 contributors began evolving the framework to incorporate new use cases and technologies and to address the real-world challenges roboticists were facing.
Nearly 15 years after its conception, the ROS ecosystem now consists of tens of thousands of users worldwide, with applications ranging from COVID-19 disinfection robots to humanoid robotic hands. Its members have contributed cutting-edge libraries like map generation systems, navigation tools, and computer vision utilities, ensuring ROS’s continued relevance in the robotics world.
ROS is a distributed framework of self-contained processes, or nodes, that discover and communicate with each other at runtime. Any given robot can have multiple nodes, each of which owns a subset of the robot’s tasks – one node may keep track of the robot’s velocity, another its steering angle, and still another its camera feed. All nodes communicate with each other via DDS (Data Distribution Service), a middleware protocol that drives a distributed architecture and allows nodes to discover each other.
Nodes communicate with each other by publishing or subscribing to messages on different channels of information, called topics. In this way, we can separate concerns into their respective nodes, while still empowering the robot to make complex decisions to execute a task. Nodes can be grouped into packages, which can then be easily shared and distributed among ROS users.
Messages for a topic adhere to a fixed schema, called a message type. For example, one topic can contain messages with just position coordinates (geometry_msgs/msg/Point
), another lidar point cloud data (sensor_msgs/msg/PointCloud
), and still another text logs (std_msgs/msg/String
).
A message type is defined via multiple fields, each with a specified type. For example, the geometry_msgs/msg/Pose
message type consists of a position
and orientation
field, each of which have their own message type definitions:
In summary, if nodes are like walkie-talkies that can communicate with each other, then topics are the channels that they broadcast audio on, and messages are the words that travel across these channels. In the same way that certain walkie-talkie channels are reserved for specific types of communication, each ROS topic is also reserved for messages that adhere to a specific type.
To get started using ROS, you will need to install it on your machine – ROS 2 provides installation instructions for Ubuntu, Windows, and macOS.
Use ros2 run
to run nodes contained in various ROS packages.
For example, ros2 run turtlesim turtlesim_node
will find the turtlesim
ROS package and run its turtlesim_node
to bring up a simulation of swimming turtles on your desktop. Running ros2 run rqt_graph rqt_graph
will run that package’s rqt_graph
node to render a graph of your nodes connected by their publications and subscriptions.
Once you have a few nodes from different packages running, use ros2 node
to display information about your currently active nodes.
ros2 node list
– Lists current nodes.ros2 node info /your_node_name
– Provides more information about a given node, including publications and subscriptions.Once you have several nodes running, use ros2 topic
to fetch information for any published topic.
ros2 topic echo /your_topic
– Displays messages published to a given topic.ros2 topic list
– Prints information about active topics.ros2 topic type /your_topic
– Returns the message type for a topic.ros2 topic pub /your_topic geometry_msgs/msg/Point [args]
– Publishes data to a given topic with a specified message type.Finally, use ros2 interface
to inspect messages and their types in more detail.
ros2 interface list
– Lists all message types.ros2 interface show geometry_msgs/msg/Point
– Displays the fields for a given message type.Given how extensive the ROS environment is, it is easy to get overwhelmed by the selection of available packages. Here are a few popular data visualization packages that you can get started with:
rviz
– Provides a 3D visualizer for ROS messages.rqt_console
– Provides a GUI for displaying and filtering ROS messages.rqt_graph
– Visualizes the ROS computation graph – i.e. nodes and the topics they publish and subscribe to.rqt_image_view
– Displays camera images using image_transport
.rqt_plot
– Plots numeric values on a 2D chart.While the ROS ecosystem offers an impressive array of features and services, it can be overwhelming to find, install, and run them all at once. ROS is also tightly bound to specific versions of Ubuntu, which introduces significant overhead for users interested in quickly viewing their data.
Foxglove has integrated many of ROS's visualization and debugging tools into one cross-platform desktop application, so that instead of memorizing package names and CLI commands, you can simply drag and drop a panel from our menu into your layout to start seeing results. For example, we've incorporated features similar to rqt_console
, rqt_graph
, rqt_image_view
, and rqt_plot
, into our Raw Messages, Topic Graph, Image, and Plot panels, respectively. Check out our docs for a list of commonly used developer tools that we've integrated into the Foxglove app.
Foxglove further streamlines visualization and debugging workflows by allowing users to load .db3
files directly into the app – you no longer need to run ros2 run
and ros2 bag
in multiple terminals every time you want to inspect your data.
Foxglove also supports user contributions to an extensions library, so you can build your own project-specific panels to customize your robotics development workflows.
To learn more about how Foxglove can accelerate your robotics development, feel free to check out our docs or reach out to us directly in our Discord community.