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

Commit

Permalink
Devel (#1)
Browse files Browse the repository at this point in the history
WIP
  • Loading branch information
AustinDeric authored Jul 20, 2018
1 parent a371f51 commit 2a9a4a0
Show file tree
Hide file tree
Showing 4 changed files with 92 additions and 23 deletions.
38 changes: 35 additions & 3 deletions docker/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,47 @@ This fodler is setup such that each image has its own folder is an image and eac


## Requirements
nvidia-docker 2
https://github.com/NVIDIA/nvidia-docker
[nvidia-docker 2](https://github.com/NVIDIA/nvidia-docker) allows running cuda-based nueral nets and render displays from the container.

Allows running cuda-based nueral nets and render displays from the container.

## Recommended (Easy) Method
```
docker run \
--runtime=nvidia \
-v="/tmp/.gazebo/:/root/.gazebo/" \
--rm \
-it \
-p 11345:11345 \
-p 11311:11311 \
--name=gym-gazebo-turtlebot \
austinderic/gym-gazebo-turtlebot:kinetic-nvidia9.2 \
/bin/bash
```
This will open a bash shell in the container:
```
python ./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
```

Run tests in the base image. Simply enter the following command, all you need is nvidia-docker2 setup:
```
docker run --runtime=nvidia --rm austinderic/gym-gazebo:kinetic-nvidia9.2 /bin/bash -c "nvidia-smi; echo $(rosversion -d); pip show gym; pip show gym-gazebo"
```
Even easier with docker-compose:
```
docker-compose up
```

## Manual Method
```
mkdir -p ./catkin_ws/src
cd ./catkin_ws/src
wstool initW
wstool merge https://raw.githubusercontent.com/turtlebot/turtlebot/kinetic/turtlebot.rosinstall && wstool merge ../../gym-gazebo/gym_gazebo/envs/installation/gym-gazebo.rosinstall
```

54 changes: 54 additions & 0 deletions docker/gym-gazebo-turtlebot/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
FROM austinderic/gym-gazebo:kinetic-nvidia9.2
LABEL maintainer "[email protected]"

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

RUN apt-get update && apt-get install -y \
ros-kinetic-turtlebot-create \
ros-kinetic-yujin-ocs \
ros-kinetic-yocs-msgs \
ros-kinetic-xacro \
ros-kinetic-roslint \
ros-kinetic-ros-control \
ros-kinetic-image-common \
ros-kinetic-control-toolbox \
ros-kinetic-gazebo-ros-pkgs \
ros-kinetic-roslint \
ros-kinetic-driver-common \
ros-kinetic-navigation \
ros-kinetic-joystick-drivers \
ros-kinetic-kobuki-desktop \
ros-kinetic-kobuki-core \
ros-kinetic-kobuki \
ros-kinetic-kobuki-msgs \
ros-kinetic-ecl \
ros-kinetic-pcl-ros \
libbullet-dev \
libusb-dev \
libsdl-dev \
libsdl-image1.2-dev \
python-skimage \
&& rm -rf /var/lib/apt/lists/*

#--------------------
# 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/3362c86437d88347807beaba3501602e/raw/ecadfddc98a1865dfe60b29d17ff03a513b39279/gym-gazebo.rosinstall
RUN wstool update
WORKDIR /root/catkin_ws
RUN /bin/bash -c "source /opt/ros/kinetic/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

WORKDIR /root/
19 changes: 1 addition & 18 deletions docker/gym-gazebo/kinetic-nvidia9.2/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,26 +1,9 @@
FROM austinderic/ros-desktop-full:kinetic-nvidia9.2
LABEL maintainer "[email protected]"

#--------------------
# Setup nvidia-docker2
#--------------------
# Reference: http://wiki.ros.org/docker/Tutorials/Hardware%20Acceleration

ENV NVIDIA_VISIBLE_DEVICES \
${NVIDIA_VISIBLE_DEVICES:-all}
ENV NVIDIA_DRIVER_CAPABILITIES \
${NVIDIA_DRIVER_CAPABILITIES:+$NVIDIA_DRIVER_CAPABILITIES,}graphics

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

RUN apt-get update && apt-get install -y --no-install-recommends \
python-pip && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*

RUN pip install --upgrade pip
#-------------------

RUN pip install gym

Expand Down
4 changes: 2 additions & 2 deletions gym_gazebo/envs/installation/turtlebot_setup.bash
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,10 @@ else
fi

#copy altered urdf model
cp -r ../assets/urdf/kobuki_urdf/urdf/ catkin_ws/src/kobuki/kobuki_description
cp -r ../assets/urdf/kobuki_urdf/urdf/ ./catkin_ws/src/kobuki/kobuki_description

#copy laser mesh file
cp ../assets/meshes/lidar_lite_v2_withRay.dae catkin_ws/src/kobuki/kobuki_description/meshes
cp ../assets/meshes/lidar_lite_v2_withRay.dae ./catkin_ws/src/kobuki/kobuki_description/meshes

exec bash # reload bash

0 comments on commit 2a9a4a0

Please sign in to comment.