Skip to content

Commit a6e6465

Browse files
committed
add container for elastic_fusion
1 parent 125469a commit a6e6465

File tree

5 files changed

+676
-0
lines changed

5 files changed

+676
-0
lines changed

elastic_fusion/.zshrc

+54
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
# Enable Powerlevel10k instant prompt. Should stay close to the top of ~/.zshrc.
2+
# Initialization code that may require console input (password prompts, [y/n]
3+
# confirmations, etc.) must go above this block, everything else may go below.
4+
if [[ -r "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" ]]; then
5+
source "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh"
6+
fi
7+
8+
# If you come from bash you might have to change your $PATH.
9+
# export PATH=$HOME/bin:/usr/local/bin:$PATH
10+
11+
# Path to your oh-my-zsh installation.
12+
export ZSH=$HOME/.oh-my-zsh
13+
14+
# Set name of the theme to load --- if set to "random", it will
15+
# load a random theme each time oh-my-zsh is loaded, in which case,
16+
# to know which specific one was loaded, run: echo $RANDOM_THEME
17+
# See https://github.com/ohmyzsh/ohmyzsh/wiki/Themes
18+
19+
ZSH_THEME="powerlevel10k/powerlevel10k"
20+
21+
# Which plugins would you like to load?
22+
# Standard plugins can be found in ~/.oh-my-zsh/plugins/*
23+
# Custom plugins may be added to ~/.oh-my-zsh/custom/plugins/
24+
# Example format: plugins=(rails git textmate ruby lighthouse)
25+
# Add wisely, as too many plugins slow down shell startup.
26+
27+
plugins=(git cp z cp extract history colorize command-not-found sudo zsh-autosuggestions zsh-syntax-highlighting)
28+
29+
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(user anaconda dir)
30+
POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=(nvm pyenv time)
31+
POWERLEVEL9K_DISABLE_GITSTATUS=true
32+
33+
source $ZSH/oh-my-zsh.sh
34+
35+
# User configuration
36+
37+
export SSH_KEY_PATH="~/.ssh/rsa_id"
38+
39+
# Set personal aliases, overriding those provided by oh-my-zsh libs,
40+
# plugins, and themes. Aliases can be placed here, though oh-my-zsh
41+
# users are encouraged to define aliases within the ZSH_CUSTOM folder.
42+
# For a full list of active aliases, run `alias`.
43+
44+
45+
alias ll='ls -alF'
46+
alias la='ls -A'
47+
alias l='ls -CF'
48+
49+
# To customize prompt, run `p10k configure` or edit ~/.p10k.zsh.
50+
[[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh
51+
source ~/.oh-my-zsh/custom/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
52+
source /opt/ros/noetic/setup.zsh
53+
source ~/ws/cassie_ros/catkin_ws/devel/setup.zsh
54+
source /opt/intel/bin/compilervars.sh intel64

elastic_fusion/Dockerfile

+143
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,143 @@
1+
FROM nvidia/cudagl:11.4.2-devel-ubuntu20.04
2+
LABEL org.opencontainers.image.authors="[email protected]"
3+
LABEL description="Container for Elastic Bridge (ROS wrapper for ElasticFusion)"
4+
LABEL version="0.1"
5+
6+
ENV DEBIAN_FRONTEND noninteractive
7+
RUN apt-get update \
8+
&& DEBIAN_FRONTEND=noninteractive apt-get install -y locales \
9+
&& sed -i -e 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen \
10+
&& dpkg-reconfigure --frontend=noninteractive locales \
11+
&& update-locale LANG=en_US.UTF-8
12+
13+
# nvidia-container-runtime
14+
ENV NVIDIA_VISIBLE_DEVICES \
15+
${NVIDIA_VISIBLE_DEVICES:-all}
16+
ENV NVIDIA_DRIVER_CAPABILITIES \
17+
${NVIDIA_DRIVER_CAPABILITIES:+$NVIDIA_DRIVER_CAPABILITIES,}graphics,compute,utility,display
18+
19+
20+
# install libraries and tools
21+
RUN apt-get update && apt-get install -y --no-install-recommends \
22+
sudo \
23+
dialog \
24+
apt-utils \
25+
git \
26+
mercurial \
27+
pkg-config \
28+
mesa-utils \
29+
libxau-dev \
30+
libxdmcp-dev \
31+
libxcb1-dev \
32+
libxext-dev \
33+
libx11-dev \
34+
git \
35+
tmux \
36+
wget \
37+
curl \
38+
cmake \
39+
vim \
40+
build-essential \
41+
unzip \
42+
autoconf \
43+
autogen \
44+
automake \
45+
libtool \
46+
mlocate \
47+
zlib1g-dev \
48+
libopenblas-dev \
49+
libflann-dev \
50+
libpcl-dev \
51+
libboost-all-dev \
52+
libsuitesparse-dev \
53+
libtbb-dev \
54+
libusb-1.0-0-dev \
55+
libgtest-dev \
56+
pkg-config \
57+
cmake-curses-gui \
58+
gdb \
59+
clang \
60+
emacs \
61+
libpcap-dev \
62+
gnupg2 \
63+
x11-xserver-utils \
64+
lsb-release \
65+
tilix \
66+
&& apt clean \
67+
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
68+
69+
# install ROS
70+
RUN sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list'
71+
72+
RUN apt-key adv --keyserver 'hkp://keyserver.ubuntu.com:80' --recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654
73+
74+
RUN apt-get update
75+
76+
RUN apt-get install -y --no-install-recommends ros-noetic-desktop-full
77+
78+
# install zsh
79+
RUN git clone https://github.com/tccoin/easy-linux.git /root/easy-linux \
80+
&& cd /root/easy-linux \
81+
&& bash zsh.sh \
82+
&& touch /root/.z \
83+
&& rm -r /root/easy-linux
84+
85+
# install gitstatus
86+
# https://github.com/romkatv/gitstatus/releases/tag/v1.3.1
87+
RUN mkdir -p /root/.cache/gitstatus \
88+
&& wget https://github.com/romkatv/gitstatus/releases/download/v1.5.1/gitstatusd-linux-x86_64.tar.gz -O - \
89+
| tar -zx -C /root/.cache/gitstatus/
90+
91+
# install slam libraries
92+
93+
RUN sudo apt install libpcl-dev
94+
95+
RUN mkdir /root/elstic_ws/src -p
96+
WORKDIR /root/elstic_ws/src
97+
98+
# Download libraries
99+
RUN git clone https://github.com/RMonica/elastic_bridge.git \
100+
&& git clone https://github.com/RMonica/init_fake_opengl_context.git \
101+
&& git clone https://github.com/mp3guy/ElasticFusion.git elastic_bridge/deps/ElasticFusion
102+
103+
# Compile ElasticFusion Core module
104+
## Update cmake
105+
RUN sudo apt-get install -y --no-install-recommends software-properties-common \
106+
&& wget -O - https://apt.kitware.com/keys/kitware-archive-latest.asc 2>/dev/null | sudo apt-key add - \
107+
&& sudo apt-add-repository 'deb https://apt.kitware.com/ubuntu/ bionic main' \
108+
&& sudo apt-get update \
109+
&& sudo apt-get install -y --no-install-recommends cmake
110+
111+
## Compile dependencies
112+
RUN cd /root/elstic_ws/src/elastic_bridge/deps/ElasticFusion/ \
113+
&& git submodule update --init \
114+
&& cd third-party/Pangolin/ \
115+
&& mkdir build \
116+
&& cd build \
117+
&& cmake .. -DEIGEN_INCLUDE_DIR=/root/elstic_ws/src/elastic_bridge/deps/ElasticFusion/third-party/Eigen/ -DBUILD_PANGOLIN_PYTHON=false \
118+
&& make -j8
119+
120+
121+
RUN sudo apt-get install -y --no-install-recommends cmake-qt-gui git build-essential libusb-1.0-0-dev libudev-dev openjdk-11-jdk freeglut3-dev libglew-dev libsuitesparse-dev zlib1g-dev libjpeg-dev \
122+
&& cd /root/elstic_ws/src/elastic_bridge/deps/ElasticFusion/third-party/OpenNI2/ \
123+
&& make -j8
124+
125+
## Install CUDA
126+
# RUN sudo DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends cuda
127+
128+
## Compile elastic fusion
129+
RUN cd /root/elstic_ws/src/elastic_bridge/deps/ElasticFusion/ \
130+
&& mkdir build \
131+
&& cd build \
132+
&& cmake .. \
133+
&& make -j8
134+
135+
# Compile the package
136+
RUN cd /root/elstic_ws \
137+
&& . /opt/ros/noetic/setup.sh \
138+
&& catkin_make
139+
140+
# Apply the GUID patch
141+
# COPY guid.patch /root/elstic_ws/src/elastic_bridge/patches/guid.patch
142+
# RUN cd /root/elstic_ws/src/elastic_bridge/deps/ElasticFusion \
143+
# && patch -p1 -i ../../patches/guid.patch

elastic_fusion/build.sh

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
docker build --tag umrobotics/elastic_fusion .

elastic_fusion/docker-compose.yml

+55
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
version: '3.9'
2+
3+
networks:
4+
ros:
5+
driver: bridge
6+
7+
services:
8+
ros-master:
9+
image: umrobotics/elastic_fusion:latest
10+
entrypoint: /bin/zsh
11+
command: -c "source /opt/ros/melodic/setup.zsh && stdbuf -o L roscore"
12+
networks:
13+
- ros
14+
restart: always
15+
container_name: ros-master
16+
17+
elastic_fusion:
18+
image: umrobotics/elastic_fusion:latest
19+
# depends_on:
20+
# - ros-master
21+
container_name: slam
22+
networks:
23+
- ros
24+
environment:
25+
- "DISPLAY=${DISPLAY}"
26+
- "QT_GRAPHICSSYSTEM=native"
27+
- "NVIDIA_DRIVER_CAPABILITIES=all"
28+
- "TERM=xterm-256color"
29+
- "XAUTHORITY"
30+
working_dir: "/root/ws/"
31+
privileged: true
32+
devices:
33+
- /dev/nvidia0
34+
- /dev/nvidia-modeset
35+
- /dev/nvidiactl
36+
- /dev/nvidia-uvm
37+
- /dev/nvidia-uvm-tools
38+
volumes:
39+
- /tmp/.X11-unix:/tmp/.X11-unix:rw
40+
- .zshrc:/root/.zshrc:rw
41+
- .zsh_history:/root/.zsh_history:rw
42+
# - /home/$USER/Projects/curly/:/root/ws/
43+
# - /run/media/$USER/CTOS-Storage/rosbag/:/root/ws/rosbag/
44+
ulimits:
45+
nofile:
46+
soft: 65536
47+
hard: 65536
48+
deploy:
49+
resources:
50+
reservations:
51+
devices:
52+
- driver: nvidia
53+
count: 1
54+
capabilities: [ gpu ]
55+
entrypoint: /bin/zsh

0 commit comments

Comments
 (0)