From 7716256ef09845dc039225376b453358438eb0c6 Mon Sep 17 00:00:00 2001 From: Joseph Mirabel <jmirabel@laas.fr> Date: Tue, 22 Mar 2016 14:25:47 +0100 Subject: [PATCH] Add travis support --- .travis.yml | 38 +++++++++++++++ .travis/build | 115 ++++++++++++++++++++++++++++++++++++++++++++++ .travis/run | 15 ++++++ .travis/script.py | 36 +++++++++++++++ 4 files changed, 204 insertions(+) create mode 100644 .travis.yml create mode 100755 .travis/build create mode 100755 .travis/run create mode 100644 .travis/script.py diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..5fcd13c --- /dev/null +++ b/.travis.yml @@ -0,0 +1,38 @@ +language: cpp +sudo: required +dist: trusty +branches: + only: + - master + - devel +compiler: +- gcc +addons: + apt: + packages: + - g++ + - cmake + - libboost-dev + - libboost-filesystem-dev + - libboost-system-dev + - git + - flex + - bison + - asciidoc + - autoconf + - source-highlight + - doxygen + - libtinyxml-dev + - libltdl-dev + - liblog4cxx10-dev + - python2.7-dev + - doxygen-latex +before_install: +- git submodule update --init --recursive +- sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list' +- sudo apt-key adv --keyserver hkp://ha.pool.sks-keyservers.net --recv-key 0xB01FA116 +- sudo apt-get update -qq +- sudo apt-get install -qq liburdfdom-dev libassimp-dev ros-indigo-xacro ros-indigo-kdl-parser ros-indigo-common-msgs ros-indigo-tf ros-indigo-tf-conversions ros-indigo-libccd ros-indigo-octomap ros-indigo-resource-retriever ros-indigo-srdfdom ros-indigo-pr2-robot libomniorb4-dev omniorb-nameserver omniidl omniidl-python + +script: ./.travis/build +# after_script: ./.travis/run diff --git a/.travis/build b/.travis/build new file mode 100755 index 0000000..54ecd1f --- /dev/null +++ b/.travis/build @@ -0,0 +1,115 @@ +#!/bin/bash +set -ev + +# Directories. +root_dir=`pwd` +build_dir="$root_dir/_travis/build" +install_dir="$root_dir/_travis/install" +export DEVEL_DIR="$root_dir/_travis/" + +# Shortcuts. +git_clone="git clone --recursive --quiet" +git_branch=devel + +# Create layout. +rm -rf "$build_dir" "$install_dir" +mkdir -p "$build_dir" +mkdir -p "$install_dir" + +# Setup environment variables. +export LD_LIBRARY_PATH="$install_dir/lib:$LD_LIBRARY_PATH" +export LD_LIBRARY_PATH="$install_dir/lib/`dpkg-architecture -qDEB_BUILD_MULTIARCH`:$LD_LIBRARY_PATH" +export PKG_CONFIG_PATH="$install_dir/lib/pkgconfig:$PKG_CONFIG_PATH" +export PKG_CONFIG_PATH="$install_dir/lib/`dpkg-architecture -qDEB_BUILD_MULTIARCH`/pkgconfig:$PKG_CONFIG_PATH" + +cmake_args="-DCMAKE_INSTALL_LIBDIR=lib -DCMAKE_INSTALL_PREFIX:STRING='$install_dir' -DCMAKE_BUILD_TYPE=Release" +make_args="-s -j4" + +install_eigen3() +{ + echo "--> Compiling Eigen" + mkdir -p "$build_dir" + cd "$build_dir" + wget --quiet -O - "http://bitbucket.org/eigen/eigen/get/3.2.4.tar.bz2" | tar -xj + mv eigen-eigen-10219c95fe65 eigen3 + cd "$build_dir/eigen3" + mkdir build + cd build + cmake $cmake_args -Dpkg_config_libdir="$install_dir/lib" .. + make $make_args install +} + +install_doxygen() +{ + echo "--> Compiling Doxygen" + mkdir -p "$build_dir" + cd "$build_dir" + wget --quiet -O - "https://github.com/doxygen/doxygen/archive/Release_1_8_10.tar.gz" | tar -xz; + cd "$build_dir/doxygen-Release_1_8_10" + mkdir build + cd build + cmake $cmake_args .. + make $make_args install +} + +check_dependency() +{ + echo "--> Compiling $1" + mkdir -p "$build_dir/$1" + cd "$build_dir" + $git_clone "git://github.com/$1" "$1" + cd "$build_dir/$1" + mkdir build + cd build + cmake $cmake_args .. + make $make_args +} + +install_dependency() +{ + echo "--> Compiling $1" + mkdir -p "$build_dir/$1" + cd "$build_dir" + if [ "$#" -eq "2" ]; then + branch=$2 + else + branch=$git_branch + fi + $git_clone --branch $branch "git://github.com/$1" "$1" + cd "$build_dir/$1" + mkdir build + cd build + cmake $cmake_args .. + make $make_args install +} + +# Install dependencies + +install_eigen3 +pkg-config --exists "eigen3 >= 3.2.4" --print-errors +if [ ! "$?" -eq "0" ]; then echo "Wrong eigen version"; exit 1; fi + +install_doxygen + +wget --quiet -O $DEVEL_DIR/config.sh https://raw.githubusercontent.com/humanoid-path-planner/hpp-doc/master/doc/config.sh +source $DEVEL_DIR/config.sh + +install_dependency humanoid-path-planner/hpp-util devel +install_dependency humanoid-path-planner/hpp-fcl devel + +install_dependency humanoid-path-planner/hpp-model devel +install_dependency humanoid-path-planner/qpOASES master +install_dependency humanoid-path-planner/hpp-constraints devel +install_dependency humanoid-path-planner/hpp-statistics devel +install_dependency humanoid-path-planner/hpp-core devel +install_dependency humanoid-path-planner/hpp-model-urdf devel +install_dependency humanoid-path-planner/hpp-corbaserver devel +install_dependency humanoid-path-planner/iai_maps devel + +# Compile and run tests +cd "$build_dir" +cmake "$root_dir" -DCMAKE_INSTALL_PREFIX="$install_dir" \ + -DCMAKE_INSTALL_PREFIX:STRING="$install_dir" +make $make_args +# make $make_args test +make $make_args install diff --git a/.travis/run b/.travis/run new file mode 100755 index 0000000..a5a04a8 --- /dev/null +++ b/.travis/run @@ -0,0 +1,15 @@ +#!/bin/bash +set -ev + +# Directories. +root_dir=`pwd` +build_dir="$root_dir/_travis/build" +install_dir="$root_dir/_travis/install" + +export DEVEL_DIR=$install_dir +# wget -O $DEVEL_DIR/config.sh https://raw.githubusercontent.com/humanoid-path-planner/hpp-doc/master/doc/config.sh +source $DEVEL_DIR/config.sh + +hppcorbaserver & + +python $build_dir/.travis/script.py diff --git a/.travis/script.py b/.travis/script.py new file mode 100644 index 0000000..a1e0d92 --- /dev/null +++ b/.travis/script.py @@ -0,0 +1,36 @@ +from hpp.corbaserver.pr2 import Robot +robot = Robot ('pr2') +robot.setJointBounds ("base_joint_xy", [-4, -3, -5, -3]) + +from hpp.corbaserver import ProblemSolver +ps = ProblemSolver (robot) + +from hpp.gepetto import Viewer +r = Viewer (ps) + +q_init = robot.getCurrentConfig () +q_goal = q_init [::] +q_init [0:2] = [-3.2, -4] +rank = robot.rankInConfiguration ['torso_lift_joint'] +q_init [rank] = 0.2 +r (q_init) + +q_goal [0:2] = [-3.2, -4] +rank = robot.rankInConfiguration ['l_shoulder_lift_joint'] +q_goal [rank] = 0.5 +rank = robot.rankInConfiguration ['l_elbow_flex_joint'] +q_goal [rank] = -0.5 +rank = robot.rankInConfiguration ['r_shoulder_lift_joint'] +q_goal [rank] = 0.5 +rank = robot.rankInConfiguration ['r_elbow_flex_joint'] +q_goal [rank] = -0.5 +r (q_goal) + +r.loadObstacleModel ("iai_maps", "kitchen_area", "kitchen") + +ps.setInitialConfig (q_init) +ps.addGoalConfig (q_goal) + +ps.addPathOptimizer ("RandomShortcut") + +ps.solve () -- GitLab