ROS 2

Foxglove Studio can load local and remote ROS 2 (.db3) files, or connect directly to a running ROS stack using a Rosbridge (WebSockets) or native (TCP) connection.

Files

Since ROS 2 (.db3) files do not contain their message definitions, we recommend first converting them into self-contained MCAP files before loading them into Foxglove Studio.

You can use the mcap CLI tool to help with this conversion:

$ mcap convert ros2_input.db3 ros2_output.mcap

mcap will search the path stored in your $AMENT_PREFIX_PATH environment variable to locate the ROS message definitions on your hard drive. You can also specify a colon-separated list of directories for the CLI tool to search using the ament-prefix-path flag:

$ mcap convert ros2_input.db3 ros2_output.mcap --ament-prefix-path=/your/first/directory;/your/second/directory

Once you have your MCAP (.mcap) files, you can open them from your local filesystem or a remote cloud storage solution.

Local file

Once you have your MCAP (.mcap) file, double-click it from your file manager, drag-and-drop it directly into the app, or Open local file via the Data source dialog:

local file dialog

Cloud data

Foxglove Data Platform

Once you convert your ROS 2 .db3 files to MCAP (.mcap) files, you can upload them to Foxglove Data Platform's web console and stream them directly into Foxglove Studio.

Check out the Data Platform docs for more information on how to export and visualize your robotics data.

By URL

Remote ROS 2 .db3 files are not supported, but you can convert them into MCAP files for remote file support.

To load a remote MCAP (.mcap) file, select Open file from URL in the Data source dialog, and enter the URL to your remote file.

remote file dialog

Check out the Setting up CORS page for more details on loading your remote data files into Foxglove Studio.

Live connection

For live connections, you must be on the same network as the robot. While we support multiple options, we recommend Foxglove WebSocket as the easiest option to get started.

Foxglove WebSocket

Connect directly to your running ROS stack using a Foxglove WebSocket connection. This connection uses a standard protocol to connect Studio to your ROS master over WebSockets. While it does require running an extra ROS node (foxglove_bridge), we recommend this option if you have a network firewall between ROS and Studio, as it requires your ROS host to have only one port open.

To open a Foxglove WebSocket connection, make sure you’ve installed ROS 2 and followed the instructions for setting up the Foxglove bridge.

Then, click Open connection in the Data source dialog, select Foxglove WebSocket, then enter the URL to your Rosbridge server:

Foxglove WebSocket dialog

Current limitations

Foxglove WebSocket connections support publishing back to your ROS stack, but not reading or setting ROS parameters.

Rosbridge

NOTE: For performance reasons, we recommend using the Foxglove WebSocket connection instead.

Connect directly to your running ROS stack via WebSockets using a Rosbridge connection.

A rosbridge connection uses a standard protocol to connect Studio to your ROS master over WebSockets. While it does require running an extra ROS node (rosbridge_server), we recommend this option if you have a network firewall between ROS and Studio, as it requires your ROS host to have only one port open.

To open a Rosbridge connection, make sure you’ve installed ROS 2, as well as rosbridge-suite:

# For Galactic (ROS 2)
$ sudo apt install ros-galactic-rosbridge-suite

Next, start the WebSocket server, and review the command printout to determine the port it is listening on (e.g. ws://0.0.0.0:9090):

$ ros2 launch rosbridge_server rosbridge_websocket_launch.xml

Click Open connection in the Data source dialog, select "Rosbridge (ROS 1 & 2)", then enter the URL to your Rosbridge server:

rosbridge dialog

You are now connected to ROS!

To test your connection, add a Raw Messages panel to your layout, and see a list of available topics populate the dropdown. Check out the /connected_clients topic to see information rosbridge is publishing about your connection.

Current limitations

Rosbridge connections support publishing back to your ROS stack, but not reading or setting ROS parameters.

Native

Desktop app only

Deprecation notice: This connection will be removed in future versions of Studio. We recommend using the Foxglove WebSocket connection instead.

macOS users: Docker for Mac unfortunately does not expose all container ports to the macOS host, and so does not support bridge or host networking. When running ROS on a Mac, use the Foxglove WebSocket or the Rosbridge connection instead.

Linux users: You may need to adjust their networking receive buffer size in order to receive larger messages.

Connect directly to your running ROS stack via a native TCP (Transmission Control Protocol) connection to access your ROS master and/or nodes directly.

Once you have a working ROS 2 setup on your computer, run roscore in your terminal to start up your nodes.

Open connection via the Data source dialog, select "ROS 2", and enter your ROS_DOMAIN_ID:

ros 2 dialog

You are now connected to ROS!

To test your connection, add a Raw Messages panel to your layout, and see a list of available topics populate the dropdown. If you are not yet running any ROS nodes, you should only see the /rosout_agg topic.

Current limitations

Native ROS 2 connections do not support (decoding custom message definitions, or publishing back to the ROS stack). They also do not yet support reading or setting ROS parameters.

Additional resources