Introduction
Foxglove often requires incoming messages to conform to specific structures to visualize them properly. Using Foxglove schemas helps you take full advantage of the platform's built-in visualizations.
Supported formats
If you've already written custom messages, you can transform them into Foxglove-supported schemas using a message converter extension.
Protobuf and JSON Schema
Copy the .proto
files or .json
files you need directly into your project, and use them to start publishing data via a live Foxglove WebSocket connection or logging data to an MCAP file.
NOTE: For Protobuf data, time values of type google.protobuf.Timestamp
or google.protobuf.Duration
will appear with sec
and nsec
fields (instead of seconds
and nanos
) in user scripts, message converters, and the rest of Foxglove, for consistency with time and duration types in other data formats.
You can also import JSON schemas via the @foxglove/schemas
npm package:
import { CompressedImage } from "@foxglove/schemas/jsonschema";
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 the blog post on Recording Robocar Data with MCAP for an example on using an MCAP C++ writer to record your Protobuf data.
Empty JSON Schemas
MCAP allows empty schemas for the JSON message encoding, but you must define a valid JSON schema for visualization. If you don't want to define your schema, you can specify a JSON Schema representing any object, which by default allows additional properties: {"type": "object"}
.