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

Docker #25

Open
wants to merge 4 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
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
data/
24 changes: 24 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
FROM tensorflow/tensorflow:1.13.1-gpu

# fix nvidia public key
RUN apt-key adv --fetch-keys http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1604/x86_64/3bf863cc.pub &&\
apt update

# install pip and requirements
COPY req_docker.txt ./requirements.txt
RUN apt install -y python3-dev python3-tk &&\
curl -sSL https://bootstrap.pypa.io/pip/3.5/get-pip.py -o get-pip.py &&\
python3 get-pip.py "pip < 21.0" "setuptools < 50.0" "wheel < 1.0" &&\
python3 -m pip install -r requirements.txt

# install ROS kinetic
RUN sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list' &&\
curl -s https://raw.githubusercontent.com/ros/rosdistro/master/ros.asc | apt-key add - &&\
apt update &&\
apt install -y ros-kinetic-ros-base ros-kinetic-ros-numpy git nano &&\
echo "source /opt/ros/kinetic/setup.bash" >> /root/.bashrc

RUN echo 'export PYTHONPATH=/badgr/src:$PYTHONPATH' >> /root/.bashrc

WORKDIR /badgr
COPY bgr.sh .
17 changes: 16 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

# BADGR: An Autonomous Self-Supervised Learning-Based Navigation System

Gregory Kahn, Pieter Abbeel, Sergey Levine
Expand All @@ -11,6 +10,9 @@ Gregory Kahn, Pieter Abbeel, Sergey Levine

Make sure you have 90GB of space available, [anaconda](https://www.anaconda.com/distribution/) installed, and [ROS](https://www.ros.org/) installed. Our installation was on Ubuntu 16.04 with ROS Kinetic.

Note: [Docker](#docker) is now available as an alternative to the following system installation. This approach is recommended to avoid the hassle of installing deprecated software.


Clone the repository and go into the folder:

```bash
Expand Down Expand Up @@ -106,6 +108,19 @@ change the visualizer to show bumpiness by modifying `configs/bumpy_collision_po
python scripts/eval.py configs/bumpy_collision_position.py
```

## Docker

Docker and the [NVIDIA Container Toolkit](https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/install-guide.html) must be installed before proceeding.

First follow the standard instructions for cloning the repository and downloading the data. In the badgr directory:
```
docker build . -t badgr:1.13.1
```
After building follow the training instructions within a badgr container. Make sure to use `python3` instead of `python` A convenience script `badgr_docker` is included which brings up a container with the proper docker options. Change the volume path if badgr is not installed in your home directory.

With a trained model `bgr.sh` can be run to execute the evaluation demo.


## FAQ
1. If you are having issues with importing OpenCV (e.g., `ImportError: /opt/ros/kinetic/lib/python2.7/dist-packages/cv2.so: undefined symbol: PyCObject_Type`), try the following to have python look for the Python 3 OpenCV first:
```bash
Expand Down
8 changes: 8 additions & 0 deletions badgr_docker
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#! /usr/bin/env sh

xhost +local:root; # for the lazy and reckless http://wiki.ros.org/docker/Tutorials/GUI

# this snippet assumes badgr is in your home directory
docker run --network host --gpus all --env="DISPLAY" --env="QT_X11_NO_MITSHM=1" --volume="/tmp/.X11-unix:/tmp/.X11-unix:rw" -v /home/$USER/badgr:/badgr -it badgr:1.13.1 #bash -i -c "./bgr.sh";

xhost -local:root;
16 changes: 16 additions & 0 deletions bgr.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/bin/bash

roscore > /dev/null 2>&1 &

echo "roscore starting up..."
while true; do
sleep 1
rostopic list > /dev/null 2>&1
# Check the return value of rostopic list. Keep looping until it is zero, indicing roscore is ready
[[ $? != 0 ]] || break
done

rosbag play -l data/rosbags/collision.bag > /dev/null 2>&1 &
rosparam set /cost_weights "{'collision': 1.0, 'position': 0.0, 'position_sigmoid_center': 0.4, 'position_sigmoid_scale': 100., 'action_magnitude': 0.01, 'action_smooth': 0.0, 'bumpy': 0.0}";
python3 scripts/eval.py configs/bumpy_collision_position.py;
bash
11 changes: 11 additions & 0 deletions req_docker.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
catkin-pkg==0.4.13
loguru==0.3.2
matplotlib
numpy
opencv-python==4.1.1.26
Pillow==6.1.0
PyYAML==5.1.2
requests==2.22.0
rospkg==1.1.10
tensorflow-gpu==1.13.1
utm==0.5.0