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.
What it does
- Tracks the camera from ORB features: monocular, stereo, or either with an IMU.
- Refines the map with local bundle adjustment, and with a visual-inertial BA when an IMU is present.
- Closes loops. DBoW2 place recognition spots revisited places, and pose-graph optimisation corrects the drift.
- Reads EuRoC and Hilti datasets, MCAP recordings from Bubbaloop, and live OAK-D or UVC cameras.
- Shows its work in a terminal UI or in Rerun, and scores a run against ground truth with ATE and RPE.
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:
StereoViotakes a rectifiedStereoPairand emits aVioPose, the camera in the world, for each solved frame.ImuFeed<N>pushes IMU batches into a sharedVioBusthatStereoVioreads from.- The message types live in
cu-stereo-payloads, so a camera driver can produce them without depending on kornia-slam.
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.