Skip to content

Commit

Permalink
Merge pull request raulmur#2 from monoDriveIO/dockerize
Browse files Browse the repository at this point in the history
Dockerize
  • Loading branch information
devinaconley committed Jul 19, 2019
2 parents 03d570a + 8008334 commit 51ac1e0
Show file tree
Hide file tree
Showing 2 changed files with 90 additions and 4 deletions.
86 changes: 86 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
# docker image to run ORB-SLAM2
FROM ubuntu:18.04
MAINTAINER devin@monodrive.io

# setup
ENV BASE_DIR /home/vo
ENV DEBIAN_FRONTEND noninteractive
WORKDIR ${BASE_DIR}
RUN apt-get update && apt-get upgrade -y
RUN apt-get install -y \
git \
wget

# c++
RUN apt-get install -y \
build-essential \
gcc \
cmake

# pangolin
RUN apt-get install -y \
libgl1-mesa-dev \
libglew-dev

RUN git clone https://github.com/stevenlovegrove/Pangolin.git ${BASE_DIR}/pangolin
WORKDIR ${BASE_DIR}/pangolin/build
RUN cmake .. -DCMAKE_BUILD_TYPE=Release
RUN cmake --build . -- -j8

# opencv
RUN apt-get install -y \
pkg-config \
libgtk2.0-dev \
libavcodec-dev \
libavformat-dev \
libswscale-dev

RUN git clone https://github.com/opencv/opencv.git --branch 3.2.0 --depth 1 ${BASE_DIR}/opencv
WORKDIR ${BASE_DIR}/opencv/build
RUN cmake .. -DCMAKE_BUILD_TYPE=Release
RUN make -j8
RUN make install

# eigen
WORKDIR ${BASE_DIR}/dump
RUN wget http://bitbucket.org/eigen/eigen/get/3.3.7.tar.gz
RUN tar -xzf 3.3.7.tar.gz
RUN mv eigen-eigen-323c052e1731 /usr/local/include/eigen

# orb-slam2
COPY Thirdparty ${BASE_DIR}/orbslam2/Thirdparty
COPY Vocabulary ${BASE_DIR}/orbslam2/Vocabulary
COPY cmake_modules ${BASE_DIR}/orbslam2/cmake_modules
COPY include ${BASE_DIR}/orbslam2/include

COPY CMakeLists.txt ${BASE_DIR}/orbslam2/CMakeLists.txt

# orb-slam2 // dbow2
WORKDIR ${BASE_DIR}/orbslam2/Thirdparty/DBoW2/build
RUN cmake .. -DCMAKE_BUILD_TYPE=Release
RUN make -j8

# orb-slam2 // g2o
WORKDIR ${BASE_DIR}/orbslam2/Thirdparty/g2o/build
RUN cmake .. -DCMAKE_BUILD_TYPE=Release
RUN make -j8

# orb-slam2 // vocab
WORKDIR ${BASE_DIR}/orbslam2/Vocabulary
RUN tar -xf ORBvoc.txt.tar.gz

# orb-slam // source
COPY src ${BASE_DIR}/orbslam2/src
COPY Examples ${BASE_DIR}/orbslam2/Examples

# orb-slam2 // build
WORKDIR ${BASE_DIR}/orbslam2/build
RUN cmake .. -DCMAKE_BUILD_TYPE=Release
RUN make -j8

# add etc files (these will need to be placed before building)
ADD ./etc ${BASE_DIR}/etc

# runtime
WORKDIR ${BASE_DIR}
CMD ./orbslam2/Examples/Monocular/mono_kitti orbslam2/Vocabulary/ORBvoc.txt etc/monoDrive.yaml workspace/kitti/dataset/sequences/00 workspace/orbslam2/keyframes.txt
8 changes: 4 additions & 4 deletions Examples/Monocular/mono_kitti.cc
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@ void LoadImages(const string &strSequence, vector<string> &vstrImageFilenames,

int main(int argc, char **argv)
{
if(argc != 4)
if(argc != 5)
{
cerr << endl << "Usage: ./mono_kitti path_to_vocabulary path_to_settings path_to_sequence" << endl;
cerr << endl << "Usage: ./mono_kitti path_to_vocabulary path_to_settings path_to_sequence path_to_output_file" << endl;
return 1;
}

Expand All @@ -50,7 +50,7 @@ int main(int argc, char **argv)
int nImages = vstrImageFilenames.size();

// Create SLAM system. It initializes all system threads and gets ready to process frames.
ORB_SLAM2::System SLAM(argv[1],argv[2],ORB_SLAM2::System::MONOCULAR,true);
ORB_SLAM2::System SLAM(argv[1],argv[2],ORB_SLAM2::System::MONOCULAR,false);

// Vector for tracking time statistics
vector<float> vTimesTrack;
Expand Down Expand Up @@ -119,7 +119,7 @@ int main(int argc, char **argv)
cout << "mean tracking time: " << totaltime/nImages << endl;

// Save camera trajectory
SLAM.SaveKeyFrameTrajectoryTUM("KeyFrameTrajectory.txt");
SLAM.SaveKeyFrameTrajectoryTUM(argv[4]);

return 0;
}
Expand Down

0 comments on commit 51ac1e0

Please sign in to comment.