kornia-slam

Visual-inertial SLAM in Rust. Point it at a camera, a stereo pair or a stereo pair with an IMU, and it tracks where the camera is and maps the space around it. Built on kornia-rs.

v0.1, early release. Expect the API to change between minor versions.

EuRoC MH_01_easy
EuRoC V1_01_easy

What it does

Quick start

Clone the repository and download a EuRoC sequence in ASL format. MH_01_easy is a good first run.

git clone https://github.com/kornia/kornia-slam && cd kornia-slam

# monocular
cargo run --release -p kornia-slam-app -- euroc --data /path/to/MH_01_easy

# stereo + IMU, scored against ground truth
cargo run --release -p kornia-slam-app -- euroc --data /path/to/MH_01_easy --stereo --imu --evaluate

The other sources, the stereo calibration format and every flag are in the app README.

Use it in Copper

Copper is a Rust runtime that builds, runs and replays a whole robot deterministically. cu-kornia-vio packages kornia-slam's stereo visual-inertial odometry as Copper tasks:

Stereo + IMU in Copper's drone simulator. The dots on the camera image are map points projected through the estimated pose.

Add both crates from the same git source:

[dependencies]
cu-kornia-vio = { git = "https://github.com/kornia/cu-kornia-vio", branch = "main" }
cu-stereo-payloads = { git = "https://github.com/kornia/cu-kornia-vio", branch = "main" }

Get the timestamps right. Stamp each image and IMU sample with its capture time, on one clock. In the drone simulator, a 16 ms image-stamp error made stereo + IMU worse than stereo alone. Fixing it cut the trajectory error over a 440 m flight from 9.7 m to 2.1 m; stereo alone gave 5.7 m.

The Copper guide covers the revisions to pin, the task graph, and the runtime settings for simulation and logging.

Build and contribute

Pixi sets up the toolchain for you:

pixi run rust-lint           # fmt + clippy + check
pixi run rust-test           # workspace tests
pixi shell                   # drop into the environment

With your own toolchain, use Rust 1.91 or newer (the library crates alone need 1.89):

cargo fmt --all -- --check
cargo clippy --all-targets -- -D warnings
cargo test --workspace

What's planned is in the roadmap. Questions go to Discord or the issue tracker.

kornia-slam is Apache-2.0 licensed.