FPGA-accelerated ORB front-end and stereo depth for ORB-SLAM2 on the Xilinx Kria KV260, derived from the open-source acSLAM project and adapted to the KV260 platform. The design implements a resize + FAST pipeline in PL (ORB front-end) and a Semi-Global Matching (SGM) stereo accelerator, driven from Linux on the KV260 via AXI DMA. Software integrates with ORB-SLAM2 to offload feature extraction and stereo processing.
This repository is the submission package for the FPT’25 Design Competition — SLAM Algorithm FPGA Acceleration and Optimization Track.
Our result: 3rd Place in the SLAM track.
- ORB front-end: accelerates ORB feature extraction (resize + FAST) on KV260 PL.
- Data path: PS → AXI DMA (MM2S) →
resize→FAST_extractor→ AXI DMA (S2MM) → PS. - Two AXI DMAs: one config-only stream (MM2S), one data stream (MM2S + S2MM).
- Data path: PS → AXI DMA (MM2S) →
- Stereo SGM: dense disparity accelerator for KITTI / USB camera stereo pipelines.
- Software paths: Python via PYNQ (notebook) or C++ via CYNQ; full ORB_SLAM2 integration provided.
code/HW— HLS / Vitis HLS sources and scriptscode/HW/hls/resize— resize + config fan-out HLS IP.code/HW/hls/FAST_extractor— FAST detector HLS IP.code/HW/hls/sgm— SGM accelerator for KITTI stereo (semiglobalbm_accel).code/HW/hls/sgm_usbcam— SGM accelerator variant for USB camera stereo (semiglobalbm_accel_usbcam).
code/SW— Softwarecode/SW/ORB_SLAM2_FPGA— ORB‑SLAM2 integration (CMake, examples, config).code/SW/cynq— CYNQ C++ framework (docs) used by the integration.code/SW/cynq_test— Low-level CYNQ demos and docs (e.g.,orb_cynq_demo.cpp,orb_cynq_demo.md).code/SW/pynq_test— Minimal PYNQ notebook test (ORB.ipynb, sample image).
code/Vivado— Vivado block design scripts, projects and bitstreamscode/Vivado/kv260_mono.tcl— mono ORB front-end design.code/Vivado/kv260_stereo_kitti.tcl— stereo KITTI design with SGM.code/Vivado/kv260_stereo_usbcam.tcl— stereo USB camera design with SGM.code/Vivado/Bitstreams/— built bitstreams and.hwhfiles (e.g.mono_kitti.bit,stereo_kitti-108-3.bit,stereo_usbcam.bit).
verification_evo— Trajectory evaluation toolkit (vendored evo)- Local copy of the evo toolkit (APE/RPE) with helpers under
verification_evo/contrib. - Example (APE, TUM format):
python3 verification_evo/evo/main_ape.py tum code/SW/ORB_SLAM2_FPGA/KeyFrameMono/KeyFrameTrajectory04.txt /path/to/kitti_gt_folder/kitti_04_gt.txt -as -p
- Batch helpers: see
verification_evo/contrib/batching_evo.shand utilities for KITTI conversions.
- Local copy of the evo toolkit (APE/RPE) with helpers under
- Resource Utilization
| Utilization | Available | Utilization % | |
|---|---|---|---|
| CLB LUTs | 74364 | 117120 | 63.49% |
| FF | 54597 | 234240 | 23.31% |
| BRAM | 138.5 | 114 | 96.18% |
| DSP | 245 | 1248 | 19.63% |
- End-to-end SLAM performance (on sequence 04, without GUI)
- KITTI Monocular: 10.8 FPS
- KITTI Stereo: 2.10 FPS
- Vivado Design Suite 2024.2.2
- Board: Xilinx Kria KV260 (xck26-sfvc784-2LV-c) running Ubuntu 22.04
- Libraries for ORB_SLAM2: Pangolin, OpenCV (Tested on 4.5.4), Eigen3.
- CYNQ installed (Tested on commit 39f0acc) and discoverable via pkg-config (
pkg-config --cflags --libs cynq). - Optional: PYNQ.
- Clone with submodules:
git clone --recursive https://github.com/BJUT-CS316-LAB/RoSE-SLAM.git(needed forcode/SW/cynqandcode/HW/hls/sgm/Vitis_Libraries; if already cloned rungit submodule update --init --recursive).
- Download data_odometry_gray.zip from: https://www.cvlibs.net/datasets/kitti/eval_odometry.php
- Unzip:
unzip data_odometry_gray.zip -d ~/KITTI
- Set your data root to the sequences directory:
~/KITTI/data_odometry_gray/sequences/(contains00/,01/, ...)- If using
run_kitti.sh: setDATA_ROOTto that path (or pass--data-root).
-
Step 1 — Rebuild HLS IP in
code/HW/hls- Open Vivado HLS shell and run:
cd code/HW/hls/resize && vitis_hls -f script.tclcd ../FAST_extractor && vitis_hls -f script.tclcd ../sgm && vitis_hls -f script.tclcd ../sgm_usbcam && vitis_hls -f script.tcl
- The scripts target KV260 and export IP to the Vivado IP catalog (see
code/HW/README.mdfor details and Vitis Vision / OpenCV requirements for SGM).
- Open Vivado HLS shell and run:
-
Step 2 — Rebuild Vivado projects in
code/Vivado- Open a Vivado 2024.2 Tcl shell and run:
cd code/Vivado- Mono ORB front-end:
vivado -mode batch -source kv260_mono.tcl
- Stereo KITTI (default design used by
ORB_SLAM2_FPGA):vivado -mode batch -source kv260_stereo_kitti.tcl
- Stereo USB camera:
vivado -mode batch -source kv260_stereo_usbcam.tcl
- Each script creates a project (
mono_proj,stereo_kitti_proj, orstereo_usbcam_proj) with block designdesign_1. Generate the bitstream in Vivado (GUI or Tcl, e.g.launch_runs impl_1 -to_step write_bitstreamon the generated wrapper). - Copy the resulting bitstreams (
.bit/.hwh, e.g.design_1_wrapper.bit) intocode/Vivado/Bitstreams/and/or update software config to point to the desired path.
- Open a Vivado 2024.2 Tcl shell and run:
-
Option A — Quick PYNQ notebook test
- Copy your desired bitstream (for example
code/Vivado/Bitstreams/mono_kitti.bit(.hwh)orstereo_kitti-108-3.bit(.hwh)) next to the notebook or update the path inside it. - Open and run
code/SW/pynq_test/ORB.ipynbon the KV260 to program PL and test with000000.png.
- Copy your desired bitstream (for example
-
Option B — Low-level CYNQ demo (single image test)
- Build:
cd code/SW/cynq_test/ && g++ -O3 -std=c++17 orb_cynq_demo.cpp -o orb_cynq_demo.run $(pkg-config --cflags --libs opencv4 cynq) - Run (example, mono ORB front-end):
sudo ./orb_cynq_demo.run ../../Vivado/Bitstreams/mono_kitti.bit ./000000.png - The demo programs the bitstream via FPGA Manager and reports detected keypoints and timings.
- Build:
-
Option C — ORB_SLAM2 with FPGA front-end
- Install dependencies (OpenCV, Pangolin, Eigen3).
- Build:
cd code/SW/ORB_SLAM2_FPGA./build.sh
- Example (KITTI, Monocular):
./Examples/Monocular/mono_kitti.run Vocabulary/ORBvoc.bin Examples/Monocular/KITTI04-12.yaml /path/to/KITTI/sequences/04/
- Example (KITTI, Stereo):
./Examples/Stereo/stereo_kitti.run Vocabulary/ORBvoc.bin Examples/Stereo/KITTI04-12.yaml /path/to/KITTI/sequences/04/
- Helper:
code/SW/ORB_SLAM2_FPGA/run_kitti.shbatches multiple sequences and renames outputs.
- Default bitstream path used by the ORB‑SLAM2 integration is configured in
code/SW/ORB_SLAM2_FPGA/fpga_config.yaml(keyFPGA.BitstreamPath). The repository default points to the stereo KITTI design:../../Vivado/Bitstreams/stereo_kitti-108-3.bit
- You can override the config file location by setting the
ORB_FPGA_CONFIGenvironment variable when launching the ORB_SLAM2 binaries, or by editingfpga_config.yamldirectly. - If the KV260 has no display, disable the viewer when building/running ORB_SLAM2.
-
Install
evoin your verification environment:pip install evo
-
Monocular (TUM-formatted trajectories):
- Use
tummode when your trajectory is already in TUM format (time tx ty tz qx qy qz qw). - Single-run APE (example, save xz plot):
evo_ape tum ./KeyFrame/KeyFrameTrajectory04.txt ./kitti_gt_folder/kitti_04_gt.txt -as --plot_mode xz --save_plot results_mono/track_map_mono/xz/traj_mono_xz_04.png
- Single-run RPE (example, save xz plot):
evo_rpe tum ./KeyFrame/KeyFrameTrajectory04.txt ./kitti_gt_folder/kitti_04_gt.txt -as --plot_mode xz --save_plot results_mono/track_map_mono/xz/traj_mono_rpe_xz_04.png
- To generate additional projections, change
--plot_modetoxyoryz(the repository batch helper createsxz/,xy/,yz/folders). - Batch helper (process sequences 00..10):
cd verification_evo/contrib && ./batching_evo_KITTI_mono.sh
- Use
-
Stereo (KITTI-formatted keyframe poses / 3x4 ground truth):
- Use
kittimode when keyframe/ground-truth files are KITTI 3x4 poses (no TUM timestamps). - Single-run APE (example, save xz plot):
evo_ape kitti ./KeyFrameStereo/CameraTrajectory04.txt ./real/04.txt -as --plot_mode xz --save_plot results_stereo/track_map_stereo/xz/traj_stereo_xz_04.png
- Single-run RPE (example, save xz plot):
evo_rpe kitti ./KeyFrameStereo/CameraTrajectory04.txt ./real/04.txt -as --plot_mode xz --save_plot results_stereo/track_map_stereo/xz/traj_stereo_rpe_xz_04.png
- To generate additional projections, change
--plot_modetoxyoryz(batch helper saves all three projections toxz/,xy/,yz/). - Batch helper (process sequences 00..10):
cd verification_evo/contrib && ./batching_evo_KITTI_stereo.sh
- Use
-
Notes:
- The batch helpers save APE/RPE numeric summaries to
results_mono/APE_RPE_results_kitti_mode_mono.txtandresults_stereo/APE_RPE_results_kitti_mode_stereo.txtrespectively. - If your monocular output is in KITTI format (3x4), convert it to TUM before using
tummode; the mono batch script will call the converter when needed. --plot_modechoices:xz,xy,yz. Use--save_plot <file>to write the plot image to disk.
- The batch helpers save APE/RPE numeric summaries to