Skip to content

Commit a130293

Browse files
whikwonseungjaeryanlee
authored andcommitted
Add dockerfile, docker training script (#38)
* Add td3, td3fd reacher training scripts * Add sacfd reacher.v2 training script * Change sac hyperparameter to be equal to sacfd * Adjust black formatting * Modify dockerfile * Changed install branch master to kinetic-devel * Added dockerignore * Update docker related files * Modify shell script * Add pip installation * Fix pip issue * tmp commit * Modify docker related files * Remove unused conditions * Remove python3 scripts * Remove unused files * Recover sac parameter
1 parent 35f5524 commit a130293

File tree

3 files changed

+57
-21
lines changed

3 files changed

+57
-21
lines changed

.dockerignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
**

Dockerfile

+42-21
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,61 @@
1-
FROM ubuntu:16.04
2-
ENV HOME /root
1+
FROM nvidia/cuda:9.0-cudnn7-devel-ubuntu16.04
2+
ENV ROS_DISTRO kinetic
3+
ENV HOME=/root
4+
ENV CATKIN_WS=/root/catkin_ws
5+
36
SHELL ["/bin/bash", "-c"]
47
RUN apt-get update && apt-get -y upgrade && apt-get -y install git wget vim
58

69
# install ROS
710
RUN sh -c 'echo "deb http://packages.ros.org/ros/ubuntu xenial main" > /etc/apt/sources.list.d/ros-latest.list'
811
RUN apt-key adv --keyserver hkp://ha.pool.sks-keyservers.net:80 --recv-key 421C365BD9FF1F717815A3895523BAEEB01FA116
912
RUN apt-get update -y && apt-get upgrade -y
10-
RUN apt-get install -y ros-kinetic-desktop-full ros-kinetic-rqt-*
11-
RUN rosdep init
12-
RUN rosdep update
13+
RUN apt-get install -y ros-${ROS_DISTRO}-desktop-full ros-${ROS_DISTRO}-rqt-*
14+
RUN rosdep init && rosdep update
1315
RUN apt install -y python-rosinstall python-rosinstall-generator python-wstool build-essential
14-
RUN apt-get install -y ros-kinetic-ros-controllers ros-kinetic-gazebo* ros-kinetic-moveit* ros-kinetic-industrial-core
16+
RUN apt-get install -y ros-${ROS_DISTRO}-ros-controllers ros-${ROS_DISTRO}-gazebo* ros-${ROS_DISTRO}-moveit* ros-${ROS_DISTRO}-industrial-core
17+
RUN rm -rf /var/lib/apt/lists/*
1518

1619
# ROS setting
17-
RUN mkdir -p $HOME/catkin_ws/src
18-
WORKDIR $HOME/catkin_ws/
19-
RUN echo "source /opt/ros/kinetic/setup.bash" >> $HOME/.bashrc
20-
RUN echo "export PYTHONPATH=/opt/ros/kinetic/lib/python2.7/dist-packages" >> $HOME/.bashrc
21-
RUN echo "source $HOME/catkin_ws/devel/setup.bash" >> $HOME/.bashrc
20+
RUN mkdir -p $CATKIN_WS/src
21+
WORKDIR $CATKIN_WS
22+
RUN echo "source /opt/ros/${ROS_DISTRO}/setup.bash" >> $HOME/.bashrc
23+
RUN echo "export PYTHONPATH=/opt/ros/${ROS_DISTRO}/lib/python2.7/dist-packages" >> $HOME/.bashrc
24+
RUN echo "source $CATKIN_WS/devel/setup.bash" >> $HOME/.bashrc
2225
RUN echo "export ROS_MASTER_URI=http://localhost:11311" >> $HOME/.bashrc
2326
RUN echo "export ROS_HOSTNAME=localhost" >> $HOME/.bashrc
2427
RUN source $HOME/.bashrc
2528

2629
# clone ROS packages
2730
RUN cd src/ && \
28-
git clone https://github.com/kairproject/DynamixelSDK.git && \
29-
git clone https://github.com/kairproject/dynamixel-workbench.git && \
30-
git clone https://github.com/kairproject/dynamixel-workbench-msgs.git && \
31-
git clone https://github.com/kairproject/open_manipulator.git && \
32-
git clone https://github.com/kairproject/open_manipulator_msgs.git && \
33-
git clone https://github.com/kairproject/open_manipulator_simulations.git && \
34-
git clone https://github.com/kairproject/robotis_manipulator.git
31+
git clone -b ${ROS_DISTRO}-devel https://github.com/kairproject/DynamixelSDK.git && \
32+
git clone -b ${ROS_DISTRO}-devel https://github.com/kairproject/dynamixel-workbench.git && \
33+
git clone -b ${ROS_DISTRO}-devel https://github.com/kairproject/dynamixel-workbench-msgs.git && \
34+
git clone -b ${ROS_DISTRO}-devel https://github.com/kairproject/open_manipulator.git && \
35+
git clone -b ${ROS_DISTRO}-devel https://github.com/kairproject/open_manipulator_msgs.git && \
36+
git clone -b ${ROS_DISTRO}-devel https://github.com/kairproject/open_manipulator_simulations.git && \
37+
git clone -b ${ROS_DISTRO}-devel https://github.com/kairproject/robotis_manipulator.git && \
38+
git clone https://github.com/kairproject/kair_algorithms_draft.git
39+
40+
RUN cd src/DynamixelSDK/python && python setup.py install
41+
42+
# install pip
43+
RUN wget https://bootstrap.pypa.io/get-pip.py
44+
RUN python2.7 get-pip.py
3545

36-
RUN cd $HOME/catkin_ws/src/DynamixelSDK/python && python setup.py install
46+
# gym requirements
47+
RUN apt-get update && apt-get install -y python3-opengl zlib1g-dev libjpeg-dev patchelf \
48+
cmake swig libboost-all-dev libsdl2-dev libosmesa6-dev xvfb ffmpeg
49+
50+
# install repository requirements
51+
RUN apt-get remove -y python-psutil
52+
RUN cd src/kair_algorithms_draft/scripts && python2.7 -m pip install -r requirements.txt
53+
RUN python2.7 -m pip install gym['Box2d']
3754

3855
# permission setting
39-
COPY ./modud_kair_control $HOME/catkin_ws/src/modud_kair_control
40-
RUN chmod -R +x $HOME/catkin_ws/src/modud_kair_control/
56+
RUN chmod +x -R src/kair_algorithms_draft
57+
58+
# catkin_make
59+
RUN source /opt/ros/${ROS_DISTRO}/setup.bash && catkin_make
60+
61+
ENTRYPOINT ["/root/catkin_ws/src/kair_algorithms_draft/docker_train.sh"]

docker_train.sh

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#!/bin/bash
2+
3+
ROS_DISTRO=kinetic
4+
CATKIN_WS=/root/catkin_ws
5+
KAIR=$CATKIN_WS/src/kair_algorithms_draft
6+
7+
if [ "$1" == "lunarlander" ]; then
8+
cd $KAIR/scripts; \
9+
python run_lunarlander_continuous.py --algo $2 --off-render
10+
elif [ "$1" == "openmanipulator" ]; then
11+
echo "Working"
12+
else
13+
echo "Unknown parameter"
14+
fi

0 commit comments

Comments
 (0)