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

Commit ee25ed7

Browse files
committed
Update dockerfile approach for gym-gazebo:
- visualizations using gzweb - add dockerfiles for melodic and kinetic - seperate gym-gazebo from applications
1 parent a371f51 commit ee25ed7

File tree

93 files changed

+263964
-39
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

93 files changed

+263964
-39
lines changed

docker/Dockerfile

-36
This file was deleted.

docker/README.md

+33-3
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,45 @@ This fodler is setup such that each image has its own folder is an image and eac
88

99

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

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

1614
## Recommended (Easy) Method
15+
```
16+
docker run \
17+
--runtime=nvidia \
18+
-v="/tmp/.gazebo/:/root/.gazebo/" \
19+
--rm \
20+
-it \
21+
-p 11345:11345 \
22+
-p 11311:11311 \
23+
--name=gym-gazebo-turtlebot \
24+
austinderic/gym-gazebo-turtlebot:kinetic-nvidia9.2 \
25+
/bin/bash
26+
```
27+
This will open a bash shell in the container:
28+
```
29+
python /root/gym-gazebo/examples/turtlebot/circuit2_turtlebot_lidar_qlearn.py
30+
```
31+
then we can connect to our new container
32+
```
33+
export GAZEBO_MASTER_IP=$(docker inspect --format '{{ .NetworkSettings.IPAddress }}' gym-gazebo-turtlebot) && export GAZEBO_MASTER_URI=$GAZEBO_MASTER_IP:11345 && sudo gzclient --verbose
34+
```
35+
1736
Run tests in the base image. Simply enter the following command, all you need is nvidia-docker2 setup:
1837
```
1938
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"
39+
```
40+
Even easier with docker-compose:
41+
```
42+
docker-compose up
2043
```
2144

