The Building Blocks of ROS 1
If you're using ROS 2, check out The Building Blocks of ROS 2 instead.
Note: Newer versions of ROS 1 have integrated several packages described in this post (e.g.
rqt_plot, etc.) as plugins in the
rqtmeta-package. For the purposes of this post (i.e. covering different features in discrete steps), we've opted to use the older, but still supported, version of these CLI commands (e.g.
rosrun rqt_graph rqt_graphvs.
rqt). Check out the
rqtdocs 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.
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.
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 are registered with the ROS master, a service registry that helps nodes locate 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/Point), another lidar point cloud data (
sensor_msgs/PointCloud), and still another text logs (
A message type is defined via multiple fields, each with a specified type. For example, the
geometry_msgs/Pose message type consists of a
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 1 officially supports Ubuntu, but you can get set up on Windows (Windows Subsystem for Linux) and MacOS (Docker for Mac) as well.
Before running any nodes, you must run
roscore to spin up the following components:
- ROS master – Service registry that helps nodes locate each other.
rosout– Logger for nodes' debugging output.
- Parameter server – Server that allows nodes to store and retrieve parameters at runtime.
Now that you have your core ROS system up, you can use
rosrun to run nodes contained in various ROS packages.
rosrun 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
rosrun 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
rosnode to display information about your currently active nodes.
rosnode list– Lists current nodes.
rosnode info /your_node_name– Provides more information about a given node, including publications and subscriptions.
Once you have several nodes running, use
rostopic to fetch information for any published topic.
rostopic echo /your_topic– Displays messages published to a given topic.
rostopic list– Prints information about active topics.
rostopic type /your_topic– Returns the message type for a topic.
rostopic pub /your_topic geometry_msgs/Point [args]– Publishes data to a given topic with a specified message type.
rosmsg to inspect messages and their types in more detail.
rosmsg list– Lists all message types.
rosmsg show geometry_msgs/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
rqt_plot– Plots numeric values on a 2D chart.
How Foxglove Studio fits in
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.
Studio 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_plot, into our Raw Messages, Topic Graph, Image, and Plot panels, respectively.
Studio further streamlines visualization and debugging workflows by allowing users to load
.bag files directly into the app – you no longer need to run
rosbag in multiple terminals every time you want to inspect your data.
Studio 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 Studio can accelerate your robotics development, feel free to check out our docs or reach out to us directly in our Slack community.
Get started in robotics with the Duckiebot and Foxglove Studio.
Inspect your robotics data with our open source desktop application.
Get blog posts sent directly to your inbox.