diff --git a/.dockerignore b/.dockerignore
new file mode 100644
index 00000000..dca6942a
--- /dev/null
+++ b/.dockerignore
@@ -0,0 +1,8 @@
+################################################################################
+# Repo
+
+.git/*
+.dockerignore
+.gitignore
+**Dockerfile
+**.Dockerfile
diff --git a/Dockerfile b/Dockerfile
new file mode 100644
index 00000000..ef58d20e
--- /dev/null
+++ b/Dockerfile
@@ -0,0 +1,174 @@
+ARG FROM_IMAGE=ros:eloquent
+
+# multi-stage for caching
+FROM $FROM_IMAGE AS cache
+
+# clone underlay source
+ENV UNDERLAY_WS /opt/underlay_ws
+RUN mkdir -p $UNDERLAY_WS/src
+WORKDIR $UNDERLAY_WS
+COPY ./install/underlay.repos ./
+RUN vcs import src < underlay.repos
+
+# copy overlay source
+ENV OVERLAY_WS /opt/overlay_ws
+RUN mkdir -p $OVERLAY_WS/src
+WORKDIR $OVERLAY_WS
+COPY ./install/overlay.repos ./
+RUN vcs import src < overlay.repos
+
+# copy ros source
+ENV ROS_WS /opt/ros_ws
+RUN mkdir -p $ROS_WS/src
+WORKDIR $ROS_WS
+# COPY ./ src/Kimera-VIO-ROS
+COPY ./install/ros.repos ./
+RUN vcs import src < ros.repos
+
+# copy manifests for caching
+WORKDIR /opt
+RUN find ./ -name "package.xml" | \
+ xargs cp --parents -t /tmp
+ # && find ./ -name "COLCON_IGNORE" | \
+ # xargs cp --parents -t /tmp
+
+# multi-stage for building
+FROM $FROM_IMAGE AS build
+
+# setup keys
+RUN apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654
+
+# setup sources.list
+RUN echo "deb http://packages.ros.org/ros/ubuntu bionic main" > /etc/apt/sources.list.d/ros1-latest.list
+
+ENV ROS_DISTRO melodic
+# ENV ROS2_DISTRO eloquent
+
+# install CI dependencies
+RUN apt-get update && apt-get install -q -y \
+ ccache \
+ lcov \
+ ros-$ROS_DISTRO-ros-core \
+ && rm -rf /var/lib/apt/lists/*
+
+# install opencv dependencies
+RUN apt-get update && apt-get install -y \
+ gfortran \
+ libatlas-base-dev \
+ libgtk-3-dev \
+ libjpeg-dev \
+ libpng-dev \
+ libtiff-dev \
+ libvtk6-dev \
+ unzip \
+ && rm -rf /var/lib/apt/lists/*
+
+# copy underlay manifests
+ENV UNDERLAY_WS /opt/underlay_ws
+COPY --from=cache /tmp/underlay_ws $UNDERLAY_WS
+WORKDIR $UNDERLAY_WS
+
+# install underlay dependencies
+RUN . /opt/ros/$ROS_DISTRO/setup.sh && \
+ apt-get update && rosdep install -q -y \
+ --from-paths src \
+ --ignore-src \
+ && rm -rf /var/lib/apt/lists/*
+
+# copy underlay source
+COPY --from=cache $UNDERLAY_WS ./
+
+# build underlay source
+ARG UNDERLAY_MIXINS="release"
+RUN . /opt/ros/$ROS_DISTRO/setup.sh && \
+ colcon build \
+ --symlink-install \
+ --mixin $UNDERLAY_MIXINS \
+ --cmake-args \
+ --no-warn-unused-cli \
+ -DGTSAM_BUILD_TESTS=OFF \
+ -DGTSAM_BUILD_EXAMPLES_ALWAYS=OFF \
+ -DGTSAM_BUILD_UNSTABLE=ON \
+ -DGTSAM_POSE3_EXPMAP=ON \
+ -DGTSAM_ROT3_EXPMAP=ON \
+ -DOPENCV_EXTRA_MODULES_PATH=$UNDERLAY_WS/src/opencv/opencv/contrib/modules
+ # --event-handlers console_direct+
+
+# copy overlay manifests
+ENV OVERLAY_WS /opt/overlay_ws
+COPY --from=cache /tmp/overlay_ws $OVERLAY_WS
+WORKDIR $OVERLAY_WS
+
+# install overlay dependencies
+RUN . $UNDERLAY_WS/install/setup.sh && \
+ apt-get update && rosdep install -q -y \
+ --from-paths \
+ src \
+ $UNDERLAY_WS/src \
+ --ignore-src \
+ && rm -rf /var/lib/apt/lists/*
+
+# copy overlay source
+COPY --from=cache $OVERLAY_WS ./
+
+# build overlay source
+ARG OVERLAY_MIXINS="release ccache"
+RUN . $UNDERLAY_WS/install/setup.sh && \
+ colcon build \
+ --symlink-install \
+ --mixin $OVERLAY_MIXINS \
+ --cmake-args \
+ --no-warn-unused-cli \
+ -DCMAKE_CXX_FLAGS="\
+ -Wno-parentheses \
+ -Wno-reorder \
+ -Wno-sign-compare \
+ -Wno-unused-but-set-variable \
+ -Wno-unused-function \
+ -Wno-unused-parameter \
+ -Wno-unused-value \
+ -Wno-unused-variable"
+ # --event-handlers console_direct+
+
+# copy ros manifests
+ENV ROS_WS /opt/ros_ws
+COPY --from=cache /tmp/ros_ws $ROS_WS
+WORKDIR $ROS_WS
+
+# install overlay dependencies
+RUN . $OVERLAY_WS/install/setup.sh && \
+ apt-get update && rosdep install -q -y \
+ --from-paths \
+ src \
+ $UNDERLAY_WS/src \
+ $OVERLAY_WS/src \
+ --ignore-src \
+ --skip-keys "\
+ Boost" \
+ && rm -rf /var/lib/apt/lists/*
+
+# copy overlay source
+COPY --from=cache $ROS_WS ./
+
+# build overlay source
+ARG ROS_MIXINS="release ccache"
+RUN . $OVERLAY_WS/install/setup.sh && \
+ colcon build \
+ --symlink-install \
+ --mixin $ROS_MIXINS \
+ --cmake-args \
+ --no-warn-unused-cli \
+ -DCMAKE_CXX_FLAGS="\
+ -Wno-sign-compare \
+ -Wno-unused-value \
+ -Wno-unused-variable \
+ -Wno-unused-but-set-variable \
+ -Wno-reorder \
+ -Wno-parentheses \
+ -Wno-unused-parameter"
+ # --event-handlers console_direct+
+
+# source overlay from entrypoint
+RUN sed --in-place \
+ 's|^source .*|source "$ROS_WS/install/setup.bash"|' \
+ /ros_entrypoint.sh
\ No newline at end of file
diff --git a/install/overlay.repos b/install/overlay.repos
new file mode 100644
index 00000000..5c111972
--- /dev/null
+++ b/install/overlay.repos
@@ -0,0 +1,13 @@
+repositories:
+ MIT-SPARK/Kimera-RPGO:
+ type: git
+ # url: https://github.com/MIT-SPARK/Kimera-RPGO.git
+ # version: master
+ url: https://github.com/ruffsl/Kimera-RPGO.git
+ version: patch-1
+ MIT-SPARK/Kimera-VIO:
+ type: git
+ # url: https://github.com/MIT-SPARK/Kimera-VIO.git
+ # version: master
+ url: https://github.com/ruffsl/Kimera-VIO.git
+ version: patch-3
diff --git a/install/ros.repos b/install/ros.repos
new file mode 100644
index 00000000..3d4e0a77
--- /dev/null
+++ b/install/ros.repos
@@ -0,0 +1,31 @@
+repositories:
+ MIT-SPARK/Kimera-VIO-ROS:
+ type: git
+ # url: https://github.com/MIT-SPARK/Kimera-VIO-ROS.git
+ # version: master
+ url: https://github.com/ruffsl/Kimera-VIO-ROS.git
+ version: patch-1
+ MIT-SPARK/pose_graph_tools:
+ type: git
+ url: https://github.com/MIT-SPARK/pose_graph_tools.git
+ version: master
+ ToniRV/mesh_rviz_plugins:
+ type: git
+ url: https://github.com/ToniRV/mesh_rviz_plugins.git
+ version: master
+ # url: https://github.com/ruffsl/mesh_rviz_plugins.git
+ # version: patch-1
+ ToniRV/kimera_rviz_markers:
+ type: git
+ url: https://github.com/ToniRV/kimera_rviz_markers.git
+ version: master
+ catkin/catkin_simple:
+ type: git
+ url: https://github.com/catkin/catkin_simple.git
+ version: master
+
+# - git:
+# local-name: cmake_external_project_catkin
+# uri: https://github.com/zurich-eye/cmake_external_project_catkin.git
+# version: master
+
diff --git a/install/underlay.repos b/install/underlay.repos
new file mode 100644
index 00000000..8f8bbc6a
--- /dev/null
+++ b/install/underlay.repos
@@ -0,0 +1,27 @@
+repositories:
+ borglab/gtsam:
+ type: git
+ url: https://github.com/borglab/gtsam.git
+ version: develop
+ laurentkneip/opengv:
+ type: git
+ # url: https://github.com/laurentkneip/opengv.git
+ # version: master
+ url: https://github.com/ruffsl/opengv.git
+ version: patch-1
+ dorian3d/DBoW2:
+ type: git
+ # url: https://github.com/dorian3d/DBoW2.git
+ # version: master
+ url: https://github.com/ruffsl/DBoW2.git
+ version: patch-1
+ opencv/opencv:
+ type: git
+ # url: https://github.com/opencv/opencv.git
+ # version: master
+ url: https://github.com/ruffsl/opencv.git
+ version: patch-1
+ opencv/opencv/contrib:
+ type: git
+ url: https://github.com/opencv/opencv_contrib.git
+ version: 3.3.1
diff --git a/package.xml b/package.xml
index e39e8b72..7d0dc8da 100644
--- a/package.xml
+++ b/package.xml
@@ -15,7 +15,7 @@
- opencv3_catkin
+ libopencv-dev
kimera_vio
roscpp
@@ -29,8 +29,8 @@
tf
pose_graph_tools
- glog_catkin
- gflags_catkin
+ libgflags-dev
+ libgoogle-glog-dev
pcl_ros
pcl_msgs