Skip to content

Commit

Permalink
initial release
Browse files Browse the repository at this point in the history
  • Loading branch information
droid-dataset committed Mar 14, 2024
0 parents commit 5f1114d
Show file tree
Hide file tree
Showing 238 changed files with 453,093 additions and 0 deletions.
28 changes: 28 additions & 0 deletions .docker/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Overview

In order to simplify the setup and deployment of DROID across different machines we supply Dockerfiles for both the control server (nuc) and the client machine (laptop). The directory structure is broken down as follows:

├── nuc # directory for nuc docker setup files
├──── Dockerfile.nuc # nuc image definition
├──── docker-compose-nuc.yaml # nuc container deployment settings
├── laptop # directory for laptop docker setup files
├──── Dockerfile.laptop # laptop image definition
├──── docker-compose-laptop.yaml # laptop container deployment settings
├──── entrypoint.sh # script that is run on entrypoint of Docker container

We recognise that some users may not already be familiar with Docker, the syntax of Dockerfiles and the syntax of docker compose configuration files. We point the user towards the following resources on these topics:

* [Docker Overview](https://docs.docker.com/get-started/overview/)
* [Dockerfile Reference](https://docs.docker.com/engine/reference/builder/)
* [Docker Compose Overview](https://docs.docker.com/compose/)

# NUC Setup
In order to set up the control server on your NUC run `sudo ./nuc_setup.sh` from this [directory](https://github.com/AlexanderKhazatsky/DROID/tree/main/scripts/setup). Running through all the steps in this script will install host system dependencies and ensure the control server runs automatically in a docker container each time your machine is booted.

Further details on the steps in README.md in the `scripts/setup` directory.

# Laptop Setup
In order to set up the user client on your laptop run `sudo ./laptop_setup.sh` from this [directory](https://github.com/AlexanderKhazatsky/DROID/tree/main/scripts/setup). Running through all the steps in this script will install host system dependencies and ensure the user client can be run in a docker container.

Further details can be found [README.md](https://github.com/AlexanderKhazatsky/DROID/tree/main/scripts/setup/README.md).

96 changes: 96 additions & 0 deletions .docker/laptop/Dockerfile.laptop
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
FROM nvidia/cuda:12.1.0-devel-ubuntu22.04

# build args
ARG ROBOT_TYPE=${ROBOT_TYPE}
ARG LIBFRANKA_VERSION=${LIBFRANKA_VERSION}
ARG ROBOT_IP=${ROBOT_IP}
ARG NUC_IP=${NUC_IP}
ARG NUC_ROBOT_CONFIG_DIR=/app/config/${ROBOT_TYPE}
ARG NUC_OCULUS_DIR=/app/droid/oculus_reader
ARG NUC_POLYMETIS_DIR=/app/droid/fairo/polymetis
ARG NUC_POLYMETIS_CONFIG_DIR=${NUC_POLYMETIS_DIR}/polymetis/conf

# runtime env vars
ENV ROBOT_TYPE=${ROBOT_TYPE}
ENV LIBFRANKA_VERSION=${LIBFRANKA_VERSION}
ENV ROBOT_IP=${ROBOT_IP}
ENV NUC_IP=${NUC_IP}
ENV NVIDIA_VISIBLE_DEVICES=all
ENV NVIDIA_DRIVER_CAPABILITIES \
${NVIDIA_DRIVER_CAPABILITIES:+$NVIDIA_DRIVER_CAPABILITIES,}compute,video,utility

# copy project code to container
COPY . /app
WORKDIR /app

# base system installations
RUN apt-get update && \
apt-get install -y software-properties-common build-essential sudo git curl wget python3-pip libspdlog-dev \
libeigen3-dev lsb-release ffmpeg libsm6 libxext6 zstd && \
apt-get upgrade -y

# install miniconda
RUN wget \
https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh \
&& mkdir /root/.conda \
&& bash Miniconda3-latest-Linux-x86_64.sh -b \
&& rm -f Miniconda3-latest-Linux-x86_64.sh
ENV PATH /root/miniconda3/bin:$PATH

# create conda environment
RUN conda create -n "robot" python=3.7
SHELL ["conda", "run", "-n", "robot", "/bin/bash", "-c"]

# install the zed sdk
ARG UBUNTU_RELEASE_YEAR=22
ARG ZED_SDK_MAJOR=4
ARG ZED_SDK_MINOR=0
ARG CUDA_MAJOR=12
ARG CUDA_MINOR=1

RUN echo "Europe/Paris" > /etc/localtime ; echo "CUDA Version ${CUDA_MAJOR}.${CUDA_MINOR}.0" > /usr/local/cuda/version.txt

# setup the ZED SDK
RUN apt-get update -y || true ; apt-get install --no-install-recommends lsb-release wget less udev sudo zstd build-essential cmake python3 python3-pip libpng-dev libgomp1 -y && \
python3 -m pip install numpy opencv-python && \
wget -q -O ZED_SDK_Linux_Ubuntu${UBUNTU_RELEASE_YEAR}.run https://download.stereolabs.com/zedsdk/${ZED_SDK_MAJOR}.${ZED_SDK_MINOR}/cu${CUDA_MAJOR}${CUDA_MINOR%.*}/ubuntu${UBUNTU_RELEASE_YEAR} && \
chmod +x ZED_SDK_Linux_Ubuntu${UBUNTU_RELEASE_YEAR}.run && \
./ZED_SDK_Linux_Ubuntu${UBUNTU_RELEASE_YEAR}.run -- silent skip_tools skip_cuda && \
ln -sf /lib/x86_64-linux-gnu/libusb-1.0.so.0 /usr/lib/x86_64-linux-gnu/libusb-1.0.so && \
rm ZED_SDK_Linux_Ubuntu${UBUNTU_RELEASE_YEAR}.run && \
rm -rf /var/lib/apt/lists/*
RUN conda install -c conda-forge libstdcxx-ng requests # required for pyzed
RUN python /usr/local/zed/get_python_api.py && python -m pip install --ignore-installed /app/pyzed-4.0-cp37-cp37m-linux_x86_64.whl

# install oculus reader
RUN add-apt-repository universe && \
apt-get update -y && \
apt-get install -y android-tools-fastboot
RUN pip3 install -e $NUC_OCULUS_DIR && \
apt install -y android-tools-adb

# python environment setup
RUN pip3 install -e . && \
pip3 install dm-robotics-moma==0.5.0 --no-deps && \
pip3 install dm-robotics-transformations==0.5.0 --no-deps && \
pip3 install dm-robotics-agentflow==0.5.0 --no-deps && \
pip3 install dm-robotics-geometry==0.5.0 --no-deps && \
pip3 install dm-robotics-manipulation==0.5.0 --no-deps && \
pip3 install dm-robotics-controllers==0.5.0 --no-deps


# using miniconda instead of anaconda so overwrite sh scripts
RUN find /app/droid/franka -type f -name "launch_*.sh" -exec sed -i 's/anaconda/miniconda/g' {} \;
RUN find /app/scripts/server -type f -name "launch_server.sh" -exec sed -i 's/anaconda/miniconda/g' {} \;

# set absolute paths
RUN find /app/droid/franka -type f -name "launch_*.sh" -exec sed -i 's|~|/root|g' {} \;
RUN find /app/scripts/server -type f -name "launch_server.sh" -exec sed -i 's|~|/root|g' {} \;

# set polymetis config files
RUN cp ${NUC_ROBOT_CONFIG_DIR}/franka_hardware.yaml ${NUC_POLYMETIS_CONFIG_DIR}/robot_client/franka_hardware.yaml && \
cp ${NUC_ROBOT_CONFIG_DIR}/franka_panda.yaml ${NUC_POLYMETIS_CONFIG_DIR}/robot_model/franka_panda.yaml

# start the server
RUN chmod +x /app/.docker/laptop/entrypoint.sh
ENTRYPOINT ["/app/.docker/laptop/entrypoint.sh"]
92 changes: 92 additions & 0 deletions .docker/laptop/Dockerfile.laptop_fr3
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
FROM nvidia/cuda:12.1.0-devel-ubuntu22.04

# set robot parameters
ENV ROBOT_TYPE=fr3
ENV LIBFRANKA_VERSION=0.10.0
ENV ROBOT_IP=172.16.0.1
ENV NUC_IP=172.16.0.2
ENV NVIDIA_VISIBLE_DEVICES=all
ENV NVIDIA_DRIVER_CAPABILITIES \
${NVIDIA_DRIVER_CAPABILITIES:+$NVIDIA_DRIVER_CAPABILITIES,}compute,video,utility

# set directory structure
ARG NUC_ROBOT_CONFIG_DIR=/app/config/${ROBOT_TYPE}
ARG NUC_OCULUS_DIR=/app/droid/oculus_reader
ARG NUC_POLYMETIS_DIR=/app/droid/fairo/polymetis
ARG NUC_POLYMETIS_CONFIG_DIR=${NUC_POLYMETIS_DIR}/polymetis/conf

# copy project code to container
COPY . /app
WORKDIR /app

# base system installations
RUN apt-get update && \
apt-get install -y software-properties-common build-essential sudo git curl wget python3-pip libspdlog-dev \
libeigen3-dev lsb-release ffmpeg libsm6 libxext6 zstd && \
apt-get upgrade -y

# install miniconda
RUN wget \
https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh \
&& mkdir /root/.conda \
&& bash Miniconda3-latest-Linux-x86_64.sh -b \
&& rm -f Miniconda3-latest-Linux-x86_64.sh
ENV PATH /root/miniconda3/bin:$PATH

# create conda environment
RUN conda create -n "robot" python=3.7
SHELL ["conda", "run", "-n", "robot", "/bin/bash", "-c"]

# install the zed sdk
ARG UBUNTU_RELEASE_YEAR=22
ARG ZED_SDK_MAJOR=4
ARG ZED_SDK_MINOR=0
ARG CUDA_MAJOR=12
ARG CUDA_MINOR=1

RUN echo "Europe/Paris" > /etc/localtime ; echo "CUDA Version ${CUDA_MAJOR}.${CUDA_MINOR}.0" > /usr/local/cuda/version.txt

# setup the ZED SDK
RUN apt-get update -y || true ; apt-get install --no-install-recommends lsb-release wget less udev sudo zstd build-essential cmake python3 python3-pip libpng-dev libgomp1 -y && \
python3 -m pip install numpy opencv-python && \
wget -q -O ZED_SDK_Linux_Ubuntu${UBUNTU_RELEASE_YEAR}.run https://download.stereolabs.com/zedsdk/${ZED_SDK_MAJOR}.${ZED_SDK_MINOR}/cu${CUDA_MAJOR}${CUDA_MINOR%.*}/ubuntu${UBUNTU_RELEASE_YEAR} && \
chmod +x ZED_SDK_Linux_Ubuntu${UBUNTU_RELEASE_YEAR}.run && \
./ZED_SDK_Linux_Ubuntu${UBUNTU_RELEASE_YEAR}.run -- silent skip_tools skip_cuda && \
ln -sf /lib/x86_64-linux-gnu/libusb-1.0.so.0 /usr/lib/x86_64-linux-gnu/libusb-1.0.so && \
rm ZED_SDK_Linux_Ubuntu${UBUNTU_RELEASE_YEAR}.run && \
rm -rf /var/lib/apt/lists/*
RUN conda install -c conda-forge libstdcxx-ng requests # required for pyzed
RUN python /usr/local/zed/get_python_api.py && python -m pip install --ignore-installed /app/pyzed-4.0-cp37-cp37m-linux_x86_64.whl

# install oculus reader
RUN add-apt-repository universe && \
apt-get update -y && \
apt-get install -y android-tools-fastboot
RUN pip3 install -e $NUC_OCULUS_DIR && \
apt install -y android-tools-adb

# python environment setup
RUN pip3 install -e . && \
pip3 install dm-robotics-moma==0.5.0 --no-deps && \
pip3 install dm-robotics-transformations==0.5.0 --no-deps && \
pip3 install dm-robotics-agentflow==0.5.0 --no-deps && \
pip3 install dm-robotics-geometry==0.5.0 --no-deps && \
pip3 install dm-robotics-manipulation==0.5.0 --no-deps && \
pip3 install dm-robotics-controllers==0.5.0 --no-deps


# using miniconda instead of anaconda so overwrite sh scripts
RUN find /app/droid/franka -type f -name "launch_*.sh" -exec sed -i 's/anaconda/miniconda/g' {} \;
RUN find /app/scripts/server -type f -name "launch_server.sh" -exec sed -i 's/anaconda/miniconda/g' {} \;

# set absolute paths
RUN find /app/droid/franka -type f -name "launch_*.sh" -exec sed -i 's|~|/root|g' {} \;
RUN find /app/scripts/server -type f -name "launch_server.sh" -exec sed -i 's|~|/root|g' {} \;

# set polymetis config files
RUN cp ${NUC_ROBOT_CONFIG_DIR}/franka_hardware.yaml ${NUC_POLYMETIS_CONFIG_DIR}/robot_client/franka_hardware.yaml && \
cp ${NUC_ROBOT_CONFIG_DIR}/franka_panda.yaml ${NUC_POLYMETIS_CONFIG_DIR}/robot_model/franka_panda.yaml

# start the server
RUN chmod +x /app/.docker/laptop/entrypoint.sh
ENTRYPOINT ["/app/.docker/laptop/entrypoint.sh"]
94 changes: 94 additions & 0 deletions .docker/laptop/Dockerfile.laptop_panda
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
FROM nvidia/cuda:12.1.0-devel-ubuntu22.04

# set robot parameters
ENV ROBOT_TYPE=panda
ENV LIBFRANKA_VERSION=0.9.0
ENV ROBOT_IP=172.16.0.1
ENV NUC_IP=172.16.0.2
ENV NVIDIA_VISIBLE_DEVICES=all
ENV NVIDIA_DRIVER_CAPABILITIES \
${NVIDIA_DRIVER_CAPABILITIES:+$NVIDIA_DRIVER_CAPABILITIES,}compute,video,utility

# set directory structure
ARG NUC_ROBOT_CONFIG_DIR=/app/config/${ROBOT_TYPE}
ARG NUC_OCULUS_DIR=/app/droid/oculus_reader
ARG NUC_POLYMETIS_DIR=/app/droid/fairo/polymetis
ARG NUC_POLYMETIS_CONFIG_DIR=${NUC_POLYMETIS_DIR}/polymetis/conf

# copy project code to container
COPY . /app
WORKDIR /app

# base system installations
RUN apt-get update && \
apt-get install -y software-properties-common build-essential sudo git curl wget python3-pip libspdlog-dev \
libeigen3-dev lsb-release ffmpeg libsm6 libxext6 zstd && \
apt-get upgrade -y

# install miniconda
RUN wget \
https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh \
&& mkdir /root/.conda \
&& bash Miniconda3-latest-Linux-x86_64.sh -b \
&& rm -f Miniconda3-latest-Linux-x86_64.sh
ENV PATH /root/miniconda3/bin:$PATH

# create conda environment
RUN conda create -n "robot" python=3.7
SHELL ["conda", "run", "-n", "robot", "/bin/bash", "-c"]

# install the zed sdk
ARG UBUNTU_RELEASE_YEAR=22
ARG ZED_SDK_MAJOR=4
ARG ZED_SDK_MINOR=0
ARG CUDA_MAJOR=12
ARG CUDA_MINOR=1

RUN echo "Europe/Paris" > /etc/localtime ; echo "CUDA Version ${CUDA_MAJOR}.${CUDA_MINOR}.0" > /usr/local/cuda/version.txt

# setup the ZED SDK
RUN apt-get update -y || true ; apt-get install --no-install-recommends lsb-release wget less udev sudo zstd build-essential cmake python3 python3-pip libpng-dev libgomp1 -y && \
python3 -m pip install numpy opencv-python && \
wget -q -O ZED_SDK_Linux_Ubuntu${UBUNTU_RELEASE_YEAR}.run https://download.stereolabs.com/zedsdk/${ZED_SDK_MAJOR}.${ZED_SDK_MINOR}/cu${CUDA_MAJOR}${CUDA_MINOR%.*}/ubuntu${UBUNTU_RELEASE_YEAR} && \
chmod +x ZED_SDK_Linux_Ubuntu${UBUNTU_RELEASE_YEAR}.run && \
./ZED_SDK_Linux_Ubuntu${UBUNTU_RELEASE_YEAR}.run -- silent skip_tools skip_cuda && \
ln -sf /lib/x86_64-linux-gnu/libusb-1.0.so.0 /usr/lib/x86_64-linux-gnu/libusb-1.0.so && \
rm ZED_SDK_Linux_Ubuntu${UBUNTU_RELEASE_YEAR}.run && \
rm -rf /var/lib/apt/lists/*

RUN conda install -c conda-forge libstdcxx-ng requests # required for pyzed
RUN python /usr/local/zed/get_python_api.py && python -m pip install --ignore-installed /app/pyzed-4.0-cp37-cp37m-linux_x86_64.whl

# install oculus reader
RUN add-apt-repository universe && \
apt-get update -y && \
apt-get install -y android-tools-fastboot
RUN pip3 install -e $NUC_OCULUS_DIR && \
apt install -y android-tools-adb && \
rm -rf /var/lib/apt/lists/*

# python environment setup
RUN pip3 install -e . && \
pip3 install dm-robotics-moma==0.5.0 --no-deps && \
pip3 install dm-robotics-transformations==0.5.0 --no-deps && \
pip3 install dm-robotics-agentflow==0.5.0 --no-deps && \
pip3 install dm-robotics-geometry==0.5.0 --no-deps && \
pip3 install dm-robotics-manipulation==0.5.0 --no-deps && \
pip3 install dm-robotics-controllers==0.5.0 --no-deps


# using miniconda instead of anaconda so overwrite sh scripts
RUN find /app/droid/franka -type f -name "launch_*.sh" -exec sed -i 's/anaconda/miniconda/g' {} \;
RUN find /app/scripts/server -type f -name "launch_server.sh" -exec sed -i 's/anaconda/miniconda/g' {} \;

# set absolute paths
RUN find /app/droid/franka -type f -name "launch_*.sh" -exec sed -i 's|~|/root|g' {} \;
RUN find /app/scripts/server -type f -name "launch_server.sh" -exec sed -i 's|~|/root|g' {} \;

# set polymetis config files
RUN cp ${NUC_ROBOT_CONFIG_DIR}/franka_hardware.yaml ${NUC_POLYMETIS_CONFIG_DIR}/robot_client/franka_hardware.yaml && \
cp ${NUC_ROBOT_CONFIG_DIR}/franka_panda.yaml ${NUC_POLYMETIS_CONFIG_DIR}/robot_model/franka_panda.yaml

# start the server
RUN chmod +x /app/.docker/laptop/entrypoint.sh
ENTRYPOINT ["/app/.docker/laptop/entrypoint.sh"]
34 changes: 34 additions & 0 deletions .docker/laptop/docker-compose-laptop-data-upload.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
version: "3"

services:
laptop_setup:
image: ghcr.io/alexanderkhazatsky/droid:laptop_fer
environment:
ROOT_DIR: ${ROOT_DIR}
DISPLAY: ${DISPLAY}
XAUTHORITY: ${DOCKER_XAUTH}
ROBOT_TYPE: ${ROBOT_TYPE}
LIBFRANKA_VERSION: ${LIBFRANKA_VERSION}
NUC_IP: ${NUC_IP}
ROBOT_IP: ${ROBOT_IP}
LAPTOP_IP: ${LAPTOP_IP}
NVIDIA_VISIBLE_DEVICES: all
ANDROID_ADB_SERVER_ADDRESS: host.docker.internal
volumes:
- /tmp/.X11-unix:/tmp/.X11-unix:rw
- ${DOCKER_XAUTH}:${DOCKER_XAUTH}
- ${ROOT_DIR}/droid/misc/parameters.py:/app/droid/misc/parameters.py
- ${ROOT_DIR}/droid/calibration/calibration_info.json:/app/droid/calibration/calibration_info.json
- ${ROOT_DIR}/data:/app/data
- ${ROOT_DIR}/cache:/app/cache
- ${ROOT_DIR}/droid-credentials.json:/app/droid-credentials.json
- ${ROOT_DIR}/scripts/postprocess.py:/app/scripts/postprocess.py
build:
context: ../../
dockerfile: .docker/laptop/Dockerfile.laptop
devices:
- "/dev:/dev"
runtime: nvidia
privileged: true
network_mode: "host"
command: python /app/scripts/postprocess.py
37 changes: 37 additions & 0 deletions .docker/laptop/docker-compose-laptop.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
version: "3"

services:
laptop_setup:
image: ghcr.io/droid-dataset/droid_laptop:${ROBOT_TYPE}
environment:
ROOT_DIR: ${ROOT_DIR}
DISPLAY: ${DISPLAY}
XAUTHORITY: ${DOCKER_XAUTH}
ROBOT_TYPE: ${ROBOT_TYPE}
LIBFRANKA_VERSION: ${LIBFRANKA_VERSION}
NUC_IP: ${NUC_IP}
ROBOT_IP: ${ROBOT_IP}
LAPTOP_IP: ${LAPTOP_IP}
NVIDIA_VISIBLE_DEVICES: all
ANDROID_ADB_SERVER_ADDRESS: host.docker.internal
volumes:
- /tmp/.X11-unix:/tmp/.X11-unix:rw
- ${DOCKER_XAUTH}:${DOCKER_XAUTH}
- ${ROOT_DIR}/droid/misc/parameters.py:/app/droid/misc/parameters.py
- ${ROOT_DIR}/droid/calibration/calibration_info.json:/app/droid/calibration/calibration_info.json
- ${ROOT_DIR}/data:/app/data
- ${ROOT_DIR}/cache:/app/cache
build:
context: ../../
dockerfile: .docker/laptop/Dockerfile.laptop
args:
ROOT_DIR: ${ROOT_DIR}
ROBOT_TYPE: ${ROBOT_TYPE}
NUC_IP: ${NUC_IP}
ROBOT_IP: ${ROBOT_IP}
devices:
- "/dev:/dev"
runtime: nvidia
privileged: true
network_mode: "host"
command: python /app/scripts/main.py
8 changes: 8 additions & 0 deletions .docker/laptop/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/bash

# activate conda
source ~/miniconda3/bin/activate
conda activate robot

# run user command
exec "$@"
Loading

0 comments on commit 5f1114d

Please sign in to comment.