Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reduced PCL layer size #4

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 11 additions & 12 deletions cvo_gpu/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ RUN cd /home/root/tmp && export CC=gcc-9 && export CXX=g++-9 \
&& wget https://github.com/ceres-solver/ceres-solver/archive/refs/tags/2.1.0.tar.gz \
&& export CC=gcc-9 && export CXX=g++-9 \
&& tar zxf 2.1.0.tar.gz && mkdir ceres-bin && cd ceres-bin && cmake ../ceres-solver-2.1.0 \
&& make -j && make install
&& make -j4 && make install

########### Install yaml-cpp
RUN cd /home/root/tmp \
Expand All @@ -121,8 +121,7 @@ RUN cd /home/root/tmp/ && export CC=gcc-9 && export CXX=g++-9 \
COPY boost.h /home/root/tmp/pcl-1.9.1/io/include/pcl/io/boost.h

RUN cd /home/root/tmp/pcl-1.9.1/build \
&& export CC=gcc-9 && export CXX=g++-9 \
&& cmake .. && make -j8 && make install
&& cmake -DCMAKE_BUILD_TYPE=Release .. && make -j4 && make -j4 install

RUN rm -rf /home/root/tmp/*

Expand All @@ -141,15 +140,15 @@ ENV NVIDIA_VISIBLE_DEVICES \
ENV NVIDIA_DRIVER_CAPABILITIES \
${NVIDIA_DRIVER_CAPABILITIES:+$NVIDIA_DRIVER_CAPABILITIES,}graphics

# emacs tools
RUN apt update && \
add-apt-repository ppa:kelleyk/emacs && \
wget -O - https://apt.kitware.com/keys/kitware-archive-latest.asc 2>/dev/null | apt-key add - && \
wget --no-check-certificate -O - https://apt.llvm.org/llvm-snapshot.gpg.key | apt-key add - && \
add-apt-repository 'deb http://apt.llvm.org/bionic/ llvm-toolchain-bionic-10 main' && \
apt-add-repository 'deb https://apt.kitware.com/ubuntu/ bionic main' && apt update &&\
apt install -y emacs27 python3-pip clang-10 clangd-10 llvm-10 lldb-10 llvm-10-dev libllvm10 llvm-10-runtime bear mlocate global cmake && \
apt clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
# emacs tools. Feel free to comment them out of you don't use emacs and llvm tools
# RUN apt update && \
# add-apt-repository ppa:kelleyk/emacs && \
# wget -O - https://apt.kitware.com/keys/kitware-archive-latest.asc 2>/dev/null | apt-key add - && \
# wget --no-check-certificate -O - https://apt.llvm.org/llvm-snapshot.gpg.key | apt-key add - && \
# add-apt-repository 'deb http://apt.llvm.org/bionic/ llvm-toolchain-bionic-10 main' && \
# apt-add-repository 'deb https://apt.kitware.com/ubuntu/ bionic main' && apt update &&\
# apt install -y emacs27 python3-pip clang-10 clangd-10 llvm-10 lldb-10 llvm-10-dev libllvm10 llvm-10-runtime bear mlocate global cmake && \
# apt clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*

RUN updatedb
# USER original_user
2 changes: 1 addition & 1 deletion cvo_gpu/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
## CVO
This docker file sets up the environment for CVO. It aims at installing all non-conflicting related softwares, and encourages download-and-run. We use Nvidia-Docker 2
This docker file sets up the environment for CVO. It aims at installing all non-conflicting related softwares, and encourages download-and-run. Please install [Nvidia-Docker](https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/install-guide.html#docker)


### How to build the docker image from `Dockerfile`?
Expand Down
3 changes: 3 additions & 0 deletions cvo_gpu/run_cuda_docker.bash
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
container_name=$1

xhost +local:

## Note: a) update -v "/home/$USER/code/docker_home/cvo/:/home/$USER/" for specifying your home directory inside docker
## b) update "/run/media/$USER/Samsung_T5/:/home/$USER/media/Samsung_T5" to your own external hard drive if any
docker run -it --net=host --gpus all -e DISPLAY=${DISPLAY} \
-e QT_GRAPHICSSYSTEM=native \
-e NVIDIA_DRIVER_CAPABILITIES=all \
Expand Down
54 changes: 54 additions & 0 deletions elastic_fusion/.zshrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# Enable Powerlevel10k instant prompt. Should stay close to the top of ~/.zshrc.
# Initialization code that may require console input (password prompts, [y/n]
# confirmations, etc.) must go above this block, everything else may go below.
if [[ -r "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" ]]; then
source "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh"
fi

# If you come from bash you might have to change your $PATH.
# export PATH=$HOME/bin:/usr/local/bin:$PATH

# Path to your oh-my-zsh installation.
export ZSH=$HOME/.oh-my-zsh

# Set name of the theme to load --- if set to "random", it will
# load a random theme each time oh-my-zsh is loaded, in which case,
# to know which specific one was loaded, run: echo $RANDOM_THEME
# See https://github.com/ohmyzsh/ohmyzsh/wiki/Themes

ZSH_THEME="powerlevel10k/powerlevel10k"

# Which plugins would you like to load?
# Standard plugins can be found in ~/.oh-my-zsh/plugins/*
# Custom plugins may be added to ~/.oh-my-zsh/custom/plugins/
# Example format: plugins=(rails git textmate ruby lighthouse)
# Add wisely, as too many plugins slow down shell startup.

plugins=(git cp z cp extract history colorize command-not-found sudo zsh-autosuggestions zsh-syntax-highlighting)

POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(user anaconda dir)
POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=(nvm pyenv time)
POWERLEVEL9K_DISABLE_GITSTATUS=true

source $ZSH/oh-my-zsh.sh

# User configuration

export SSH_KEY_PATH="~/.ssh/rsa_id"

# Set personal aliases, overriding those provided by oh-my-zsh libs,
# plugins, and themes. Aliases can be placed here, though oh-my-zsh
# users are encouraged to define aliases within the ZSH_CUSTOM folder.
# For a full list of active aliases, run `alias`.


alias ll='ls -alF'
alias la='ls -A'
alias l='ls -CF'

# To customize prompt, run `p10k configure` or edit ~/.p10k.zsh.
[[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh
source ~/.oh-my-zsh/custom/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
source /opt/ros/noetic/setup.zsh
source ~/ws/cassie_ros/catkin_ws/devel/setup.zsh
source /opt/intel/bin/compilervars.sh intel64
143 changes: 143 additions & 0 deletions elastic_fusion/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,143 @@
FROM nvidia/cudagl:11.4.2-devel-ubuntu20.04
LABEL org.opencontainers.image.authors="[email protected]"
LABEL description="Container for Elastic Bridge (ROS wrapper for ElasticFusion)"
LABEL version="0.1"

ENV DEBIAN_FRONTEND noninteractive
RUN apt-get update \
&& DEBIAN_FRONTEND=noninteractive apt-get install -y locales \
&& sed -i -e 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen \
&& dpkg-reconfigure --frontend=noninteractive locales \
&& update-locale LANG=en_US.UTF-8

# nvidia-container-runtime
ENV NVIDIA_VISIBLE_DEVICES \
${NVIDIA_VISIBLE_DEVICES:-all}
ENV NVIDIA_DRIVER_CAPABILITIES \
${NVIDIA_DRIVER_CAPABILITIES:+$NVIDIA_DRIVER_CAPABILITIES,}graphics,compute,utility,display


# install libraries and tools
RUN apt-get update && apt-get install -y --no-install-recommends \
sudo \
dialog \
apt-utils \
git \
mercurial \
pkg-config \
mesa-utils \
libxau-dev \
libxdmcp-dev \
libxcb1-dev \
libxext-dev \
libx11-dev \
git \
tmux \
wget \
curl \
cmake \
vim \
build-essential \
unzip \
autoconf \
autogen \
automake \
libtool \
mlocate \
zlib1g-dev \
libopenblas-dev \
libflann-dev \
libpcl-dev \
libboost-all-dev \
libsuitesparse-dev \
libtbb-dev \
libusb-1.0-0-dev \
libgtest-dev \
pkg-config \
cmake-curses-gui \
gdb \
clang \
emacs \
libpcap-dev \
gnupg2 \
x11-xserver-utils \
lsb-release \
tilix \
&& apt clean \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*

# install ROS
RUN sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list'

RUN apt-key adv --keyserver 'hkp://keyserver.ubuntu.com:80' --recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654

RUN apt-get update

RUN apt-get install -y --no-install-recommends ros-noetic-desktop-full

# install zsh
RUN git clone https://github.com/tccoin/easy-linux.git /root/easy-linux \
&& cd /root/easy-linux \
&& bash zsh.sh \
&& touch /root/.z \
&& rm -r /root/easy-linux

# install gitstatus
# https://github.com/romkatv/gitstatus/releases/tag/v1.3.1
RUN mkdir -p /root/.cache/gitstatus \
&& wget https://github.com/romkatv/gitstatus/releases/download/v1.5.1/gitstatusd-linux-x86_64.tar.gz -O - \
| tar -zx -C /root/.cache/gitstatus/

# install slam libraries

RUN sudo apt install libpcl-dev

RUN mkdir /root/elstic_ws/src -p
WORKDIR /root/elstic_ws/src

# Download libraries
RUN git clone https://github.com/RMonica/elastic_bridge.git \
&& git clone https://github.com/RMonica/init_fake_opengl_context.git \
&& git clone https://github.com/mp3guy/ElasticFusion.git elastic_bridge/deps/ElasticFusion

# Compile ElasticFusion Core module
## Update cmake
RUN sudo apt-get install -y --no-install-recommends software-properties-common \
&& wget -O - https://apt.kitware.com/keys/kitware-archive-latest.asc 2>/dev/null | sudo apt-key add - \
&& sudo apt-add-repository 'deb https://apt.kitware.com/ubuntu/ bionic main' \
&& sudo apt-get update \
&& sudo apt-get install -y --no-install-recommends cmake

## Compile dependencies
RUN cd /root/elstic_ws/src/elastic_bridge/deps/ElasticFusion/ \
&& git submodule update --init \
&& cd third-party/Pangolin/ \
&& mkdir build \
&& cd build \
&& cmake .. -DEIGEN_INCLUDE_DIR=/root/elstic_ws/src/elastic_bridge/deps/ElasticFusion/third-party/Eigen/ -DBUILD_PANGOLIN_PYTHON=false \
&& make -j8


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 \
&& cd /root/elstic_ws/src/elastic_bridge/deps/ElasticFusion/third-party/OpenNI2/ \
&& make -j8

## Install CUDA
# RUN sudo DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends cuda

## Compile elastic fusion
RUN cd /root/elstic_ws/src/elastic_bridge/deps/ElasticFusion/ \
&& mkdir build \
&& cd build \
&& cmake .. \
&& make -j8

# Compile the package
RUN cd /root/elstic_ws \
&& . /opt/ros/noetic/setup.sh \
&& catkin_make

# Apply the GUID patch
# COPY guid.patch /root/elstic_ws/src/elastic_bridge/patches/guid.patch
# RUN cd /root/elstic_ws/src/elastic_bridge/deps/ElasticFusion \
# && patch -p1 -i ../../patches/guid.patch
1 change: 1 addition & 0 deletions elastic_fusion/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
docker build --tag umrobotics/elastic_fusion .
55 changes: 55 additions & 0 deletions elastic_fusion/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
version: '3.9'

networks:
ros:
driver: bridge

services:
ros-master:
image: umrobotics/elastic_fusion:latest
entrypoint: /bin/zsh
command: -c "source /opt/ros/melodic/setup.zsh && stdbuf -o L roscore"
networks:
- ros
restart: always
container_name: ros-master

elastic_fusion:
image: umrobotics/elastic_fusion:latest
# depends_on:
# - ros-master
container_name: slam
networks:
- ros
environment:
- "DISPLAY=${DISPLAY}"
- "QT_GRAPHICSSYSTEM=native"
- "NVIDIA_DRIVER_CAPABILITIES=all"
- "TERM=xterm-256color"
- "XAUTHORITY"
working_dir: "/root/ws/"
privileged: true
devices:
- /dev/nvidia0
- /dev/nvidia-modeset
- /dev/nvidiactl
- /dev/nvidia-uvm
- /dev/nvidia-uvm-tools
volumes:
- /tmp/.X11-unix:/tmp/.X11-unix:rw
- .zshrc:/root/.zshrc:rw
- .zsh_history:/root/.zsh_history:rw
# - /home/$USER/Projects/curly/:/root/ws/
# - /run/media/$USER/CTOS-Storage/rosbag/:/root/ws/rosbag/
ulimits:
nofile:
soft: 65536
hard: 65536
deploy:
resources:
reservations:
devices:
- driver: nvidia
count: 1
capabilities: [ gpu ]
entrypoint: /bin/zsh
Loading