diff --git a/CMakeLists.txt b/CMakeLists.txt index 1906c09b..862461c8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -23,10 +23,11 @@ endif() # Options option(WITH_PERCEPTION "Build with perception libraries and tools." ON) option(WITH_SNOPT "Build drake with support for the SNOPT solver." ON) +option(WITH_GUROBI "Build with support for Gurobi" OFF) +option(WITH_MOSEK "Build with support for MOSEK" OFF) option(WITH_IIWA_DRIVER_RLG "Build drake-iiwa-driver, RLG version." ON) option(WITH_IIWA_DRIVER_TRI "Build drake-iiwa-driver, TRI version." OFF) -option(WITH_SCHUNK_DRIVER "Build drake-schunk-driver." ON) option(WITH_ROS "Build the catkin-workspace projects." ON) option(WITH_REACHABILITY_ANALYZER "Build a reachability analyzer (better with snopt)" OFF) option(WITH_TRIMESH "Build trimesh, a python utility for working with triangle meshes" OFF) @@ -64,95 +65,43 @@ set(CMAKE_ARGS_FOR_EXTERNALS "-DCMAKE_MODULE_PATH:STRING=${CMAKE_MODULE_PATH}" ) -find_program(CP cp) -find_program(BAZEL bazel) -if(NOT BAZEL) - message(FATAL_ERROR "Could NOT find bazel executable") -endif() -if(CMAKE_BUILD_TYPE STREQUAL "Debug") - set(BAZEL_COMPILATION_MODE dbg) -else() - set(BAZEL_COMPILATION_MODE opt) -endif() -set(BAZEL_ENV CC=${CMAKE_C_COMPILER} CXX=${CMAKE_CXX_COMPILER}) -set(BAZEL_DRAKE_STARTUP_ARGS "--output_base=/$ENV{HOME}/.spartan-build/drake-build") -set(BAZEL_ARGS --compilation_mode=${BAZEL_COMPILATION_MODE} --config=unsupported_crosstool --cxxopt=-std=c++1y --host_cxxopt=-std=c++1y) -if(CMAKE_VERBOSE_MAKEFILE) - set(BAZEL_ARGS --subcommands ${BAZEL_ARGS}) -endif() -if(WITH_SNOPT) - set(BAZEL_ARGS --config=snopt ${BAZEL_ARGS}) -endif() - -# Check that compiler is NOT ccache. Ccache is not compatible with bazel. -# "readlink -f" is not available on MacOS. We use a one-liner python script -# to get the result that "readlink -f" would give on Linux. -execute_process( - COMMAND python -c "import os,sys; print(os.path.realpath(os.path.expanduser(sys.argv[1])))" "${CMAKE_CXX_COMPILER}" - RESULT_VARIABLE COMPILER_RESULT - OUTPUT_VARIABLE COMPILER_OUTPUT - ) -if(COMPILER_RESULT) - message(FATAL_ERROR "Error while running the compiler ${CMAKE_CXX_COMPILER}.") -endif() -get_filename_component(COMPILER_NAME ${COMPILER_OUTPUT} NAME) -string(STRIP ${COMPILER_NAME} COMPILER_NAME) -if("${COMPILER_NAME}" STREQUAL "ccache") - message(FATAL_ERROR -"Compiler is `ccache`. `ccache` is not compatible with `bazel` which is used to compile `drake`. -To use `ccache` to compile the rest of the project, use the CMake or environment variables \ -CMAKE_C_COMPILER_LAUNCHER and CMAKE_CXX_COMPILER_LAUNCHER to set the path to `ccache`." -) -endif() - - -# Add external projects -# NOTE: For bazel < 0.5.2, two external projects that use Bazel must not build simultaneously. -# One can depend on another one, which will force the order in which they are built. ExternalProject_Add(drake SOURCE_DIR ${source_dir}/drake + BINARY_DIR ${build_dir}/drake BUILD_ALWAYS 1 - BUILD_IN_SOURCE 1 - USES_TERMINAL_BUILD 1 - CONFIGURE_COMMAND "" - BUILD_COMMAND ${BAZEL_ENV} "${BAZEL}" ${BAZEL_DRAKE_STARTUP_ARGS} build ${BAZEL_ARGS} //examples/kuka_iiwa_arm/... //:install @optitrack_driver//src:optitrack_client - INSTALL_COMMAND ${BAZEL_ENV} "${BAZEL}" ${BAZEL_DRAKE_STARTUP_ARGS} run ${BAZEL_ARGS} //:install -- "${CMAKE_INSTALL_PREFIX}" + CMAKE_CACHE_ARGS + -DWITH_SNOPT:BOOL=${WITH_SNOPT} + -DWITH_GUROBI:BOOL=${WITH_GUROBI} + -DWITH_MOSEK:BOOL=${WITH_MOSEK} + ${CMAKE_ARGS_FOR_EXTERNALS} + INSTALL_COMMAND "" ) +ExternalProject_Add(libbot + SOURCE_DIR ${build_dir}/externals/libbot + BINARY_DIR ${build_dir}/libbot + GIT_REPOSITORY "https://github.com/RobotLocomotion/libbot2.git" + GIT_TAG "f260260b7d04c1d85169f985e1a2b4447a6832ef" + BUILD_ALWAYS 1 + CMAKE_CACHE_ARGS + ${CMAKE_ARGS_FOR_EXTERNALS} + DEPENDS drake +) -# This is based on drake's VTK/Qt dependency (see `tools/vtk.bzl` in drake). -# On MacOS, Drake uses homebrew VTK compiled with Qt5 and brew Python -# On Linux, checks distribution -# Ubuntu 14.04: Drake downloads a precompiled version of VTK compiled with Qt4 -# Ubuntu 16.04: Drake downloads a precompiled version of VTK compiled with Qt5 -# Otherwise, assume Qt5 set(USED_QTVERSION 5) +# On MacOS, Drake uses homebrew VTK compiled with Qt5 and brew Python if(APPLE) # VTK version used by drake set(VTK_INSTALL_DIR /usr/local/opt/vtk@8.0) + # To configure `director` set(VTK_ARGS -DVTK_DIR:PATH=${VTK_INSTALL_DIR}/lib/cmake/vtk-8.0 -DPYTHON_CONFIG_EXECUTABLE:FILEPATH=/usr/local/bin/python2.7-config ) - set(QT_ARGS -DQt5_DIR:PATH=/usr/local/opt/qt/lib/cmake/Qt5) + # To configure `config/setup_environment.sh.in` set(VTK_PYTHON_DIR ${VTK_INSTALL_DIR}/lib/python2.7/site-packages) -elseif(UNIX) - find_program(SED sed) - if(NOT SED) - message(FATAL_ERROR "Could NOT find sed executable") - endif() - execute_process(COMMAND "${SED}" -n "/^\\(NAME\\|VERSION_ID\\)=/{s/[^=]*=//;s/\"//g;p}" /etc/os-release - RESULT_VARIABLE SED_RESULT - OUTPUT_VARIABLE SED_OUTPUT - ) - if(SED_RESULT) - message(FATAL_ERROR "Could NOT determine Linux distribution information") - endif() - string(REGEX REPLACE "\n" " " LINUX_DISTRIBUTION "${SED_OUTPUT}") - string(STRIP ${LINUX_DISTRIBUTION} LINUX_DISTRIBUTION) - if(LINUX_DISTRIBUTION STREQUAL "Ubuntu 14.04") - set(USED_QTVERSION 4) - endif() + # For signal-scope + set(QT_ARGS -DQt5_DIR:PATH=/usr/local/opt/qt/lib/cmake/Qt5) endif() ExternalProject_Add(director @@ -171,12 +120,12 @@ ExternalProject_Add(director -DUSE_SYSTEM_VTK:BOOL=ON ${VTK_ARGS} -DUSE_PCL:BOOL=${WITH_PERCEPTION} - -DUSE_APRILTAGS:BOOL=${WITH_PERCEPTION} + -DUSE_APRILTAGS:BOOL=OFF -DUSE_OPENNI2_LCM:BOOL=OFF # don't build OPENNI2 driver, conflicts with openni2_launch in ROS -DUSE_PERCEPTION:BOOL=${WITH_PERCEPTION} ${CMAKE_ARGS_FOR_EXTERNALS} INSTALL_COMMAND "" - DEPENDS drake + DEPENDS libbot drake ) ExternalProject_Add(common_utils @@ -330,24 +279,6 @@ if (WITH_IIWA_DRIVER_RLG OR WITH_IIWA_DRIVER_TRI) endif() -if (WITH_SCHUNK_DRIVER) - - ExternalProject_Add(drake-schunk-driver - SOURCE_DIR ${build_dir}/externals/drake-schunk-driver - GIT_REPOSITORY git@github.com:RobotLocomotion/drake-schunk-driver.git - GIT_TAG a28d35c - BUILD_ALWAYS 1 - BUILD_IN_SOURCE 1 - USES_TERMINAL_BUILD 1 - CONFIGURE_COMMAND "" - BUILD_COMMAND ${BAZEL_ENV} "${BAZEL}" build //... - INSTALL_COMMAND - mkdir -p ${build_dir}/install/bin/ && "${CP}" ${build_dir}/externals/drake-schunk-driver/bazel-bin/src/schunk_driver ${CMAKE_INSTALL_PREFIX}/bin/schunk_driver && - chmod ug+w ${CMAKE_INSTALL_PREFIX}/bin/schunk_driver - DEPENDS drake - ) - -endif() if (WITH_ROS) if ((NOT DEFINED ENV{CMAKE_PREFIX_PATH}) OR (NOT $ENV{CMAKE_PREFIX_PATH} MATCHES ".*ros.*")) diff --git a/director b/director index a39f81d2..923a522c 160000 --- a/director +++ b/director @@ -1 +1 @@ -Subproject commit a39f81d2235a3d900e19786bc0f1e9107f0ae3b0 +Subproject commit 923a522c523472edb8e62ddc8a8c15e97f96b702 diff --git a/drake b/drake index af0d2ff9..b95bece2 160000 --- a/drake +++ b/drake @@ -1 +1 @@ -Subproject commit af0d2ff9bbb8ece23aa59229bfa15fe9041a5063 +Subproject commit b95bece288757d92aa36ebaa27388906728fde6d diff --git a/setup/docker/docker_run.py b/setup/docker/docker_run.py index 75798641..b6131a16 100755 --- a/setup/docker/docker_run.py +++ b/setup/docker/docker_run.py @@ -20,6 +20,8 @@ parser.add_argument("-p", "--passthrough", type=str, default="", help="(optional) extra string that will be tacked onto the docker run command, allows you to pass extra options. Make sure to put this in quotes and leave a space before the first character") + parser.add_argument("-nodudp", "--no_udp", action='store_true', help="(optional) don't expose the udp ports") + args = parser.parse_args() print("running docker container derived from image %s" %args.image) source_dir=os.getcwd() @@ -48,10 +50,11 @@ cmd += " --user %s " % user_name # login as current user # expose UDP ports - cmd += " -p 30200:30200/udp " # expose udp ports for kuka - cmd += " -p 30201:30201/udp " # expose udp ports for kuka - cmd += " -p 1500:1500/udp " # expose udp ports for schunk - cmd += " -p 1501:1501/udp " # expose udp ports for schunk + if not args.no_udp: + cmd += " -p 30200:30200/udp " # expose udp ports for kuka + cmd += " -p 30201:30201/udp " # expose udp ports for kuka + cmd += " -p 1500:1500/udp " # expose udp ports for schunk + cmd += " -p 1501:1501/udp " # expose udp ports for schunk cmd += " " + args.passthrough + " " @@ -63,7 +66,7 @@ cmd += "--entrypoint=\"%(entrypoint)s\" " % {"entrypoint": args.entrypoint} else: cmd += "-it " - cmd += args.image + cmd += image_name cmd_endxhost = "xhost -local:root" print("command = \n \n", cmd, "\n", cmd_endxhost) diff --git a/setup/docker/run_jenkins.sh b/setup/docker/run_jenkins.sh index ba19d861..10cdc441 100755 --- a/setup/docker/run_jenkins.sh +++ b/setup/docker/run_jenkins.sh @@ -5,7 +5,7 @@ mkdir build cd build . /opt/ros/kinetic/setup.bash -cmake -DWITH_PERCEPTION:BOOL=ON -DWITH_TRIMESH:BOOL=ON -DWITH_SCHUNK_DRIVER:BOOL=ON -DWITH_IIWA_DRIVER_RLG:BOOL=ON -DWITH_ROS:BOOL=ON -DWITH_REACHABILITY_ANALYZER:BOOL=ON .. +cmake -DWITH_PERCEPTION:BOOL=ON -DWITH_TRIMESH:BOOL=OFF -DWITH_SCHUNK_DRIVER:BOOL=ON -DWITH_IIWA_DRIVER_RLG:BOOL=ON -DWITH_ROS:BOOL=ON -DWITH_REACHABILITY_ANALYZER:BOOL=ON .. exit_status=$? if [ ! $exit_status -eq 0 ]; then echo "Error code in CMake: " $exit_status diff --git a/setup/docker/spartan.dockerfile b/setup/docker/spartan.dockerfile index 41f486e8..e0e8c326 100644 --- a/setup/docker/spartan.dockerfile +++ b/setup/docker/spartan.dockerfile @@ -1,4 +1,4 @@ -FROM nvidia/cuda:8.0-devel-ubuntu16.04 + FROM nvidia/cuda:8.0-devel-ubuntu16.04 ARG USER_NAME ARG USER_PASSWORD @@ -16,6 +16,7 @@ RUN usermod -u $USER_ID $USER_NAME RUN groupmod -g $USER_GID $USER_NAME +# working directory is /home/$USER_NAME WORKDIR /home/$USER_NAME # require no sudo pw in docker # RUN echo $USER_PASSWORD | sudo -S bash -c 'echo "'$USER_NAME' ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/docker-user' && printf "\n" @@ -42,8 +43,13 @@ RUN mkdir -p .config/terminator COPY ./setup/docker/terminator_config .config/terminator/config RUN chown $USER_NAME:$USER_NAME -R .config +# setup bazel bashrc +RUN echo "startup --output_base=/home/$USER_NAME/.spartan-build" >> .bazelrc + # change ownership of everything to our user -RUN cd $WORKDIR && chown $USER_NAME:$USER_NAME -R . +RUN cd /home/$USER_NAME && chown $USER_NAME:$USER_NAME -R . + + ENTRYPOINT bash -c "source ~/spartan/setup/docker/entrypoint.sh && /bin/bash" diff --git a/setup/ubuntu/16.04/install_prereqs.sh b/setup/ubuntu/16.04/install_prereqs.sh index 9fb38fb2..2b4b4e2f 100755 --- a/setup/ubuntu/16.04/install_prereqs.sh +++ b/setup/ubuntu/16.04/install_prereqs.sh @@ -33,7 +33,10 @@ apt install --no-install-recommends \ qtmultimedia5-dev \ qtscript5-dev \ qttools5-dev \ - libcgal-dev # needed for April Tag detection + libcgal-dev \ + libxmu-dev \ + libxi-dev + # Install ROS Kinetic apt install -y --no-install-recommends lsb-release diff --git a/src/ReachabilityAnalyzer/CMakeLists.txt b/src/ReachabilityAnalyzer/CMakeLists.txt index b820e15d..4eafd5dc 100644 --- a/src/ReachabilityAnalyzer/CMakeLists.txt +++ b/src/ReachabilityAnalyzer/CMakeLists.txt @@ -11,6 +11,8 @@ include_directories(${Eigen3_INCLUDE_DIR}) find_package(VTK REQUIRED) include_directories(${VTK_INCLUDE_DIRS}) +find_package(yaml-cpp REQUIRED) + link_directories(${CMAKE_INSTALL_PREFIX}/lib) add_executable(reachability_analyzer reachability_analyzer.cpp reachability_analyzer.hpp) @@ -20,6 +22,7 @@ target_link_libraries(reachability_analyzer ${drake_LIBRARIES} gflags_shared ${VTK_LIBRARIES} - RemoteTreeViewerWrapper) + RemoteTreeViewerWrapper + yaml-cpp) install(TARGETS reachability_analyzer DESTINATION bin)