Tested on Mac, Ubuntu 14.04, 16.04 & 18.04.
If you want to avoid building all these dependencies yourself, we provide two options:
-
Docker image: that will install them for you. See section From Dockerfile below.
-
Catkin: if you use ROS, then Kimera-VIO-ROS can install all dependencies and Kimera inside a catkin workspace. Follow the instructions in there.
We recommend using the docker image for a quick demo, and catkin for actual development. Alternatively, you may install the dependencies and Kimera from "source" as detailed below:
-
Third-party dependencies:
Installation instructions below.
First, update package list: sudo apt-get update
- Build dependencies:
sudo apt-get install -y --no-install-recommends apt-utils
sudo apt-get install -y cmake
- Gtsam dependencies:
sudo apt-get install -y libboost-all-dev
- OpenCV dependencies:
- on Mac:
homebrew install vtk # (to check)
- On Ubuntu 18.04
# (libvtk5-dev, libgtk2.0-dev in ubuntu 16.04)
sudo apt-get install -y \
build-essential unzip pkg-config \
libjpeg-dev libpng-dev libtiff-dev \
libvtk6-dev \
libgtk-3-dev \
libparmetis-dev \
libatlas-base-dev gfortran
Install Intel Threaded Building Blocks (TBB): sudo apt-get install libtbb-dev
Clone GTSAM: git clone [email protected]:borglab/gtsam.git
(last tested with commit
ee069286b447ff58b809423cc77c777a02abdfe5
) Previously tested commits:0c3e05f375c03c5ff5218e708db416b38f4113c8
Make build dir, and run cmake
:
cd gtsam
mkdir build
cd build
cmake -DCMAKE_INSTALL_PREFIX=/usr/local -DCMAKE_BUILD_TYPE=Release -DGTSAM_USE_SYSTEM_EIGEN=OFF -DGTSAM_POSE3_EXPMAP=ON -DGTSAM_ROT3_EXPMAP=ON ..
Ensure that:
- TBB is enabled: check for
-- Use Intel TBB : Yes
after runningcmake
. - Compilation is in Release mode: check for
-- Build type : Release
after runningcmake
. - Use GTSAM's Eigen, not the system-wide one (OpenGV and GTSAM must use same Eigen, see OpenGV install instructions below).
Rot3 retract is full ExpMap
is set to enabled, andPose3 retract is full ExpMap
is also set to enabled. Without these flags, Kimera-RPGO does not optimize the pose-graph well and may produce incorrect results.
Compile and install GTSAM:
make -j $(nproc) check # (optional, runs unit tests)
sudo make -j $(nproc) install
Alternatively, replace
$(nproc)
by the number of available cores in your computer.
Note 1a: if you use MKL in gtsam, you may need to add to
~/.bashrc
a line similar to:source /opt/intel/parallel_studio_xe_2018/compilers_and_libraries_2018/linux/mkl/bin/mklvars.sh intel64
(Alternatively, typelocate compilervars.sh
and thensource $output file.sh that you got from locate$
, add to your .bashrc to automate).
Note 1b: sometimes you may need to add
/usr/local/lib
toLD_LIBRARY_PATH
in~/.bashrc
(if you get lib not found errors at run or test time).
Note: we are considering to enable EPI in GTSAM, which will require to set the GTSAM_THROW_CHEIRALITY_EXCEPTION to false (cmake flag).
Note: for better performance when using the IMU factors, set GTSAM_TANGENT_PREINTEGRATION to 'false' (cmake flag)
Note: also enable the
GTSAM_BUILD_WITH_MARCH_NATIVE
compile option for max performance (at the expense of the portability of your executable). Check install gtsam for more details. Note that for some systems,MARCH_NATIVE
might cause problems that culminates in the form of segfaults when you run the unittests. If you do wish to use this flag, simply add-DGTSAM_BUILD_WITH_MARCH_NATIVE=On
to the flags on thecmake
command. Note that sometimes, the flag it is enabled by default.
Download OpenCV and run cmake:
git clone https://github.com/opencv/opencv.git
cd opencv
git checkout tags/3.3.1
mkdir build
cd build
cmake -DWITH_VTK=On .. # Use -DWITH_TBB=On if you have TBB
Finally, build and install OpenCV:
sudo make -j $(nproc) install
Alternatively, replace
$(nproc)
by the number of available cores in your computer.
Clone the repo:
git clone https://github.com/laurentkneip/opengv.git
Set opengv to use the same Eigen version than GTSAM (for example: $HOME/gtsam/gtsam/3rdparty/Eigen
), by modifying the cmake flags EIGEN_INCLUDE_DIR
and EIGEN_INCLUDE_DIRS
. If you don't do so, errors may appear (maybe due to GTSAM and OpenGV using different versions of Eigen!) Note that if using cmake-gui
to modify paths, make sure you tick the Advanced
box so that both flags are visible:
cd opengv
mkdir build
cd build
# Replace path to your GTSAM's Eigen
cmake .. -DEIGEN_INCLUDE_DIR=/home/tonirv/Code/gtsam/gtsam/3rdparty/Eigen -DEIGEN_INCLUDE_DIRS=/home/tonirv/Code/gtsam/gtsam/3rdparty/Eigen
Finally, install opengv:
sudo make -j $(nproc) install
Alternatively, replace
$(nproc)
by the number of available cores in your computer.
Clone the repo and run cmake:
git clone https://github.com/dorian3d/DBoW2.git
cd DBoW2
mkdir build
cd build
cmake ..
sudo make -j $(nproc) install
Clone the repo and run cmake:
git clone https://github.com/MIT-SPARK/Kimera-RPGO.git
cd Kimera-RPGO
mkdir build
cd build
cmake ..
sudo make -j $(nproc)
Linux
sudo apt-get install libgflags-dev libgoogle-glog-dev
MacOS
brew install gflags glog
Gtest will be automatically downloaded using cmake.
For loop closure detection, we use a bag-of-words method based on DBoW2. This requires a vocabulary of visual words. If you wish to use the loop closure detection module, you must download a vocabulary file.
We have packaged a large vocabulary made by the creators of ORB_SLAM_2 along with their license at this location. Follow that link to download the files, and put them in the vocabulary directory.
Alternatively, cmake will automatically download these files for you when you make
Kimera-VIO. Follow the instructions below:
Before proceeding, ensure all dependencies are installed or use the provided dockerfile.
Clone this repository:
git clone [email protected]:MIT-SPARK/Kimera-VIO.git Kimera-VIO
Build Kimera-VIO
cd Kimera-VIO
mkdir build
cd build
cmake ..
make -j $(nproc)
Alternatively, replace '$(nproc)' by the number of available cores in your computer.
If you want to avoid building all these dependencies yourself, we provide a docker image that will install all dependencies for you. For that, you will need to install Docker.
Once installed, clone this repo, build the image and run it:
# Clone the repo
git clone [email protected]:MIT-SPARK/Kimera-VIO.git Kimera-VIO
# Build the image
cd Kimera-VIO
docker build --rm -t kimera_vio -f ./scripts/docker/Dockerfile .
This may take a while (>15min), so you can go and grab a cup of coffee.
Once done, you can run the kimera_vio_docker.bash
:
# Run an example dataset
./scripts/docker/kimera_vio_docker.bash