45+
## Manual Method
46+
```
47+
mkdir -p ./catkin_ws/src
48+
cd ./catkin_ws/src
49+
wstool initW
50+
wstool merge https://raw.githubusercontent.com/turtlebot/turtlebot/kinetic/turtlebot.rosinstall && wstool merge ../../gym-gazebo/gym_gazebo/envs/installation/gym-gazebo.rosinstall
51+
```
2252

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
# docker build -t austinderic/gym-gazebo-turtlebot:kinetic
2+
FROM austinderic/gym-gazebo:kinetic
3+
LABEL maintainer "[email protected]"
4+
5+
#--------------------
6+
# Install gzweb
7+
#------------------
8+
9+
RUN curl -sL https://deb.nodesource.com/setup_8.x | bash -
10+
RUN apt-get update && apt-get install -y \
11+
imagemagick \
12+
nodejs \
13+
libjansson-dev \
14+
&& rm -rf /var/lib/apt/lists/*
15+
WORKDIR /root
16+
RUN hg clone https://bitbucket.org/osrf/gzweb
17+
WORKDIR /root/gzweb
18+
RUN hg up gzweb_1.4.0
19+
RUN echo "source /usr/share/gazebo/setup.sh" >> ~/.bashrc
20+
RUN npm run deploy -m
21+
22+
#--------------------
23+
# Install Gym-Gazebo Turtlebot dependencies
24+
#------------------
25+
26+
RUN apt-get update && apt-get install -y \
27+
ros-kinetic-depthimage-to-laserscan \
28+
ros-kinetic-turtlebot-create \
29+
ros-kinetic-yujin-ocs \
30+
ros-kinetic-yocs-msgs \
31+
ros-kinetic-xacro \
32+
ros-kinetic-roslint \
33+
ros-kinetic-ros-control \
34+
ros-kinetic-image-common \
35+
ros-kinetic-control-toolbox \
36+
ros-kinetic-gazebo-ros-pkgs \
37+
ros-kinetic-roslint \
38+
ros-kinetic-driver-common \
39+
ros-kinetic-navigation \
40+
ros-kinetic-joystick-drivers \
41+
ros-kinetic-kobuki-desktop \
42+
ros-kinetic-kobuki-core \
43+
ros-kinetic-kobuki \
44+
ros-kinetic-kobuki-msgs \
45+
ros-kinetic-ecl \
46+
ros-kinetic-pcl-ros \
47+
libbullet-dev \
48+
libusb-dev \
49+
libsdl-dev \
50+
libsdl-image1.2-dev \
51+
python-skimage \
52+
mesa-utils \
53+
&& rm -rf /var/lib/apt/lists/*
54+
55+
#--------------------
56+
# Install Gym-Gazebo Turtlebot Example
57+
#------------------
58+
59+
RUN mkdir -p /root/catkin_ws/src
60+
WORKDIR /root/catkin_ws/src
61+
RUN wstool init
62+
RUN wstool merge https://gist.githubusercontent.com/AustinDeric/3362c86437d88347807beaba3501602e/raw/ecadfddc98a1865dfe60b29d17ff03a513b39279/gym-gazebo.rosinstall
63+
RUN wstool update
64+
WORKDIR /root/catkin_ws
65+
RUN /bin/bash -c "source /opt/ros/kinetic/setup.bash && catkin build"
66+
RUN echo "source /root/catkin_ws/devel/setup.bash" >> ~/.bashrc
67+
RUN echo "export GYM_GAZEBO_WORLD_CIRCUIT2=/root/gym-gazebo/gym_gazebo/envs/assets/worlds/circuit2.world" >> ~/.bashrc
68+
RUN export GYM_GAZEBO_WORLD_CIRCUIT2=/root/gym-gazebo/gym_gazebo/envs/assets/worlds/circuit2.world
69+
RUN echo "export GAZEBO_MODEL_PATH=/root/gym-gazebo/gym_gazebo/envs/assets/models" >> ~/.bashrc
70+
71+
COPY ./kobuki_description/ /root/gzweb/http/client/assets/kobuki_description/
72+
COPY ./turtlebot_description/ /root/gzweb/http/client/assets/turtlebot_description/
73+
74+
WORKDIR /root/
75+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# generated from catkin/cmake/template/pkgConfig-version.cmake.in
2+
set(PACKAGE_VERSION "0.7.6")
3+
4+
set(PACKAGE_VERSION_EXACT False)
5+
set(PACKAGE_VERSION_COMPATIBLE False)
6+
7+
if("${PACKAGE_FIND_VERSION}" VERSION_EQUAL "${PACKAGE_VERSION}")
8+
set(PACKAGE_VERSION_EXACT True)
9+
set(PACKAGE_VERSION_COMPATIBLE True)
10+
endif()
11+
12+
if("${PACKAGE_FIND_VERSION}" VERSION_LESS "${PACKAGE_VERSION}")
13+
set(PACKAGE_VERSION_COMPATIBLE True)
14+
endif()
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,198 @@
1+
# generated from catkin/cmake/template/pkgConfig.cmake.in
2+
3+
# append elements to a list and remove existing duplicates from the list
4+
# copied from catkin/cmake/list_append_deduplicate.cmake to keep pkgConfig
5+
# self contained
6+
macro(_list_append_deduplicate listname)
7+
if(NOT "${ARGN}" STREQUAL "")
8+
if(${listname})
9+
list(REMOVE_ITEM ${listname} ${ARGN})
10+
endif()
11+
list(APPEND ${listname} ${ARGN})
12+
endif()
13+
endmacro()
14+
15+
# append elements to a list if they are not already in the list
16+
# copied from catkin/cmake/list_append_unique.cmake to keep pkgConfig
17+
# self contained
18+
macro(_list_append_unique listname)
19+
foreach(_item ${ARGN})
20+
list(FIND ${listname} ${_item} _index)
21+
if(_index EQUAL -1)
22+
list(APPEND ${listname} ${_item})
23+
endif()
24+
endforeach()
25+
endmacro()
26+
27+
# pack a list of libraries with optional build configuration keywords
28+
# copied from catkin/cmake/catkin_libraries.cmake to keep pkgConfig
29+
# self contained
30+
macro(_pack_libraries_with_build_configuration VAR)
31+
set(${VAR} "")
32+
set(_argn ${ARGN})
33+
list(LENGTH _argn _count)
34+
set(_index 0)
35+
while(${_index} LESS ${_count})
36+
list(GET _argn ${_index} lib)
37+
if("${lib}" MATCHES "^(debug|optimized|general)$")
38+
math(EXPR _index "${_index} + 1")
39+
if(${_index} EQUAL ${_count})
40+
message(FATAL_ERROR "_pack_libraries_with_build_configuration() the list of libraries '${ARGN}' ends with '${lib}' which is a build configuration keyword and must be followed by a library")
41+
endif()
42+
list(GET _argn ${_index} library)
43+
list(APPEND ${VAR} "${lib}${CATKIN_BUILD_CONFIGURATION_KEYWORD_SEPARATOR}${library}")
44+
else()
45+
list(APPEND ${VAR} "${lib}")
46+
endif()
47+
math(EXPR _index "${_index} + 1")
48+
endwhile()
49+
endmacro()
50+
51+
# unpack a list of libraries with optional build configuration keyword prefixes
52+
# copied from catkin/cmake/catkin_libraries.cmake to keep pkgConfig
53+
# self contained
54+
macro(_unpack_libraries_with_build_configuration VAR)
55+
set(${VAR} "")
56+
foreach(lib ${ARGN})
57+
string(REGEX REPLACE "^(debug|optimized|general)${CATKIN_BUILD_CONFIGURATION_KEYWORD_SEPARATOR}(.+)$" "\\1;\\2" lib "${lib}")
58+
list(APPEND ${VAR} "${lib}")
59+
endforeach()
60+
endmacro()
61+
62+
63+
if(kobuki_description_CONFIG_INCLUDED)
64+
return()
65+
endif()
66+
set(kobuki_description_CONFIG_INCLUDED TRUE)
67+
68+
# set variables for source/devel/install prefixes
69+
if("FALSE" STREQUAL "TRUE")
70+
set(kobuki_description_SOURCE_PREFIX /tmp/binarydeb/ros-kinetic-kobuki-description-0.7.6)
71+
set(kobuki_description_DEVEL_PREFIX /tmp/binarydeb/ros-kinetic-kobuki-description-0.7.6/obj-x86_64-linux-gnu/devel)
72+
set(kobuki_description_INSTALL_PREFIX "")
73+
set(kobuki_description_PREFIX ${kobuki_description_DEVEL_PREFIX})
74+
else()
75+
set(kobuki_description_SOURCE_PREFIX "")
76+
set(kobuki_description_DEVEL_PREFIX "")
77+
set(kobuki_description_INSTALL_PREFIX /opt/ros/kinetic)
78+
set(kobuki_description_PREFIX ${kobuki_description_INSTALL_PREFIX})
79+
endif()
80+
81+
# warn when using a deprecated package
82+
if(NOT "" STREQUAL "")
83+
set(_msg "WARNING: package 'kobuki_description' is deprecated")
84+
# append custom deprecation text if available
85+
if(NOT "" STREQUAL "TRUE")
86+
set(_msg "${_msg} ()")
87+
endif()
88+
message("${_msg}")
89+
endif()
90+
91+
# flag project as catkin-based to distinguish if a find_package()-ed project is a catkin project
92+
set(kobuki_description_FOUND_CATKIN_PROJECT TRUE)
93+
94+
if(NOT " " STREQUAL " ")
95+
set(kobuki_description_INCLUDE_DIRS "")
96+
set(_include_dirs "")
97+
if(NOT "https://github.com/yujinrobot/kobuki/issues " STREQUAL " ")
98+
set(_report "Check the issue tracker 'https://github.com/yujinrobot/kobuki/issues' and consider creating a ticket if the problem has not been reported yet.")
99+
elseif(NOT "http://ros.org/wiki/kobuki_description " STREQUAL " ")
100+
set(_report "Check the website 'http://ros.org/wiki/kobuki_description' for information and consider reporting the problem.")
101+
else()
102+
set(_report "Report the problem to the maintainer 'Younghun Ju <[email protected]>' and request to fix the problem.")
103+
endif()
104+
foreach(idir ${_include_dirs})
105+
if(IS_ABSOLUTE ${idir} AND IS_DIRECTORY ${idir})
106+
set(include ${idir})
107+
elseif("${idir} " STREQUAL "include ")
108+
get_filename_component(include "${kobuki_description_DIR}/../../../include" ABSOLUTE)
109+
if(NOT IS_DIRECTORY ${include})
110+
message(FATAL_ERROR "Project 'kobuki_description' specifies '${idir}' as an include dir, which is not found. It does not exist in '${include}'. ${_report}")
111+
endif()
112+
else()
113+
message(FATAL_ERROR "Project 'kobuki_description' specifies '${idir}' as an include dir, which is not found. It does neither exist as an absolute directory nor in '/opt/ros/kinetic/${idir}'. ${_report}")
114+
endif()
115+
_list_append_unique(kobuki_description_INCLUDE_DIRS ${include})
116+
endforeach()
117+
endif()
118+
119+
set(libraries "")
120+
foreach(library ${libraries})
121+
# keep build configuration keywords, target names and absolute libraries as-is
122+
if("${library}" MATCHES "^(debug|optimized|general)$")
123+
list(APPEND kobuki_description_LIBRARIES ${library})
124+
elseif(TARGET ${library})
125+
list(APPEND kobuki_description_LIBRARIES ${library})
126+
elseif(IS_ABSOLUTE ${library})
127+
list(APPEND kobuki_description_LIBRARIES ${library})
128+
else()
129+
set(lib_path "")
130+
set(lib "${library}-NOTFOUND")
131+
# since the path where the library is found is returned we have to iterate over the paths manually
132+
foreach(path /opt/ros/kinetic/lib;/opt/ros/kinetic/lib)
133+
find_library(lib ${library}
134+
PATHS ${path}
135+
NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH)
136+
if(lib)
137+
set(lib_path ${path})
138+
break()
139+
endif()
140+
endforeach()
141+
if(lib)
142+
_list_append_unique(kobuki_description_LIBRARY_DIRS ${lib_path})
143+
list(APPEND kobuki_description_LIBRARIES ${lib})
144+
else()
145+
# as a fall back for non-catkin libraries try to search globally
146+
find_library(lib ${library})
147+
if(NOT lib)
148+
message(FATAL_ERROR "Project '${PROJECT_NAME}' tried to find library '${library}'. The library is neither a target nor built/installed properly. Did you compile project 'kobuki_description'? Did you find_package() it before the subdirectory containing its code is included?")
149+
endif()
150+
list(APPEND kobuki_description_LIBRARIES ${lib})
151+
endif()
152+
endif()
153+
endforeach()
154+
155+
set(kobuki_description_EXPORTED_TARGETS "")
156+
# create dummy targets for exported code generation targets to make life of users easier
157+
foreach(t ${kobuki_description_EXPORTED_TARGETS})
158+
if(NOT TARGET ${t})
159+
add_custom_target(${t})
160+
endif()
161+
endforeach()
162+
163+
set(depends "urdf;xacro")
164+
foreach(depend ${depends})
165+
string(REPLACE " " ";" depend_list ${depend})
166+
# the package name of the dependency must be kept in a unique variable so that it is not overwritten in recursive calls
167+
list(GET depend_list 0 kobuki_description_dep)
168+
list(LENGTH depend_list count)
169+
if(${count} EQUAL 1)
170+
# simple dependencies must only be find_package()-ed once
171+
if(NOT ${kobuki_description_dep}_FOUND)
172+
find_package(${kobuki_description_dep} REQUIRED NO_MODULE)
173+
endif()
174+
else()
175+
# dependencies with components must be find_package()-ed again
176+
list(REMOVE_AT depend_list 0)
177+
find_package(${kobuki_description_dep} REQUIRED NO_MODULE ${depend_list})
178+
endif()
179+
_list_append_unique(kobuki_description_INCLUDE_DIRS ${${kobuki_description_dep}_INCLUDE_DIRS})
180+
181+
# merge build configuration keywords with library names to correctly deduplicate
182+
_pack_libraries_with_build_configuration(kobuki_description_LIBRARIES ${kobuki_description_LIBRARIES})
183+
_pack_libraries_with_build_configuration(_libraries ${${kobuki_description_dep}_LIBRARIES})
184+
_list_append_deduplicate(kobuki_description_LIBRARIES ${_libraries})
185+
# undo build configuration keyword merging after deduplication
186+
_unpack_libraries_with_build_configuration(kobuki_description_LIBRARIES ${kobuki_description_LIBRARIES})
187+
188+
_list_append_unique(kobuki_description_LIBRARY_DIRS ${${kobuki_description_dep}_LIBRARY_DIRS})
189+
list(APPEND kobuki_description_EXPORTED_TARGETS ${${kobuki_description_dep}_EXPORTED_TARGETS})
190+
endforeach()
191+
192+
set(pkg_cfg_extras "")
193+
foreach(extra ${pkg_cfg_extras})
194+
if(NOT IS_ABSOLUTE ${extra})
195+
set(extra ${kobuki_description_DIR}/${extra})
196+
endif()
197+
include(${extra})
198+
endforeach()
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<!--
2+
Useful for debugging or just viewing the kobuki model/urdf/transform.
3+
-->
4+
<launch>
5+
<arg name="urdf_file" default="$(find xacro)/xacro --inorder '$(find kobuki_description)/urdf/kobuki_standalone.urdf.xacro'"/>
6+
<param name="robot_description" command="$(arg urdf_file)"/>
7+
8+
<node pkg="robot_state_publisher" type="robot_state_publisher" name="robot_state_publisher" output="screen">
9+
<param name="publish_frequency" type="double" value="5.0"/>
10+
</node>
11+
<node name="joint_state_publisher" pkg="joint_state_publisher" type="joint_state_publisher">
12+
<param name="use_gui" value="true"/>
13+
</node>
14+
15+
<node name="rviz" pkg="rviz" type="rviz" args="-d $(find kobuki_description)/rviz/model.rviz"/>
16+
</launch>
Loading
Loading

0 commit comments

Comments
 (0)