Skip to content

Commit

Permalink
Merge branch 'fix-openai'
Browse files Browse the repository at this point in the history
  • Loading branch information
esquires committed Oct 19, 2018
2 parents c745a94 + 71f9577 commit 74b9dd8
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 17 deletions.
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -418,4 +418,3 @@ interface with internet access from the commands:
Restart docker:

$ sudo service docker restart

20 changes: 8 additions & 12 deletions ci/dockerfiles/ubuntu-16.04
Original file line number Diff line number Diff line change
Expand Up @@ -24,23 +24,16 @@ RUN apt-get update && \
apt-get install -y scrimmage-dependencies && \
/opt/scrimmage/*/setup.sh

# this is for openai gym not installed as part of 3rd-party building so as not
# to confuse python environments see here for installation commands:
# https://github.com/openai/gym#installing-everything
RUN apt-get update && apt-get install -y python-pip python-numpy python-dev cmake zlib1g-dev libjpeg-dev xvfb libav-tools xorg-dev python-opengl libboost-all-dev libsdl2-dev swig
RUN apt-get update && apt-get install -y git ninja-build
RUN git clone https://github.com/openai/gym
WORKDIR /root/gym
RUN git checkout v0.10.5
# TODO DISABLE OPENAI # RUN pip install -e '.[all]'
WORKDIR /root

# these are only used for static analysis of the code
RUN apt-get update && apt-get install -y cppcheck python-pytest python-pip
RUN pip install cpplint

RUN pip install protobuf==3.3.0 grpcio==1.2.1

# for testing openai gym plugin
RUN apt-get update && apt-get install -y git ninja-build
RUN pip install gym

#install clang
RUN apt-get install -y clang

Expand Down Expand Up @@ -88,7 +81,8 @@ WORKDIR /root/scrimmage/scrimmage/build
RUN source ~/.scrimmage/setup.bash && \
export SCRIMMAGE_MISSION_PATH=$SCRIMMAGE_MISSION_PATH:$PWD && \
export PYTHONPATH=$PYTHONPATH:$PWD/../test && \
# TODO DISABLE OPENAI # py.test ../test/test_openai.py && \
py.test ../test/test_openai.py && \
export CTEST_OUTPUT_ON_FAILURE=1 && \
ninja test && \
scrimmage ../missions/straight-no-gui.xml && \
scrimmage ../missions/straight_jsbsim.xml
Expand All @@ -102,6 +96,8 @@ RUN rm * -rf && \

RUN ninja && ninja docs
RUN source ~/.scrimmage/setup.bash && \
export PYTHONPATH=$PYTHONPATH:$PWD/../test && \
export CTEST_OUTPUT_ON_FAILURE=1 && \
ninja test

# Test scrimmage_ros package integration
Expand Down
2 changes: 1 addition & 1 deletion ci/dockerfiles/ubuntu-18.04
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ WORKDIR build
RUN cmake .. -DBUILD_TESTS=ON -DPYTHON_MIN_VERSION=3 -DCMAKE_PREFIX_PATH=~/.local

RUN /bin/bash -c "source ~/.scrimmage/setup.bash && make -j $(($(nproc --all) - 1))"
RUN /bin/bash -c "source ~/.scrimmage/setup.bash && make test"
RUN /bin/bash -c "source ~/.scrimmage/setup.bash && export CTEST_OUTPUT_ON_FAILURE=1 && make test"

WORKDIR /root/scrimmage/scrimmage/python
RUN pip3 install -e .
3 changes: 3 additions & 0 deletions src/common/FileSearch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,9 @@ void FileSearch::clear() {cache_.clear();}

boost::optional<std::string> FileSearch::find_mission(std::string mission,
bool verbose) {
if (!boost::algorithm::ends_with(mission, "xml")) {
mission = mission + ".xml";
}
mission = expand_user(mission);
if (fs::exists(mission)) return mission;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ pybind11::object create_space(
}

pybind11::object get_gym_space(const std::string &type) {
return pybind11::module::import("gym").attr("spaces").attr(type.c_str());
return pybind11::module::import("gym.spaces").attr(type.c_str());
}
} // namespace autonomy
} // namespace scrimmage
14 changes: 12 additions & 2 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,20 @@ set(test_files
test_rtree.cpp
test_simple.cpp
test_state.cpp
test_utilities.cpp)
test_utilities.cpp
test_openai.cpp)

if (NOT ENABLE_PYTHON_BINDINGS)
LIST(REMOVE_ITEM test_files "test_openai.py")
LIST(REMOVE_ITEM test_files "test_openai.cpp")
else()
execute_process(
COMMAND ${PYTHON_EXECUTABLE} -c "import gym"
RESULT_VARIABLE GYM_INSTALLED
)
if (NOT GYM_INSTALLED EQUAL 0)
message("openai gym not found. Not building test_openai.cpp")
LIST(REMOVE_ITEM test_files "test_openai.cpp")
endif()
endif()

foreach(test_file ${test_files})
Expand Down

0 comments on commit 74b9dd8

Please sign in to comment.