Skip to content

Commit

Permalink
Fix Dockerfile and update Ros2 to dashing
Browse files Browse the repository at this point in the history
  • Loading branch information
daviduhm committed May 4, 2020
1 parent e559144 commit 6e9a6e7
Show file tree
Hide file tree
Showing 13 changed files with 386 additions and 49 deletions.
52 changes: 30 additions & 22 deletions Dockerfile
Expand Up @@ -60,28 +60,25 @@ RUN ${PIP} --no-cache-dir install --upgrade \
pip \
setuptools

RUN ln -s $(which ${PYTHON}) /usr/local/bin/python
RUN ln -s $(which ${PYTHON}) /usr/local/bin/python

RUN apt-get update && apt-get install -y \
curl \
git \
wget \
openjdk-8-jdk \
${PYTHON}-dev \
swig

RUN ${PIP} --no-cache-dir install \
Pillow \
h5py \
ipykernel \
jupyter \
keras \
matplotlib \
mock \
numpy \
scipy \
sklearn \
pandas \
Pillow==5.4.1 \
h5py==2.9.0 \
ipykernel==5.1.0 \
jupyter==1.0.0 \
keras==2.2.4 \
matplotlib==3.0.2 \
mock==2.0.0 \
numpy==1.16.0 \
scipy==1.2.0 \
sklearn==0.0 \
pandas==0.24.0 \
&& ${PYTHON} -m ipykernel.kernelspec \
&& test "${USE_PYTHON_3_NOT_2}" -eq 1 && true || ${PIP} --no-cache-dir install \
enum34
Expand Down Expand Up @@ -118,11 +115,11 @@ RUN ln -s /usr/local/cuda/lib64/stubs/libcuda.so /usr/local/cuda/lib64/stubs/lib
rm /usr/local/cuda/lib64/stubs/libcuda.so.1 && \
bazel-bin/tensorflow/tools/pip_package/build_pip_package /tmp/pip && \
pip --no-cache-dir install --upgrade /tmp/pip/tensorflow-*.whl && \
# rm -rf /tmp/pip && \
rm -rf /root/.cache

# TensorBoard
EXPOSE 6006

# IPython
EXPOSE 8888

