Write messages in the JSON or Protobuf format for easy visualization in Foxglove
While Foxglove was originally designed for visualizing ROS data, we are on a mission to bring world-class visualization to all robots, including those with custom software frameworks.
Today, we're excited to announce Foxglove schemas: an entirely Foxglove-native way to represent and visualize data. Foxglove schemas are available for Protobuf, JSON, ROS 1, and ROS 2, and we plan to add support for more formats over time.
We announced the MCAP log file format earlier this year, as an important milestone towards our goal of developing framework-agnostic robotics tools. However, even with MCAP, Foxglove still required the use of existing ROS schemas such as sensor_msgs/Image
or visualization_msgs/Marker
to visualize certain data.
Our new Foxglove schemas have no dependency on ROS, and can be used from any framework. We also plan to continue fully supporting the existing ROS schemas as we do today.
Foxglove’s Image panel now supports foxglove.CompressedImage in addition to ROS’s sensor_msgs/Image. The 3D panel now supports foxglove.PointCloud in addition to ROS’s sensor_msgs/PointCloud2.
To see a full list of our supported schemas, as well as the Foxglove panels that use them, check out our schemas documentation.
To start publishing messages that adhere to the new Foxglove schemas, import the desired schema files for your framework.
Protobuf
Copy the .proto
files directly from the foxglove/schemas repo into your project. You can use these imported schemas to publish messages via a live Foxglove WebSocket connection or to log data to an MCAP file.
We provide WebSocket libraries for live data (Python, JavaScript, C++), as well as MCAP writers for pre-recorded data files (Python, JavaScript, C++).
Check out our blog post on Recording Robocar Data with MCAP for an example on using an MCAP C++ writer to record your Protobuf data.
JSON Schema
Copy the .json
files directly from the foxglove/schemas repo into your project, or import them from the @foxglove/schemas npm package:
import { CompressedImage } from "@foxglove/schemas/jsonschema";
language-typescript
Use these imported schemas to publish messages via a live Foxglove WebSocket connection or to log data to an MCAP file. We provide WebSocket libraries for live data (Python, JavaScript, C++), as well as MCAP writers for pre-recorded data files (Python, JavaScript, C++).
ROS 1 & 2
We’re in the process of publishing ROS packages for Foxglove schemas. After the next ROS sync, it will be as simple as running sudo apt install ros-humble-foxglove-msgs
(replacing humble
with your preferred ROS distribution).
In the meantime, you can copy .msg
files directly from the ros1/
or ros2/
folder in foxglove/schemas into your ROS project, then importing these schemas wherever you want to start publishing messages:
from foxglove_msgs.msg import Vector2
language-py
TypeScript (bonus)
We also provide type definitions for Foxglove schemas for use in Foxglove's User Scripts panel, or your own TypeScript project.
For User Scripts, you can specify the schema you want to use with Message<"foxglove.[SchemaName]">
:
import { Input, Message } from "./types";
type Output = Message<"foxglove.Point2">;
export const inputs = ["/input/topic"];
export const output = "/studio_script/output_topic";
export default function script(event: Input<"/input/topic">): Output {
return { x: 1, y: 2 };
}
language-typescript
For your own TypeScript project, you can import the type from the @foxglove/schemas npm package:
import { CompressedImage } from "@foxglove/schemas";
language-typescript
We developed Foxglove to advance the state of the art in open source robotics. MCAP was our first step towards visualizing general-purpose robotics data, and Foxglove schemas are a continuation of that vision. We want to make it easy for all robotics teams, regardless of framework, to get data into Foxglove and take full advantage of our tools.
Explore all Foxglove schemas via our docs or the foxglove/schemas GitHub repo. As always, join our Discord community to ask questions, or reach out to us directly with any feedback.