SLAMBench - nikolaradulov/SLAMFuse GitHub Wiki

1. Prerequisites

1.1 Recommended System:

  • Linux distribution.
  • Windows WSL2. # NEED TO CHANGE THE LINK IF MOVES TO PAMELA-PROJECT

1.2 Docker

Install Docker Engine. If you are using Windows10 WSL2, you can EITHER install Docker Desktop OR run following command:

$ curl -fsSL https://get.docker.com -o get-docker.sh
$ sudo sh get-docker.sh
$ sudo service docker start
$ sudo chmod 777 /var/run/docker.sock

2. Start with Docker

2.1 Build SLAMBench

make sure you are using SLAMBench-conteinarisation branch

$ sudo apt-get install git
$ git clone --branch SLAMBench-conteinarisation https://github.com/nikolaradulov/slambench.git slambench # NEED TO CHANGE THE LINK IF MOVES TO PAMELA-PROJECT
$ cd ~/slambench/
$ docker build . -t slambench/main

2.2 Build Algorithm

$ cd ~/slambench/
$ ./scripts/algorithm-vol.sh [algorithm name]
$ ./scripts/algorithm-vol.sh floam

Replace [algorithm name] by kfusion, orbslam3, floam, etc. Now you have:

  • Docker IMAGE: [algorithm name]-img
  • Docker CONTAINER: [algorithm name]
  • Docker VOLUME: [algorithm name]-vol

The [algorithm name]-vol contains all the necessary components for evaluating algorithm on SLAMBench. Hints: If Docker images takes too much memory and you already have [algorithm name]-vol, you can use docker rm [algorithm name], docker rmi [algorithm name]-img and docker system prune to free memory.

2.3 Build dataset

$ python3 starter.py dataset -t make -d ./datasets/KITTI/2011_09_30_drive_0027/2011_09_30_drive_0027_sync.slam -v KITTI07

check ~/slambench/datasets/command.txt for more details.

2.4 Run Algorithm

$ python3 starter.py run -t gui -dv KITTI07 -d 2011_09_30_drive_0027_sync.slam -a floam/libfloam-original-library.so

If you want to have more control of the filesystem, then you will need -t interactive-gui, it allows you to modify the configuration file, visualize results, and so on.

$ python3 starter.py run -t interactive-gui -dv KITTI07 -d 2011_09_30_drive_0027_sync.slam -a floam/libfloam-original-library.so

then follows the instructions after section 3.5 to run the algorithms.

3. Build SLAMBench without Docker (OPTIONAL)

If you are using Ubuntu-20.04, you can skip the process of building SLAMBench Container and Dataset Volume, and build SLAMBench on your local machine instead. However, you do need docker to build algorithms.

3.1 Build SLAMBench

$ sudo apt-get -y install libvtk6.3 libvtk6-dev unzip libflann-dev wget mercurial git gcc g++ cmake python-numpy freeglut3 freeglut3-dev libglew-dev libglu1-mesa libglu1-mesa-dev libgl1-mesa-glx libgl1-mesa-dev libxmu-dev libxi-dev libboost-all-dev cvs libgoogle-glog-dev libatlas-base-dev gfortran gtk2.0 libgtk2.0-dev libyaml-dev build-essential libyaml-cpp-dev
$ cd /path/to/slambench
$ make eigen3
$ make flann
$ make pangolin
$ make pcl
$ make opencv
$ make slambench

3.2 Build Dataset

$ make ./datasets/KITTI/2011_09_30_drive_0027/2011_09_30_drive_0027_sync.slam

3.3 Build Algorithm

$ cd ~/slambench/
$ cp ./build/lib/libslambench-c-wrapper.a .
$ ./scripts/algorithm-vol.sh [algorithm name]

Replace [algorithm name] by kfusion, lsdslam, orbslam2, orbslam3, openvins, aloam, floam, legoloam.

3.4 Copy Dependencies and Libraries

$ sudo mkdir /deps
$ sudo docker cp [algorithm name]:/deps/[algorithm name]/ /deps/[algorithm name]/

The first [algorithm name] specifies the container name. The last /deps/[algorithm name]/ specifies the destination of copy, you can replace it with you customized path. After these instructions, you will have:

├── deps
│   ├── [algorithm name]
│   |   ├── wrapper
│   |   ├── lib      # this directory contains libraries of the algorithm that are needed by SLAMBench (ie. liblegoloam-original-library.so)
│   |   ├── [dep 1]
│   |   ├── [dep 2]

Hints: If Docker images takes too much memory, use docker rm [algorithm name], docker volume rm [algorithm name], docker rmi [algorithm name]-img and docker system prune to free memory.

3.5 Modify configuration file (OPTIONAL)

For some algorithms, like aloam and legoloam, you will have extra configs directory which contains configs.yaml. It allows user to customize the configuration for different dataset without re-compile the algorithm. To modify it:

$ sudo nano /deps/[algorithm name]/configs/configs.yaml

Use Ctrl + O then Enter to save the file. Use Ctrl + X to exit Nano.

3.6 Run the algorithm

$ cd /path/to/slambench
$ ./build/bin/slambench -i ./datasets/KITTI/2011_09_30_drive_0027/2011_09_30_drive_0027_sync.slam -load /deps/floam/lib/libfloam-original-library.so --gui true

Add -h or --help to list parameters, for example, you can use -configs or --configuration to specify the path to your own configuration file in A-LOAM and F-LOAM.

4. Visualize Experiment Results

4.1 Save results

To save the result you would need --log-file [filename] or -o [filename] and --save-groundtruth [filename] or -sgt [filename] , for exmaple, -o ./results/log_files/F-LOAM_KITTI07.txt -sgt ./results/groundtruth/KITTI07.txt, you need a _ in the log filename, as the string before the first _ will be used as a label in visualization.

$ cd /path/to/slambench
$ ./build/bin/slambench -i ./datasets/KITTI/2011_09_30_drive_0027/2011_09_30_drive_0027_sync.slam -load /deps/floam/lib/libfloam-original-library.so --gui true --log-file ./results/log_files/F-LOAM_KITTI07.txt --save-groundtruth ./results/groundtruth/KITTI07.txt

4.2 Visualize results

$ sudo apt-get install python3-pip
$ pip install matplotlib
$ pip install scipy
$ python3 ./scripts/visualize.py -gt ./results/groundtruth/KITTI07.txt -a ./results/log_files/F-LOAM_KITTI07.txt ./results/log_files/A-LOAM_KITTI07.txt -o ./results/experiments/exp1/ -plt

-gt: specify the file of groundtruth you saved (optional) -a: specify log files of algorithms (required) -o: specify output folder (required if -plt is not enabled) -plt: plot the figure or not (required if -o is not enabled)