Expand All @@ -131,8 +128,13 @@ RUN echo 'Etc/UTC' > /etc/timezone && \
ln -s /usr/share/zoneinfo/Etc/UTC /etc/localtime && \
apt-get update && apt-get install -q -y tzdata && rm -rf /var/lib/apt/lists/*


#########################
## ROS & rosbridge ##
#########################

# setup keys
RUN apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 421C365BD9FF1F717815A3895523BAEEB01FA116
RUN set -ex && curl -s https://raw.githubusercontent.com/ros/rosdistro/master/ros.asc | apt-key add -

# setup sources.list
RUN echo "deb [arch=amd64,arm64] http://packages.ros.org/ros2/ubuntu `lsb_release -sc` main" > /etc/apt/sources.list.d/ros2-latest.list
Expand All @@ -156,11 +158,10 @@ RUN apt-get update && apt-get install -y \
&& rm -rf /var/lib/apt/lists/*

# install ros2 packages
ENV ROS2_DISTRO crystal
ENV ROS2_DISTRO dashing
ENV ROS_MASTER_URI http://localhost:11311
RUN apt-get update && apt-get install -y \
ros-${ROS2_DISTRO}-desktop=0.6.1-0* \
# ros-${ROS2_DISTRO}-ros1-bridge=0.6.1-1* \
ros-${ROS2_DISTRO}-desktop=0.7.3-1* \
&& rm -rf /var/lib/apt/lists/*

RUN apt-get update && apt-get install -y \
Expand All @@ -171,16 +172,23 @@ RUN apt-get update && apt-get install -y \
${PYTHON}-twisted \
&& rm -rf /var/lib/apt/lists/*

RUN ${PYTHON} -m pip install -U \
pytest-repeat \
pytest-rerunfailures \
pytest \
pytest-cov \
pytest-runner

# Node.js for ROS2 web bridge
RUN set -ex \
&& curl -sfL https://deb.nodesource.com/setup_9.x | bash - \
&& curl -sfL https://deb.nodesource.com/setup_10.x | bash - \
&& DEBIAN_FRONTEND=noninteractive apt-get install -y nodejs

# ROS2 web bridge
ENV COLCON_PREFIX_PATH /lanefollowing/ros2_ws/install:/opt/ros/${ROS2_DISTRO}
RUN set -ex \
&& cd /opt \
&& git clone https://github.com/RobotWebTools/ros2-web-bridge.git \
&& git clone -b 0.2.7 https://github.com/RobotWebTools/ros2-web-bridge.git \
&& cd ros2-web-bridge \
&& export CFLAGS="${CFLAGS} -fpermissive" \
&& export CXXFLAGS="${CXXFLAGS} -fpermissive" \
Expand Down
6 changes: 3 additions & 3 deletions README.md
Expand Up @@ -43,7 +43,7 @@ docker pull lgsvl/lanefollowing:latest
To build ROS2 packages:

```
docker-compose up build
docker-compose up build_ros
```

Now, launch the lane following model:
Expand Down Expand Up @@ -89,7 +89,7 @@ To test if NVIDIA drivers are properly installed enter `nvidia-smi` in a termina
| 0 GeForce GTX 108... Off | 00000000:65:00.0 On | N/A |
| 0% 59C P5 22W / 250W | 1490MiB / 11175MiB | 4% Default |
+-------------------------------+----------------------+----------------------+
+-----------------------------------------------------------------------------+
| Processes: GPU Memory |
| GPU PID Type Process name Usage |
Expand Down Expand Up @@ -118,7 +118,7 @@ docker pull lgsvl/lanefollowing:latest
- Python 3.6
- TensorFlow 1.8
- Keras 2.2.4
- ROS2 Crystal + rosbridge
- ROS2 Dashing + rosbridge
- Jupyter Notebook

## Features
Expand Down
22 changes: 11 additions & 11 deletions docker-compose.yml
@@ -1,7 +1,7 @@
version: "2.4"

services:
build:
build_ros:
build:
context: .
image: lgsvl/lanefollowing:latest
Expand All @@ -12,7 +12,7 @@ services:
init: true
privileged: true
command: /lanefollowing/scripts/build.sh

collect:
build:
context: .
Expand All @@ -21,13 +21,13 @@ services:
volumes:
- .:/lanefollowing
environment:
- CUDA_CACHE_PATH=/lanefollowing/.nv
- CUDA_CACHE_PATH=/lanefollowing/docker/.nv
runtime: nvidia
network_mode: host
init: true
privileged: true
command: /lanefollowing/scripts/collect.sh

preprocess:
build:
context: .
Expand All @@ -36,7 +36,7 @@ services:
volumes:
- .:/lanefollowing
environment:
- CUDA_CACHE_PATH=/lanefollowing/.nv
- CUDA_CACHE_PATH=/lanefollowing/docker/.nv
runtime: nvidia
network_mode: host
init: true
Expand All @@ -51,7 +51,7 @@ services:
volumes:
- .:/lanefollowing
environment:
- CUDA_CACHE_PATH=/lanefollowing/.nv
- CUDA_CACHE_PATH=/lanefollowing/docker/.nv
runtime: nvidia
network_mode: host
init: true
Expand All @@ -66,13 +66,13 @@ services:
volumes:
- .:/lanefollowing
environment:
- CUDA_CACHE_PATH=/lanefollowing/.nv
- CUDA_CACHE_PATH=/lanefollowing/docker/.nv
runtime: nvidia
network_mode: host
init: true
privileged: true
command: /lanefollowing/scripts/drive.sh

drive_visual:
build:
context: .
Expand All @@ -85,13 +85,13 @@ services:
environment:
- DISPLAY
- XAUTHORITY=/tmp/.Xauthority
- CUDA_CACHE_PATH=/lanefollowing/.nv
- CUDA_CACHE_PATH=/lanefollowing/docker/.nv
runtime: nvidia
network_mode: host
init: true
privileged: true
command: /lanefollowing/scripts/drive_visual.sh

drive_cpu:
build:
context: .
Expand Down Expand Up @@ -147,7 +147,7 @@ services:
- LIBOVERLAY_SCROLLBAR=0
- GTK2_RC_FILES=/usr/share/themes/Adwaita/gtk-2.0/gtkrc
- GTK_THEME=Adwaita
- CUDA_CACHE_PATH=/lanefollowing/.nv
- CUDA_CACHE_PATH=/lanefollowing/docker/.nv
runtime: nvidia
network_mode: host
init: true
Expand Down
2 changes: 1 addition & 1 deletion docker/scripts/start.sh
Expand Up @@ -7,4 +7,4 @@ nvidia-docker run -it \
--net host \
-v $LANE_FOLLOWING_ROOT_DIR:/lanefollowing \
lgsvl/lanefollowing:latest \
/bin/bash
/bin/bash

0 comments on commit 6e9a6e7

Please sign in to comment.