0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

ORB-SLAM2のDockerfileメモ

Last updated at Posted at 2021-05-18

昔書いたDockerfileが出てきたので共有します。

Dockerfile

# FROM nvidia/cuda:10.2-devel-ubuntu18.04
FROM ubuntu:18.04

# timezoneの選択で停止するのを防ぐ
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update \
  && apt-get install -y git

# 必要なパッケージをインストール
RUN apt-get update \
	&& apt-get install -y lsb-release \
	&& apt-get install -y -my wget gnupg

# ROS
ENV APT_KEY_DONT_WARN_ON_DANGEROUS_USAGE=DontWarn
RUN sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list' \
	&& apt-key del F42ED6FBAB17C654 \
	&& apt-key adv --keyserver hkp://ipv4.pool.sks-keyservers.net:80 --recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654 \
	&& apt-get update \
	&& apt-get install -y ros-melodic-desktop-full

RUN apt-get install -y python-rosdep \
	&& rosdep init \
	&& rosdep update \
	&& echo "source /opt/ros/melodic/setup.bash" >> ~/.bashrc \
	&& /bin/bash -c "source ~/.bashrc" \
	&& apt-get install -y python-rosinstall python-rosinstall-generator python-wstool build-essential

# OpenCV
WORKDIR /opt/
# RUN apt autoremove -y libopencv-dev python-opencv
RUN wget https://raw.githubusercontent.com/yakiimo121/milq/master/scripts/bash/install-opencv.sh \
	&& chmod +x install-opencv.sh \
	&& ./install-opencv.sh

# ROS workspace
WORKDIR /opt/catkin_ws/src/
RUN /bin/bash -c "source /opt/ros/melodic/setup.bash && catkin_init_workspace"

WORKDIR /opt/catkin_ws/
RUN /bin/bash -c "source /opt/ros/melodic/setup.bash && catkin_make && source devel/setup.bash"

# # # Pangolin
WORKDIR /opt/catkin_ws/src/
RUN git clone https://github.com/stevenlovegrove/Pangolin.git

WORKDIR /opt/catkin_ws/src/Pangolin/build
RUN apt-get install -y libglew-dev \
	&& cmake .. \
	&& make -j20 \
	&& make install

WORKDIR /opt/catkin_ws/src/
RUN git clone https://github.com/ILab-01/ORB_SLAM2.git

WORKDIR /opt/catkin_ws/src/ORB_SLAM2/
RUN chmod +x build.sh \
	&& ./build.sh

RUN chmod +x build_ros.sh \
	&& /bin/bash -c "source /opt/ros/melodic/setup.bash; ROS_PACKAGE_PATH=/opt/catkin_ws/src/ORB_SLAM2/Examples/ROS:/opt/ros/melodic/share; echo $ROS_PACKAGE_PATH; ./build_ros.sh" 

メモ

本家(https://github.com/raulmur/ORB_SLAM2.git)はビルド時にエラーでこける

error: 'usleep' was not declared in this scope

そこで、修正されたこちら(https://github.com/ILab-01/ORB_SLAM2.git)のリポジトリを使用した。

OpenCVの4系だとエラーが出るのでOpenCVの3.4.1をインストールするスクリプトを用意した
https://raw.githubusercontent.com/yakiimo121/milq/master/scripts/bash/install-opencv.sh

0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?