Skip to content
This repository has been archived by the owner on Mar 17, 2019. It is now read-only.

Commit

Permalink
add melodic dockerfiles
Browse files Browse the repository at this point in the history
  • Loading branch information
AustinDeric committed Jul 25, 2018
1 parent 3829e9b commit 560bd4a
Show file tree
Hide file tree
Showing 5 changed files with 138 additions and 4 deletions.
6 changes: 2 additions & 4 deletions docker/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,11 @@ docker run \
```
This will open a bash shell in the container:
```
python ./gym-gazebo/examples/turtlebot/circuit2_turtlebot_lidar_qlearn.py
python /root/gym-gazebo/examples/turtlebot/circuit2_turtlebot_lidar_qlearn.py
```
then we can connect to our new container
```
export GAZEBO_MASTER_IP=$(docker inspect --format '{{ .NetworkSettings.IPAddress }}' gym-gazebo-turtlebot)
export GAZEBO_MASTER_URI=$GAZEBO_MASTER_IP:11345
sudo gzclient --verbose
export GAZEBO_MASTER_IP=$(docker inspect --format '{{ .NetworkSettings.IPAddress }}' gym-gazebo-turtlebot) && export GAZEBO_MASTER_URI=$GAZEBO_MASTER_IP:11345 && sudo gzclient --verbose
```

Run tests in the base image. Simply enter the following command, all you need is nvidia-docker2 setup:
Expand Down
52 changes: 52 additions & 0 deletions docker/gym-gazebo-turtlebot/melodic/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
FROM austinderic/gym-gazebo:melodic
LABEL maintainer "[email protected]"

#--------------------
# Install Gym-Gazebo Turtlebot dependencies
#------------------

RUN apt-get update && apt-get install -y \
ros-melodic-geometry2 \
ros-melodic-xacro \
ros-melodic-roslint \
ros-melodic-ros-control \
ros-melodic-image-common \
ros-melodic-control-toolbox \
ros-melodic-gazebo-ros-pkgs \
ros-melodic-roslint \
ros-melodic-joystick-drivers \
ros-melodic-ecl \
ros-melodic-pcl-ros \
ros-melodic-yocs-msgs \
libbullet-dev \
libusb-dev \
libsdl-dev \
libsdl-image1.2-dev \
libftdi-dev \
mesa-utils \
&& rm -rf /var/lib/apt/lists/*

RUN pip install scikit-image

#--------------------
# Install Gym-Gazebo Turtlebot Example
#------------------

RUN mkdir -p /root/catkin_ws/src
WORKDIR /root/catkin_ws/src
RUN wstool init
RUN wstool merge https://gist.githubusercontent.com/AustinDeric/c14633f1d5bcabc14307dcca2425d133/raw/266668674782d5e1096ecd13f3ea6dcf5af5248a/gym-gazebo-turtlebot-melodic.rosinstall
RUN wstool update
WORKDIR /root/catkin_ws
RUN /bin/bash -c "source /opt/ros/melodic/setup.bash && catkin build"
RUN echo "source /root/catkin_ws/devel/setup.bash" >> ~/.bashrc

#--------------------
# Setup environment variables
#------------------
RUN echo "export GYM_GAZEBO_WORLD_CIRCUIT2=/root/gym-gazebo/gym_gazebo/envs/assets/worlds/circuit2.world" >> ~/.bashrc
RUN export GYM_GAZEBO_WORLD_CIRCUIT2=/root/gym-gazebo/gym_gazebo/envs/assets/worlds/circuit2.world
RUN echo "export GAZEBO_MODEL_PATH=/root/gym-gazebo/gym_gazebo/envs/assets/models" >> ~/.bashrc

WORKDIR /root/

24 changes: 24 additions & 0 deletions docker/gym-gazebo-turtlebot/melodic/run.bash
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
XAUTH=/tmp/.docker.xauth
if [ ! -f $XAUTH ]
then
xauth_list=$(xauth nlist :0 | sed -e 's/^..../ffff/')
if [ ! -z "$xauth_list" ]
then
echo $xauth_list | xauth -f $XAUTH nmerge -
else
touch $XAUTH
fi
chmod a+r $XAUTH
fi

docker run -it --rm \
--runtime=nvidia \
--env DISPLAY \
--env QT_X11_NO_MITSHM=1 \
--env XAUTHORITY=$XAUTH \
--volume "$XAUTH:$XAUTH" \
--volume "/tmp/.X11-unix:/tmp/.X11-unix" \
--name=gym-gazebo-turtlebot \
--rm \
austinderic/gym-gazebo-turtlebot:melodic \
/bin/bash
38 changes: 38 additions & 0 deletions docker/gym-gazebo/melodic/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
FROM osrf/ros:melodic-desktop-full

# set environment variables
ENV NVIDIA_VISIBLE_DEVICES ${NVIDIA_VISIBLE_DEVICES:-all}
ENV NVIDIA_DRIVER_CAPABILITIES ${NVIDIA_DRIVER_CAPABILITIES:+$NVIDIA_DRIVER_CAPABILITIES,}graphics

# Dependencies for building packages
RUN apt-get update && apt-get install -y \
python-rosinstall \
python-rosinstall-generator \
python-wstool \
build-essential \
python-pip\
&& rm -rf /var/lib/apt/lists/*

# Unofficial ROS installation steps
RUN pip install --upgrade pip

RUN pip install -U catkin_tools


#--------------------
# Install OpenAI gym
#-------------------

RUN pip install gym

#--------------------
# Install gym-gazebo
#--------------------

RUN git clone https://github.com/erlerobot/gym-gazebo.git /root/gym-gazebo
WORKDIR /root/gym-gazebo
RUN pip install -e .




22 changes: 22 additions & 0 deletions docker/gym-gazebo/melodic/run.bash
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
XAUTH=/tmp/.docker.xauth
if [ ! -f $XAUTH ]
then
xauth_list=$(xauth nlist :0 | sed -e 's/^..../ffff/')
if [ ! -z "$xauth_list" ]
then
echo $xauth_list | xauth -f $XAUTH nmerge -
else
touch $XAUTH
fi
chmod a+r $XAUTH
fi

docker run -it --rm \
--runtime=nvidia \
--env DISPLAY \
--env QT_X11_NO_MITSHM=1 \
--env XAUTHORITY=$XAUTH \
--volume "$XAUTH:$XAUTH" \
--volume "/tmp/.X11-unix:/tmp/.X11-unix" \
austinderic/gym-gazebo:melodic \
/bin/bash

0 comments on commit 560bd4a

Please sign in to comment.