Skip to content

Commit

Permalink
Merge pull request RobotLocomotion#1 from RobotLocomotion/dockerfiles
Browse files Browse the repository at this point in the history
Added docker files
  • Loading branch information
RussTedrake authored Oct 15, 2023
2 parents 1f6caca + 6992538 commit ad9ba85
Show file tree
Hide file tree
Showing 4 changed files with 114 additions and 25 deletions.
50 changes: 37 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,28 +17,39 @@ Note: The PRM and Bimanual reproductions do not yet work on Deepnote and the UAV

## Running locally

### Installing Dependencies
This code depends on [Drake](https://drake.mit.edu), specifically its Python bindings. To install Drake bindings follow the instruction on [Drake's Installation Page](https://drake.mit.edu/installation.html). Any of the installation methods listed should work. You can check that the installation was sucessful by following the instruction [here](https://drake.mit.edu/python_bindings.html#using-the-python-bindings).
### Option 1: Docker
We provide a [dockerfile](docker/deepnote/Dockerfile) with a custom build of [Drake](https://drake.mit.edu) that entails sampling based planners for the comparison. Note that the docker does not include a build of Gurobi, which has been only used in the Iris region generation.

We have used Mosek to solve most of the examples. To solve using Mosek, you'll need to give Drake access to a Mosek license file as described [here](https://drake.mit.edu/bazel.html#mosek). Mosek provides a personal academic license for free.

You will also need to install `gcs` and its dependencies. You can do this by running
Pull the docker:
```sh
docker pull wrangelvid/drake:gcs-science-robotics
```
pip install -r requirements.txt

Run the docker:
```sh
docker run -i -p 7000:7000 -p 8888:8888 -w /gcs-science-robotics -t wrangelvid/drake:gcs-science-robotics
```

### Running Examples
Once all the dependencies have been installed, you can run the examples with jupyter notebooks which can be launched by calling
In another shell, copy over your mosek license:

```sh
docker cp [PATH_TO_MOSEK.lic] [container_id]:/tmp/mosek.lic
```
jupyter-notebook

Once the docker has been build and run, you can run the examples with jupyter notebooks:

In the docker run the jupyter server:
```sh
jupyter notebook --ip 0.0.0.0 --no-browser --allow-root --NotebookApp.token=''
```
from inside this repository.

### Running the Sampling Based Comparison
If you want to compare GCS to sampling based planners (such as PRM), you'll need to install a custom fork of drake that includes bindings for sampling based planners. To do this run the following, including any of the proprietary solvers you have access to.
On your machine go to http://localhost:8888/ You will find the reproduction notebooks in the reproduction folder.

### Option 2: Local Installation
If you want to compare GCS to sampling based planners (such as PRM), you'll need to install a custom fork of [Drake](https://drake.mit.edu) that includes bindings for sampling based planners. To do this run the following, including any of the proprietary solvers you have access to. You may build it with Gurobi.

```
git clone -b gcs_paper git@github.com:wrangelvid/drake.git
git clone -b gcs-science-robotics git@github.com:wrangelvid/drake.git
mkdir drake-build
cd drake-build
cmake -DWITH_MOSEK=ON [-DWITH_GUROBI=ON -DWITH_ROBOTLOCOMOTION_SNOPT=ON] ../drake
Expand All @@ -58,3 +69,16 @@ For macOS:
cd drake-build
export PYTHONPATH=${PWD}/install/lib/python3.9/site-packages:$PYTHONPATH
```

We have used Mosek to solve most of the examples. To solve using Mosek, you'll need to give Drake access to a Mosek license file as described [here](https://drake.mit.edu/bazel.html#mosek). Mosek provides a personal academic license for free.

You will also need to install `gcs-science-robotics` and its dependencies. From inside this repository, run the following:
```
pip install -e .
```

Once all the dependencies have been installed, you can run the examples with jupyter notebooks which can be launched by calling
```
jupyter-notebook
```
from inside this repository.
66 changes: 66 additions & 0 deletions docker/deepnote/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
# -*- mode: dockerfile -*-
# vi: set ft=dockerfile :

# git clone -b gcs-science-robotics git@github.com:wrangelvid/drake.git
# mkdir drake-build
# cd drake-build
# cmake -DWITH_MOSEK=ON ../drake
# make -j
# Then copy this Dockerfile into the drake-build folder
# docker build -f Dockerfile -t wrangelvid/drake:gcs-science-robotics ./install
#
# docker login
# docker push wrangelvid/drake:gcs-science-robotics

FROM ubuntu:jammy
ARG DEBIAN_FRONTEND=noninteractive
ENV SHELL /bin/bash
# Open ports for meshcat:
EXPOSE 7000-7099/tcp
EXPOSE 8888/tcp

LABEL org.opencontainers.image.authors="David von Wrangel"
LABEL org.opencontainers.image.description="Drake with sampling based planning for the gcs paper"
LABEL org.opencontainers.image.licenses="BSD-3-Clause"
LABEL org.opencontainers.image.source="https://github.com/wrangelvid/drake/tree/gcs-science-robotics"
LABEL org.opencontainers.image.vendor="Massachusetts Institute of Technology"

ENV LANG en_US.UTF-8
ENV LANGUAGE en_US.UTF-8
ENV LC_ALL en_US.UTF-8
ENV TZ=America/New_York
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone

# Install curl and useful transport
RUN apt-get update && yes "Y" \
| apt-get install --no-install-recommends curl apt-transport-https
RUN apt install -y tzdata
COPY . /opt/drake/

# Install drake prereqs.
RUN apt-get update \
&& yes "Y" | bash /opt/drake/share/drake/setup/install_prereqs

RUN apt install python3-pip -y
RUN apt install python-is-python3

# Install deepnote dependencies.
RUN apt-get update \
&& yes "Y" | bash /opt/drake/share/drake/setup/deepnote/install_nginx
RUN apt-get update \
&& yes "Y" | bash /opt/drake/share/drake/setup/deepnote/install_xvfb

RUN apt-get -q update && apt-get -q install -y --no-install-recommends git nginx-light xvfb && apt-get -q clean
RUN pip3 install lxml matplotlib networkx numpy pandas pydot scipy
RUN pip3 install -I ipywidgets
RUN pip3 install jupyter_server
RUN pip3 install --upgrade notebook

# Install GCS repository.
ENV DISPLAY=:1
ENV MOSEKLM_LICENSE_FILE="/tmp/mosek.lic"
RUN git clone https://github.com/RobotLocomotion/gcs-science-robotics.git
ENV PYTHONPATH=/gcs-science-robotics:${PYTHONPATH}

# Source environment of Drake installed to /drake
ENV PYTHONPATH=/opt/drake/lib/python3.10/site-packages:${PYTHONPATH}
11 changes: 0 additions & 11 deletions requirements.txt

This file was deleted.

12 changes: 11 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,15 @@
setup(
name='gcs',
version='0.1.0',
packages=find_packages()
packages=find_packages(),
install_requires=[
'lxml',
'matplotlib',
'networkx',
'notebook',
'numpy',
'pandas',
'pydot',
'scipy',
]
)

0 comments on commit ad9ba85

Please sign in to comment.