Skip to main content

SDK Introduction

The Foxglove SDK allows you to quickly and easily:

  • Stream and visualize your robot data live in Foxglove
  • Log your data to MCAP files

The SDK is available for C++, Python, and Rust under the MIT license.

This documentation provides an overview of the SDK to help you get started. For more detailed information, see the additional resources for each language below.

Installation

Install foxglove from crates.io: https://crates.io/crates/foxglove

cargo add foxglove

Getting started

Here's a minimal example that sends Log messages to the Foxglove app.

When you run this example and open a Log panel in the Foxglove app, you'll see messages logged a few times per second.

use foxglove::{
WebSocketServer, log,
schemas::{Log, Timestamp, log::Level},
};
use std::{thread, time::Duration};

fn main() {
WebSocketServer::new()
.start_blocking()
.expect("Server failed to start");

loop {
log!(
"/hello",
Log {
level: Level::Info.into(),
timestamp: Some(Timestamp::now()),
message: "Hello, Foxglove!".to_string(),
..Default::default()
}
);
thread::sleep(Duration::from_millis(100));
}
}

Reference

Reference API documentation, additional examples, and other resources for each SDK language.