From 22301144eeeebf9c888b6a13f7b53fb0e01319da Mon Sep 17 00:00:00 2001 From: Juan Ignacio Ubeira Date: Wed, 2 Jan 2019 14:27:56 -0300 Subject: [PATCH 01/29] Using wstool to download libraries instead of custom script. --- do_everything.sh | 62 +++++------------- get_library.sh | 136 ++++++++-------------------------------- patches/assimp.patch | 12 ++-- patches/log4cxx.patch | 31 --------- patches/lz4.patch | 4 +- patches/pcl-1.8.1.patch | 14 ++--- patches/poco.patch | 12 ++-- patches/qhull.patch | 4 +- patches/yaml-cpp.patch | 4 +- system_deps.rosinstall | 108 +++++++++++++++++++++++++++++++ 10 files changed, 175 insertions(+), 212 deletions(-) delete mode 100644 patches/log4cxx.patch create mode 100644 system_deps.rosinstall diff --git a/do_everything.sh b/do_everything.sh index 9886bb5..bb422c2 100755 --- a/do_everything.sh +++ b/do_everything.sh @@ -109,36 +109,8 @@ export TARGET_DIR=$prefix/target export RBA_TOOLCHAIN=$ANDROID_NDK/build/cmake/android.toolchain.cmake apply_patch $my_loc/patches/android.toolchain.cmake.patch -d $ANDROID_NDK/build/cmake -# Now get boost with a specialized build -[ -d $prefix/libs/boost ] || run_cmd get_library boost $prefix/libs -[ -d $prefix/libs/bzip2 ] || run_cmd get_library bzip2 $prefix/libs -[ -d $prefix/libs/uuid ] || run_cmd get_library uuid $prefix/libs -[ -d $prefix/libs/poco-1.8.0 ] || run_cmd get_library poco $prefix/libs -[ -d $prefix/libs/tinyxml ] || run_cmd get_library tinyxml $prefix/libs -[ -d $prefix/libs/tinyxml2 ] || run_cmd get_library tinyxml2 $prefix/libs -[ -d $prefix/libs/console_bridge ] || run_cmd get_library console_bridge $prefix/libs -[ -d $prefix/libs/lz4-r131 ] || run_cmd get_library lz4 $prefix/libs -[ -d $prefix/libs/curl-7.47.0 ] || run_cmd get_library curl $prefix/libs -[ -d $prefix/libs/urdfdom/ ] || run_cmd get_library urdfdom $prefix/libs -[ -d $prefix/libs/urdfdom_headers ] || run_cmd get_library urdfdom_headers $prefix/libs -[ -d $prefix/libs/libiconv-1.15 ] || run_cmd get_library libiconv $prefix/libs -[ -d $prefix/libs/libxml2-2.9.7 ] || run_cmd get_library libxml2 $prefix/libs -[ -d $prefix/libs/collada_dom ] || run_cmd get_library collada_dom $prefix/libs -[ -d $prefix/libs/eigen-3.3.5 ] || run_cmd get_library eigen $prefix/libs -[ -d $prefix/libs/assimp-3.1.1 ] || run_cmd get_library assimp $prefix/libs -[ -d $prefix/libs/qhull-2015.2 ] || run_cmd get_library qhull $prefix/libs -[ -d $prefix/libs/yaml-cpp-yaml-cpp-0.6.2 ] || run_cmd get_library yaml-cpp $prefix/libs -[ -d $prefix/libs/flann ] || run_cmd get_library flann $prefix/libs -[ -d $prefix/libs/pcl-pcl-1.8.1 ] || run_cmd get_library pcl $prefix/libs -[ -d $prefix/libs/bullet ] || run_cmd get_library bullet $prefix/libs -[ -d $prefix/libs/SDL-1.2.15 ] || run_cmd get_library sdl $prefix/libs -[ -d $prefix/libs/SDL_image ] || run_cmd get_library sdl-image $prefix/libs -[ -d $prefix/libs/libogg-1.3.3 ] || run_cmd get_library ogg $prefix/libs -[ -d $prefix/libs/libvorbis-1.3.6 ] || run_cmd get_library vorbis $prefix/libs -[ -d $prefix/libs/libtheora-1.1.1 ] || run_cmd get_library theora $prefix/libs - -# get rospkg dependency for pluginlib support at build time -[ -d $my_loc/files/rospkg ] || run_cmd get_library rospkg $my_loc/files +# Get all library dependencies. +run_cmd get_library $my_loc/system_deps.rosinstall $prefix/libs $my_loc/files echo echo -e '\e[34mGetting ROS packages\e[39m' @@ -343,29 +315,29 @@ echo [ -f $TARGET_DIR/lib/libbz2.a ] || run_cmd build_library bzip2 $prefix/libs/bzip2 [ -f $TARGET_DIR/lib/libuuid.a ] || run_cmd build_library uuid $prefix/libs/uuid [ -f $TARGET_DIR/lib/libboost_system.a ] || run_cmd copy_boost $prefix/libs/boost -[ -f $TARGET_DIR/lib/libPocoFoundation.a ] || run_cmd build_library_with_toolchain poco $prefix/libs/poco-1.8.0 +[ -f $TARGET_DIR/lib/libPocoFoundation.a ] || run_cmd build_library_with_toolchain poco $prefix/libs/poco [ -f $TARGET_DIR/lib/libtinyxml.a ] || run_cmd build_library tinyxml $prefix/libs/tinyxml [ -f $TARGET_DIR/lib/libtinyxml2.a ] || run_cmd build_library tinyxml2 $prefix/libs/tinyxml2 [ -f $TARGET_DIR/lib/libconsole_bridge.a ] || run_cmd build_library console_bridge $prefix/libs/console_bridge -[ -f $TARGET_DIR/lib/liblz4.a ] || run_cmd build_library lz4 $prefix/libs/lz4-r131/cmake_unofficial -[ -f $TARGET_DIR/lib/libcurl.a ] || run_cmd build_library_with_toolchain curl $prefix/libs/curl-7.47.0 +[ -f $TARGET_DIR/lib/liblz4.a ] || run_cmd build_library lz4 $prefix/libs/lz4/cmake_unofficial +[ -f $TARGET_DIR/lib/libcurl.a ] || run_cmd build_library_with_toolchain curl $prefix/libs/curl [ -f $TARGET_DIR/include/urdf_model/model.h ] || run_cmd build_library urdfdom_headers $prefix/libs/urdfdom_headers [ -f $TARGET_DIR/lib/liburdfdom_model.a ] || run_cmd build_library urdfdom $prefix/libs/urdfdom -[ -f $TARGET_DIR/lib/libiconv.a ] || run_cmd build_library_with_toolchain libiconv $prefix/libs/libiconv-1.15 -[ -f $TARGET_DIR/lib/libxml2.a ] || run_cmd build_library_with_toolchain libxml2 $prefix/libs/libxml2-2.9.7 +[ -f $TARGET_DIR/lib/libiconv.a ] || run_cmd build_library_with_toolchain libiconv $prefix/libs/libiconv +[ -f $TARGET_DIR/lib/libxml2.a ] || run_cmd build_library_with_toolchain libxml2 $prefix/libs/libxml2 [ -f $TARGET_DIR/lib/libcollada-dom2.4-dp.a ] || run_cmd build_library collada_dom $prefix/libs/collada_dom -[ -f $TARGET_DIR/lib/libassimp.a ] || run_cmd build_library assimp $prefix/libs/assimp-3.1.1 -[ -f $TARGET_DIR/include/eigen3/signature_of_eigen3_matrix_library ] || run_cmd build_library eigen $prefix/libs/eigen-3.3.5 -[ -f $TARGET_DIR/lib/libqhullstatic.a ] || run_cmd build_library qhull $prefix/libs/qhull-2015.2 -[ -f $TARGET_DIR/lib/libyaml-cpp.a ] || run_cmd build_library yaml-cpp $prefix/libs/yaml-cpp-yaml-cpp-0.6.2 +[ -f $TARGET_DIR/lib/libassimp.a ] || run_cmd build_library assimp $prefix/libs/assimp +[ -f $TARGET_DIR/include/eigen3/signature_of_eigen3_matrix_library ] || run_cmd build_library eigen $prefix/libs/eigen +[ -f $TARGET_DIR/lib/libqhullstatic.a ] || run_cmd build_library qhull $prefix/libs/qhull +[ -f $TARGET_DIR/lib/libyaml-cpp.a ] || run_cmd build_library yaml-cpp $prefix/libs/yaml-cpp [ -f $TARGET_DIR/lib/libflann_cpp_s.a ] || run_cmd build_library flann $prefix/libs/flann -[ -f $TARGET_DIR/lib/libpcl_common.a ] || run_cmd build_library pcl $prefix/libs/pcl-pcl-1.8.1 +[ -f $TARGET_DIR/lib/libpcl_common.a ] || run_cmd build_library pcl $prefix/libs/pcl [ -f $TARGET_DIR/lib/libBulletSoftBody.a ] || run_cmd build_library bullet $prefix/libs/bullet -[ -f $TARGET_DIR/lib/libSDL.a ] || run_cmd build_library_with_toolchain sdl $prefix/libs/SDL-1.2.15 -[ -f $TARGET_DIR/lib/libSDL_image.a ] || run_cmd build_library_with_toolchain sdl-image $prefix/libs/SDL_image -[ -f $TARGET_DIR/lib/libogg.a ] || run_cmd build_library_with_toolchain ogg $prefix/libs/libogg-1.3.3 -[ -f $TARGET_DIR/lib/libvorbis.a ] || run_cmd build_library_with_toolchain vorbis $prefix/libs/libvorbis-1.3.6 -[ -f $TARGET_DIR/lib/libtheora.a ] || run_cmd build_library_with_toolchain theora $prefix/libs/libtheora-1.1.1 +[ -f $TARGET_DIR/lib/libSDL.a ] || run_cmd build_library_with_toolchain sdl $prefix/libs/sdl +[ -f $TARGET_DIR/lib/libSDL_image.a ] || run_cmd build_library_with_toolchain sdl-image $prefix/libs/sdl-image +[ -f $TARGET_DIR/lib/libogg.a ] || run_cmd build_library_with_toolchain ogg $prefix/libs/ogg +[ -f $TARGET_DIR/lib/libvorbis.a ] || run_cmd build_library_with_toolchain vorbis $prefix/libs/vorbis +[ -f $TARGET_DIR/lib/libtheora.a ] || run_cmd build_library_with_toolchain theora $prefix/libs/theora echo echo -e '\e[34mCross-compiling ROS.\e[39m' diff --git a/get_library.sh b/get_library.sh index b848cb2..9ac7d5e 100755 --- a/get_library.sh +++ b/get_library.sh @@ -7,123 +7,37 @@ my_loc="$(cd "$(dirname $0)" && pwd)" source $my_loc/config.sh source $my_loc/utils.sh -if [ $# != 2 ] || [ $1 == '-h' ] || [ $1 == '--help' ]; then - echo "Usage: $0 library_name library_prefix_path" - echo " example: $0 tinyxml /home/user/my_workspace/tinyxml" +if [ $# != 3 ] || [ $1 == '-h' ] || [ $1 == '--help' ]; then + echo "Usage: $0 system_deps_rosinstall library_prefix_path files_prefix_path" + echo " example: $0 /home/user/ros_android/system_deps.rosinstall /home/user/my_workspace/output/libs /home/user/ros_android/files" + echo $@ exit 1 fi echo -echo -e '\e[34mGetting '$1'.\e[39m' +echo -e '\e[34mGetting system libraries.\e[39m' echo -prefix=$(cd $2 && pwd) - -if [ $1 == 'assimp' ]; then - URL=https://github.com/assimp/assimp/archive/v3.1.1.tar.gz - COMP='gz' -elif [ $1 == 'boost' ]; then - URL=https://github.com/moritz-wundke/Boost-for-Android.git - COMP='git' -elif [ $1 == 'bullet' ]; then - URL=https://github.com/bulletphysics/bullet3 - COMP='git' - HASH='2.83.6' -elif [ $1 == 'bzip2' ]; then - URL=https://github.com/osrf/bzip2_cmake.git - COMP='git' -elif [ $1 == 'collada_dom' ]; then - URL=https://github.com/rdiankov/collada-dom.git - COMP='git' - HASH='v2.4.4' -elif [ $1 == 'console_bridge' ]; then - URL=https://github.com/ros/console_bridge.git - COMP='git' - HASH='0.3.2' -elif [ $1 == 'curl' ]; then - URL=http://curl.haxx.se/download/curl-7.47.0.tar.bz2 - COMP='bz2' -elif [ $1 == 'eigen' ]; then - URL=https://bitbucket.org/eigen/eigen/get/3.3.5.tar.gz - COMP='gz' -elif [ $1 == 'flann' ]; then - URL=https://github.com/chadrockey/flann_cmake.git - COMP='git' -elif [ $1 == 'libiconv' ]; then - URL=http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.15.tar.gz - COMP='gz' -elif [ $1 == 'libxml2' ]; then - URL=ftp://xmlsoft.org/libxml2/libxml2-2.9.7.tar.gz - COMP='gz' -elif [ $1 == 'lz4' ]; then - URL=https://github.com/Cyan4973/lz4/archive/r131.tar.gz - COMP='gz' -elif [ $1 == 'ogg' ]; then - URL=http://downloads.xiph.org/releases/ogg/libogg-1.3.3.tar.gz - COMP='gz' -elif [ $1 == 'pcl' ]; then - URL=https://github.com/PointCloudLibrary/pcl/archive/pcl-1.8.1.tar.gz - COMP='gz' -elif [ $1 == 'poco' ]; then - URL=http://pocoproject.org/releases/poco-1.8.0/poco-1.8.0.tar.gz - COMP='gz' -elif [ $1 == 'qhull' ]; then - URL=http://www.qhull.org/download/qhull-2015-src-7.2.0.tgz - COMP='gz' -elif [ $1 == 'sdl' ]; then - URL=https://www.libsdl.org/release/SDL-1.2.15.tar.gz - COMP='gz' -elif [ $1 == 'sdl-image' ]; then - URL=http://hg.libsdl.org/SDL_image/archive/d46c630f2cd6.tar.gz - COMP='gz' -elif [ $1 == 'theora' ]; then - URL=http://downloads.xiph.org/releases/theora/libtheora-1.1.1.tar.bz2 - COMP='bz2' -elif [ $1 == 'tinyxml' ]; then - URL=https://github.com/chadrockey/tinyxml_cmake - COMP='git' -elif [ $1 == 'tinyxml2' ]; then - URL=https://github.com/leethomason/tinyxml2 - COMP='git' -elif [ $1 == 'urdfdom_headers' ]; then - URL=https://github.com/ros/urdfdom_headers.git - COMP='git' - HASH='0.4.2' -elif [ $1 == 'urdfdom' ]; then - URL=https://github.com/ros/urdfdom.git - COMP='git' - HASH='0.4.2' -elif [ $1 == 'uuid' ]; then - URL=https://github.com/chadrockey/uuid_cmake - COMP='git' -elif [ $1 == 'vorbis' ]; then - URL=http://downloads.xiph.org/releases/vorbis/libvorbis-1.3.6.tar.gz - COMP='gz' -elif [ $1 == 'yaml-cpp' ]; then - URL=https://github.com/jbeder/yaml-cpp/archive/yaml-cpp-0.6.2.tar.gz - COMP='gz' -elif [ $1 == 'rospkg' ]; then - URL=https://github.com/ros-infrastructure/rospkg.git - COMP='git' - HASH='93b1b72f256badf22ccc926b22646f2e83b720fd' +rosinstall_file=$1 +lib_prefix=$(cd $2 && pwd) +files_prefix=$(cd $3 && pwd) + +# Get everything +if [ -f $lib_prefix/.rosinstall ]; then + pushd $lib_prefix + wstool merge $rosinstall_file --merge-replace + wstool update -j$PARALLEL_JOBS + popd +else + wstool init -j$PARALLEL_JOBS $lib_prefix $rosinstall_file fi -if [ $COMP == 'gz' ]; then - download_gz $URL $prefix -elif [ $COMP == 'bz2' ]; then - download_bz2 $URL $prefix -elif [ $COMP == 'git' ];then - git clone $URL $prefix/$1 -fi +# Library-specific patches / actions. -if [ $1 == 'boost' ]; then - cd $prefix/boost - bash -x ./build-android.sh $ANDROID_NDK --boost=1.68.0 --arch=$ANDROID_ABI -elif [ -v HASH ]; then - cd $prefix/$1 - git checkout $HASH -elif [ $1 == 'sdl-image' ]; then - mv $prefix/SDL_image* $prefix/SDL_image -elif [ $1 == 'eigen' ]; then - mv $prefix/eigen-eigen-* $prefix/eigen-3.3.5 -fi +# Boost +pushd $lib_prefix/boost +[ -d build/out ] || bash -x ./build-android.sh $ANDROID_NDK --boost=1.68.0 --arch=$ANDROID_ABI +popd + +# Rospkg +cp -r $lib_prefix/rospkg $files_prefix diff --git a/patches/assimp.patch b/patches/assimp.patch index 79dc293..e5affd9 100644 --- a/patches/assimp.patch +++ b/patches/assimp.patch @@ -1,7 +1,7 @@ -diff --git libs/assimp-3.1.1/CMakeLists.txt libs/assimp-3.1.1/CMakeLists.txt +diff --git libs/assimp/CMakeLists.txt libs/assimp/CMakeLists.txt index d332428..1af59dc 100644 ---- libs/assimp-3.1.1/CMakeLists.txt -+++ libs/assimp-3.1.1/CMakeLists.txt +--- libs/assimp/CMakeLists.txt ++++ libs/assimp/CMakeLists.txt @@ -76,7 +76,7 @@ SET( ASSIMP_INCLUDE_INSTALL_DIR "include" CACHE PATH "Path the header files are installed to." ) SET( ASSIMP_BIN_INSTALL_DIR "bin" CACHE PATH @@ -11,10 +11,10 @@ index d332428..1af59dc 100644 "Build a static (.a) version of the library" ) SET(ASSIMP_DEBUG_POSTFIX "d" CACHE STRING "Debug Postfitx for lib, samples and tools") -diff --git libs/assimp-3.1.1/code/BlenderDNA.cpp libs/assimp-3.1.1/code/BlenderDNA.cpp +diff --git libs/assimp/code/BlenderDNA.cpp libs/assimp/code/BlenderDNA.cpp index 16e639e..fdd49eb 100644 ---- libs/assimp-3.1.1/code/BlenderDNA.cpp -+++ libs/assimp-3.1.1/code/BlenderDNA.cpp +--- libs/assimp/code/BlenderDNA.cpp ++++ libs/assimp/code/BlenderDNA.cpp @@ -56,10 +56,10 @@ using namespace Assimp::Formatter; #define for_each BOOST_FOREACH bool match4(StreamReaderAny& stream, const char* string) { diff --git a/patches/log4cxx.patch b/patches/log4cxx.patch deleted file mode 100644 index ef09041..0000000 --- a/patches/log4cxx.patch +++ /dev/null @@ -1,31 +0,0 @@ ---- libs/apache-log4cxx-0.10.0/src/examples/cpp/console.cpp 2015-01-09 00:45:11.380992240 -0300 -+++ libs/apache-log4cxx-0.10.0/src/examples/cpp/console.cpp 2015-01-09 00:49:43.140979871 -0300 -@@ -22,6 +22,8 @@ - #include - #include - #include -+#include -+#include - - using namespace log4cxx; - using namespace log4cxx::helpers; ---- libs/apache-log4cxx-0.10.0/src/main/cpp/socketoutputstream.cpp 2015-01-09 00:42:28.728999643 -0300 -+++ libs/apache-log4cxx-0.10.0/src/main/cpp/socketoutputstream.cpp 2015-01-09 00:42:43.916998952 -0300 -@@ -19,6 +19,7 @@ - #include - #include - #include -+#include - - using namespace log4cxx; - using namespace log4cxx::helpers; ---- libs/apache-log4cxx-0.10.0/src/main/cpp/inputstreamreader.cpp 2015-01-09 00:39:04.933008919 -0300 -+++ libs/apache-log4cxx-0.10.0/src/main/cpp/inputstreamreader.cpp 2015-01-09 00:39:51.201006813 -0300 -@@ -20,6 +20,7 @@ - #include - #include - #include -+#include - - using namespace log4cxx; - using namespace log4cxx::helpers; diff --git a/patches/lz4.patch b/patches/lz4.patch index 0a0cfdf..9335b9f 100644 --- a/patches/lz4.patch +++ b/patches/lz4.patch @@ -1,5 +1,5 @@ ---- libs/lz4-r131/cmake_unofficial/CMakeLists.txt -+++ libs/lz4-r131/cmake_unofficial/CMakeLists.txt +--- libs/lz4/cmake_unofficial/CMakeLists.txt ++++ libs/lz4/cmake_unofficial/CMakeLists.txt @@ -14,7 +14,7 @@ MESSAGE( STATUS "64 bit architecture detected size of void * is " ${SIZEOF_VOID_P}) ENDIF() diff --git a/patches/pcl-1.8.1.patch b/patches/pcl-1.8.1.patch index 2a4c7e2..340fb12 100644 --- a/patches/pcl-1.8.1.patch +++ b/patches/pcl-1.8.1.patch @@ -1,5 +1,5 @@ ---- libs/pcl-pcl-1.8.1/CMakeLists.txt -+++ libs/pcl-pcl-1.8.1/CMakeLists.txt +--- libs/pcl/CMakeLists.txt ++++ libs/pcl/CMakeLists.txt @@ -1,6 +1,8 @@ ### ---[ PCL global CMake cmake_minimum_required(VERSION 2.8 FATAL_ERROR) @@ -13,7 +13,7 @@ diff --git a/android_pcl_config_minimal.cmake b/android_pcl_config_minimal.cmake new file mode 100644 index 0000000..be84634 --- /dev/null -+++ libs/pcl-pcl-1.8.1/android_pcl_config_minimal.cmake ++++ libs/pcl/android_pcl_config_minimal.cmake @@ -0,0 +1,15 @@ +set(WITH_FZAPI FALSE CACHE BOOL "fzapi: disabled (forced)" FORCE) +set(WITH_LIBUSB FALSE CACHE BOOL "libusb: disabled (forced)" FORCE) @@ -31,8 +31,8 @@ index 0000000..be84634 +set(HAVE_MM_MALLOC_EXITCODE "2" CACHE STRING "Result from TRY_RUN for HAVE_MM_MALLOC" FORCE) +set(HAVE_POSIX_MEMALIGN_EXITCODE "2" CACHE STRING "Result from TRY_RUN for HAVE_POSIX_MEMALIGN" FORCE) + ---- libs/pcl-pcl-1.8.1/PCLConfig.cmake.in -+++ libs/pcl-pcl-1.8.1/PCLConfig.cmake.in +--- libs/pcl/PCLConfig.cmake.in ++++ libs/pcl/PCLConfig.cmake.in @@ -853,8 +853,9 @@ set(PCL_${COMPONENT}_LIBRARY ${PCL_${COMPONENT}_LIBRARY_DEBUG}) endif(NOT PCL_${COMPONENT}_LIBRARY AND WIN32) @@ -52,8 +52,8 @@ index 0000000..be84634 endif(PCL_${INT_DEP}_LIBRARIES) endif(PCL_${INT_DEP}_FOUND) endforeach(int_dep) ---- libs/pcl-pcl-1.8.1/cmake/pcl_pclconfig.cmake -+++ libs/pcl-pcl-1.8.1/cmake/pcl_pclconfig.cmake +--- libs/pcl/cmake/pcl_pclconfig.cmake ++++ libs/pcl/cmake/pcl_pclconfig.cmake @@ -61,6 +61,13 @@ endif(_status) endforeach(_ss) diff --git a/patches/poco.patch b/patches/poco.patch index e65e3c4..458bbcd 100644 --- a/patches/poco.patch +++ b/patches/poco.patch @@ -1,5 +1,5 @@ ---- libs/poco-1.8.0/Foundation/include/Poco/SharedLibrary.h -+++ libs/poco-1.8.0/Foundation/include/Poco/SharedLibrary.h +--- libs/poco/Foundation/include/Poco/SharedLibrary.h ++++ libs/poco/Foundation/include/Poco/SharedLibrary.h @@ -23,7 +23,9 @@ #include "Poco/Foundation.h" @@ -11,8 +11,8 @@ #include "Poco/SharedLibrary_HPUX.h" #elif defined(POCO_VXWORKS) #include "Poco/SharedLibrary_VX.h" ---- libs/poco-1.8.0/Foundation/src/SharedLibrary.cpp -+++ libs/poco-1.8.0/Foundation/src/SharedLibrary.cpp +--- libs/poco/Foundation/src/SharedLibrary.cpp ++++ libs/poco/Foundation/src/SharedLibrary.cpp @@ -18,7 +18,9 @@ #include "Poco/Exception.h" @@ -25,7 +25,7 @@ #elif defined(POCO_VXWORKS) #include "SharedLibrary_VX.cpp" --- /dev/null -+++ libs/poco-1.8.0/Foundation/src/SharedLibrary_ANDROID_STATIC.cpp ++++ libs/poco/Foundation/src/SharedLibrary_ANDROID_STATIC.cpp @@ -0,0 +1,119 @@ +// +// SharedLibrary_ANDROID.cpp @@ -147,7 +147,7 @@ + +} // namespace Poco --- /dev/null -+++ libs/poco-1.8.0/build/config/Android_static ++++ libs/poco/build/config/Android_static @@ -0,0 +1,91 @@ +# +# $Id: //poco/1.4/build/config/Android#3 $ diff --git a/patches/qhull.patch b/patches/qhull.patch index e5ceec5..fc8949d 100644 --- a/patches/qhull.patch +++ b/patches/qhull.patch @@ -1,5 +1,5 @@ ---- libs/qhull-2012.1/CMakeLists.txt 2014-12-19 18:26:42.612712590 -0300 -+++ libs/qhull-2012.1/CMakeLists.txt 2014-12-19 18:44:18.124752493 -0300 +--- libs/qhull/CMakeLists.txt 2014-12-19 18:26:42.612712590 -0300 ++++ libs/qhull/CMakeLists.txt 2014-12-19 18:44:18.124752493 -0300 @@ -241,7 +241,7 @@ set( diff --git a/patches/yaml-cpp.patch b/patches/yaml-cpp.patch index f9b6ba0..4061b8a 100644 --- a/patches/yaml-cpp.patch +++ b/patches/yaml-cpp.patch @@ -1,5 +1,5 @@ ---- libs/yaml-cpp-yaml-cpp-0.6.2/CMakeLists.txt -+++ libs/yaml-cpp-yaml-cpp-0.6.2/CMakeLists.txt +--- libs/yaml-cpp/CMakeLists.txt ++++ libs/yaml-cpp/CMakeLists.txt @@ -38,7 +38,11 @@ enable_testing() ### Project options ### diff --git a/system_deps.rosinstall b/system_deps.rosinstall new file mode 100644 index 0000000..788bc20 --- /dev/null +++ b/system_deps.rosinstall @@ -0,0 +1,108 @@ +- git: + local-name: assimp + uri: https://github.com/assimp/assimp.git + version: v3.1.1 +- git: + local-name: boost + uri: https://github.com/moritz-wundke/Boost-for-Android.git + version: 286a548aa9b058402cc88766e818a0218725e163 +- git: + local-name: bullet + uri: https://github.com/bulletphysics/bullet3 + version: 2.83.6 +- git: + local-name: bzip2 + uri: https://github.com/osrf/bzip2_cmake.git + version: 0496eaaf58746516124c838e10084951ac4a57e9 +- git: + local-name: collada_dom + uri: https://github.com/rdiankov/collada-dom.git + version: v2.4.4 +- git: + local-name: console_bridge + uri: https://github.com/ros/console_bridge.git + version: 0.3.2 +- tar: + local-name: curl + uri: http://curl.haxx.se/download/curl-7.47.0.tar.bz2 + version: curl-7.47.0 +- tar: + local-name: eigen + uri: https://bitbucket.org/eigen/eigen/get/3.3.5.tar.gz + version: eigen-eigen-b3f3d4950030 +- git: + local-name: flann + uri: https://github.com/chadrockey/flann_cmake.git + version: de1c59fd75479efdf04d3a32988c2fa1061ed7ff +- tar: + local-name: libiconv + uri: http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.15.tar.gz + version: libiconv-1.15 +- tar: + local-name: libxml2 + uri: ftp://xmlsoft.org/libxml2/libxml2-2.9.7.tar.gz + version: libxml2-2.9.7 +- tar: + local-name: lz4 + uri: https://github.com/Cyan4973/lz4/archive/r131.tar.gz + version: lz4-r131 +- tar: + local-name: ogg + uri: http://downloads.xiph.org/releases/ogg/libogg-1.3.3.tar.gz + version: libogg-1.3.3 +- tar: + local-name: pcl + uri: https://github.com/PointCloudLibrary/pcl/archive/pcl-1.8.1.tar.gz + version: pcl-pcl-1.8.1 +- tar: + local-name: poco + uri: http://pocoproject.org/releases/poco-1.8.0/poco-1.8.0.tar.gz + version: poco-1.8.0 +- tar: + local-name: qhull + uri: http://www.qhull.org/download/qhull-2015-src-7.2.0.tgz + version: qhull-2015.2 +- git: + local-name: rospkg + uri: https://github.com/ros-infrastructure/rospkg.git + version: 93b1b72f256badf22ccc926b22646f2e83b720fd +- tar: + local-name: sdl + uri: https://www.libsdl.org/release/SDL-1.2.15.tar.gz + version: SDL-1.2.15 +- tar: + local-name: sdl-image + uri: http://hg.libsdl.org/SDL_image/archive/d46c630f2cd6.tar.gz + version: SDL_image-d46c630f2cd6 +- tar: + local-name: theora + uri: http://downloads.xiph.org/releases/theora/libtheora-1.1.1.tar.bz2 + version: libtheora-1.1.1 +- git: + local-name: tinyxml + uri: https://github.com/chadrockey/tinyxml_cmake + version: cbacc92a6e9b5359567336776b9d9eaf92d88355 +- git: + local-name: tinyxml2 + uri: https://github.com/leethomason/tinyxml2 + version: 7.0.1 +- git: + local-name: urdfdom + uri: https://github.com/ros/urdfdom.git + version: 0.4.2 +- git: + local-name: urdfdom_headers + uri: https://github.com/ros/urdfdom_headers.git + version: 0.4.2 +- git: + local-name: uuid + uri: https://github.com/chadrockey/uuid_cmake + version: 2e7e31f12397474c9465acbae868d13170b3337b +- tar: + local-name: vorbis + uri: http://downloads.xiph.org/releases/vorbis/libvorbis-1.3.6.tar.gz + version: libvorbis-1.3.6 +- tar: + local-name: yaml-cpp + uri: https://github.com/jbeder/yaml-cpp/archive/yaml-cpp-0.6.2.tar.gz + version: yaml-cpp-yaml-cpp-0.6.2 From 46def102e88c660c77e21ebd614bfc839b15abb3 Mon Sep 17 00:00:00 2001 From: Juan Ignacio Ubeira Date: Wed, 2 Jan 2019 14:28:16 -0300 Subject: [PATCH 02/29] Removing download auxiliary functions. --- utils.sh | 29 ----------------------------- 1 file changed, 29 deletions(-) diff --git a/utils.sh b/utils.sh index 9f18ad2..e99c113 100644 --- a/utils.sh +++ b/utils.sh @@ -7,35 +7,6 @@ die() { exit 1 } -download() { - if [ ! -z $1 ]; then - cmd_exists curl && curl -L $1 -O || wget $1 - else - echo "skipping download of $1 as it's already local" - fi -} - -download_bz2() { - echo "downloading $1" - ( cmd_exists curl && curl -L $1 || wget -O - $1 ) | tar jx -C $2 -} - -download_gz() { - echo "downloading $1" - ( cmd_exists curl && curl -L $1 || wget -O - $1 ) | tar zx -C $2 -} - -download_zip() { - cmd_exists unzip || die 'could not find unzip' - - echo "downloading $1" - - tmpdir=$(mktemp -d /tmp/rba.XXXX) - tmpfile=$tmpdir/gtest.zip - ( cmd_exists curl && curl -L $1 -o $tmpfile || wget $1 -O $tmpfile ) && unzip $tmpfile -d $2 - rm -rf $tmpdir -} - cmake_build() { cmd_exists cmake || die 'cmake was not found' From 6d8323a8b48bb0a7b68ad9a13c930ad87b3bb0e9 Mon Sep 17 00:00:00 2001 From: Juan Ignacio Ubeira Date: Wed, 2 Jan 2019 15:12:46 -0300 Subject: [PATCH 03/29] Renaming ndk.rosinstall --> ros.rosinstall. --- get_ros_stuff.sh | 4 ++-- ndk.rosinstall => ros.rosinstall | 0 2 files changed, 2 insertions(+), 2 deletions(-) rename ndk.rosinstall => ros.rosinstall (100%) diff --git a/get_ros_stuff.sh b/get_ros_stuff.sh index 094cd4e..a1a8692 100755 --- a/get_ros_stuff.sh +++ b/get_ros_stuff.sh @@ -22,9 +22,9 @@ mkdir -p catkin_ws/src && cd catkin_ws if [ -f src/.rosinstall ]; then cd src/ - wstool merge $my_loc/ndk.rosinstall --merge-replace + wstool merge $my_loc/ros.rosinstall --merge-replace wstool update cd .. else - wstool init -j$PARALLEL_JOBS src $my_loc/ndk.rosinstall + wstool init -j$PARALLEL_JOBS src $my_loc/ros.rosinstall fi diff --git a/ndk.rosinstall b/ros.rosinstall similarity index 100% rename from ndk.rosinstall rename to ros.rosinstall From 90c2ef29cd932453da58ed59b6b3341bb7da01c3 Mon Sep 17 00:00:00 2001 From: Juan Ignacio Ubeira Date: Wed, 2 Jan 2019 16:32:47 -0300 Subject: [PATCH 04/29] Renaming scripts for consistency. --- build_cpp.sh => build_catkin_workspace.sh | 0 do_everything.sh | 8 ++++---- get_ros_stuff.sh => get_catkin_packages.sh | 0 get_library.sh => get_system_dependencies.sh | 0 4 files changed, 4 insertions(+), 4 deletions(-) rename build_cpp.sh => build_catkin_workspace.sh (100%) rename get_ros_stuff.sh => get_catkin_packages.sh (100%) rename get_library.sh => get_system_dependencies.sh (100%) diff --git a/build_cpp.sh b/build_catkin_workspace.sh similarity index 100% rename from build_cpp.sh rename to build_catkin_workspace.sh diff --git a/do_everything.sh b/do_everything.sh index bb422c2..7d912fc 100755 --- a/do_everything.sh +++ b/do_everything.sh @@ -110,14 +110,14 @@ export RBA_TOOLCHAIN=$ANDROID_NDK/build/cmake/android.toolchain.cmake apply_patch $my_loc/patches/android.toolchain.cmake.patch -d $ANDROID_NDK/build/cmake # Get all library dependencies. -run_cmd get_library $my_loc/system_deps.rosinstall $prefix/libs $my_loc/files +run_cmd get_system_dependencies $my_loc/system_deps.rosinstall $prefix/libs $my_loc/files echo echo -e '\e[34mGetting ROS packages\e[39m' echo if [[ $skip -ne 1 ]] ; then - run_cmd get_ros_stuff $prefix + run_cmd get_catkin_packages $prefix echo echo -e '\e[34mApplying patches.\e[39m' @@ -346,10 +346,10 @@ echo if [[ $debugging -eq 1 ]];then echo "Build type = DEBUG" - run_cmd build_cpp -p $prefix -b Debug -v $verbose + run_cmd build_catkin_workspace -p $prefix -b Debug -v $verbose else echo "Build type = RELEASE" - run_cmd build_cpp -p $prefix -b Release -v $verbose + run_cmd build_catkin_workspace -p $prefix -b Release -v $verbose fi echo diff --git a/get_ros_stuff.sh b/get_catkin_packages.sh similarity index 100% rename from get_ros_stuff.sh rename to get_catkin_packages.sh diff --git a/get_library.sh b/get_system_dependencies.sh similarity index 100% rename from get_library.sh rename to get_system_dependencies.sh From bcccc2127b8e8e4ccb7e99a2a0bc9739755b269d Mon Sep 17 00:00:00 2001 From: Juan Ignacio Ubeira Date: Wed, 2 Jan 2019 16:22:26 -0300 Subject: [PATCH 05/29] Applying all patches in source_patches folder; no need of listing them explicitly in main script. - Moved unused patches to graveyard. --- apply_patches.sh | 25 +++ do_everything.sh | 170 +----------------- patches/{ => graveyard}/collada_parser.patch | 0 patches/{ => graveyard}/global_planner.patch | 0 patches/{ => graveyard}/laser_assembler.patch | 0 patches/{ => graveyard}/laser_filters.patch | 0 patches/{ => graveyard}/moveit_core.patch | 0 .../{ => graveyard}/moveit_core_plugins.patch | 0 patches/{ => graveyard}/qhull.patch | 0 patches/{ => graveyard}/robot_pose_ekf.patch | 0 patches/{ => graveyard}/roslib.patch | 0 patches/{ => source_patches}/actionlib.patch | 0 patches/{ => source_patches}/assimp.patch | 0 patches/{ => source_patches}/bfl.patch | 0 patches/{ => source_patches}/bondcpp.patch | 0 patches/{ => source_patches}/bullet.patch | 0 .../camera_calibration_parsers.patch | 0 .../camera_info_manager.patch | 0 patches/{ => source_patches}/catkin.patch | 0 .../{ => source_patches}/collada_dom.patch | 0 .../{ => source_patches}/console_bridge.patch | 0 patches/{ => source_patches}/cv_bridge.patch | 0 .../depth_image_proc.patch | 0 .../image_publisher.patch | 0 .../{ => source_patches}/image_rotate.patch | 0 .../image_transport.patch | 0 patches/{ => source_patches}/image_view.patch | 0 patches/{ => source_patches}/lz4.patch | 0 patches/{ => source_patches}/map_server.patch | 0 patches/{ => source_patches}/opencv.patch | 0 patches/{ => source_patches}/orocos_kdl.patch | 0 patches/{ => source_patches}/pcl-1.8.1.patch | 0 patches/{ => source_patches}/pluginlib.patch | 0 patches/{ => source_patches}/poco.patch | 0 .../robot_state_publisher.patch | 0 .../{ => source_patches}/rosbag_storage.patch | 0 patches/{ => source_patches}/rosconsole.patch | 0 patches/{ => source_patches}/rospack.patch | 0 .../theora_image_transport.patch | 0 patches/{ => source_patches}/urdf.patch | 0 patches/{ => source_patches}/urdfdom.patch | 0 patches/{ => source_patches}/uuid.patch | 0 patches/{ => source_patches}/xmlrpcpp.patch | 0 patches/{ => source_patches}/yaml-cpp.patch | 0 44 files changed, 26 insertions(+), 169 deletions(-) create mode 100755 apply_patches.sh rename patches/{ => graveyard}/collada_parser.patch (100%) rename patches/{ => graveyard}/global_planner.patch (100%) rename patches/{ => graveyard}/laser_assembler.patch (100%) rename patches/{ => graveyard}/laser_filters.patch (100%) rename patches/{ => graveyard}/moveit_core.patch (100%) rename patches/{ => graveyard}/moveit_core_plugins.patch (100%) rename patches/{ => graveyard}/qhull.patch (100%) rename patches/{ => graveyard}/robot_pose_ekf.patch (100%) rename patches/{ => graveyard}/roslib.patch (100%) rename patches/{ => source_patches}/actionlib.patch (100%) rename patches/{ => source_patches}/assimp.patch (100%) rename patches/{ => source_patches}/bfl.patch (100%) rename patches/{ => source_patches}/bondcpp.patch (100%) rename patches/{ => source_patches}/bullet.patch (100%) rename patches/{ => source_patches}/camera_calibration_parsers.patch (100%) rename patches/{ => source_patches}/camera_info_manager.patch (100%) rename patches/{ => source_patches}/catkin.patch (100%) rename patches/{ => source_patches}/collada_dom.patch (100%) rename patches/{ => source_patches}/console_bridge.patch (100%) rename patches/{ => source_patches}/cv_bridge.patch (100%) rename patches/{ => source_patches}/depth_image_proc.patch (100%) rename patches/{ => source_patches}/image_publisher.patch (100%) rename patches/{ => source_patches}/image_rotate.patch (100%) rename patches/{ => source_patches}/image_transport.patch (100%) rename patches/{ => source_patches}/image_view.patch (100%) rename patches/{ => source_patches}/lz4.patch (100%) rename patches/{ => source_patches}/map_server.patch (100%) rename patches/{ => source_patches}/opencv.patch (100%) rename patches/{ => source_patches}/orocos_kdl.patch (100%) rename patches/{ => source_patches}/pcl-1.8.1.patch (100%) rename patches/{ => source_patches}/pluginlib.patch (100%) rename patches/{ => source_patches}/poco.patch (100%) rename patches/{ => source_patches}/robot_state_publisher.patch (100%) rename patches/{ => source_patches}/rosbag_storage.patch (100%) rename patches/{ => source_patches}/rosconsole.patch (100%) rename patches/{ => source_patches}/rospack.patch (100%) rename patches/{ => source_patches}/theora_image_transport.patch (100%) rename patches/{ => source_patches}/urdf.patch (100%) rename patches/{ => source_patches}/urdfdom.patch (100%) rename patches/{ => source_patches}/uuid.patch (100%) rename patches/{ => source_patches}/xmlrpcpp.patch (100%) rename patches/{ => source_patches}/yaml-cpp.patch (100%) diff --git a/apply_patches.sh b/apply_patches.sh new file mode 100755 index 0000000..ec6fe1b --- /dev/null +++ b/apply_patches.sh @@ -0,0 +1,25 @@ +#!/bin/bash + +# Abort script on any failures +set -e + +my_loc="$(cd "$(dirname $0)" && pwd)" +source $my_loc/config.sh +source $my_loc/utils.sh + +if [ $# != 2 ] || [ $1 == '-h' ] || [ $1 == '--help' ]; then + echo "Usage: $0 patch_prefix output_prefix" + echo " example: $0 /home/user/ros_android/patches /home/user/my_workspace/output" + exit 1 +fi + +patch_prefix=$1 +output_prefix=$2 + +echo +echo -e '\e[34mApplying patches.\e[39m' +echo + +for patch_file in $patch_prefix/*.patch; do + apply_patch $patch_file -d $output_prefix +done diff --git a/do_everything.sh b/do_everything.sh index 5d1ceb0..c0a2c72 100755 --- a/do_everything.sh +++ b/do_everything.sh @@ -101,15 +101,6 @@ mkdir -p $prefix/libs export TARGET_DIR=$prefix/target [ -d $TARGET_DIR ] || mkdir -p $TARGET_DIR -# Get the android ndk build helper script -# If file doesn't exist, then download and patch it -#if ! [ -e $prefix/android.toolchain.cmake ]; then -# cd $prefix -# download 'https://raw.githubusercontent.com/taka-no-me/android-cmake/556cc14296c226f753a3778d99d8b60778b7df4f/android.toolchain.cmake' -# patch -p0 -N -d $prefix < $my_loc/patches/android.toolchain.cmake.patch -# cat $my_loc/files/android.toolchain.cmake.addendum >> $prefix/android.toolchain.cmake -#fi - export RBA_TOOLCHAIN=$ANDROID_NDK_HOME/build/cmake/android.toolchain.cmake apply_patch $my_loc/patches/android.toolchain.cmake.patch -d $ANDROID_NDK_HOME/build/cmake @@ -123,166 +114,7 @@ echo if [[ $skip -ne 1 ]] ; then run_cmd get_catkin_packages $prefix - echo - echo -e '\e[34mApplying patches.\e[39m' - echo - - # patch CMakeLists.txt for lz4 library - Build as a library - apply_patch $my_loc/patches/lz4.patch - - # patch rosbag_storage - Fix static linking due to missing BZIP2 dependency - apply_patch $my_loc/patches/rosbag_storage.patch - - # Patch collada - Build as static lib - apply_patch $my_loc/patches/collada_dom.patch - - # Patch assimp - Build as static lib - apply_patch $my_loc/patches/assimp.patch - - # Patch console_bridge - Disable unit tests (unsatisfied dependencies) - apply_patch $my_loc/patches/console_bridge.patch - - # Patch urdfdom - Build as static lib - apply_patch $my_loc/patches/urdfdom.patch - - # Patch qhull - Don't install shared libraries - # TODO: Remove shared libraries to avoid hack in parse_libs.py - # apply_patch /opt/roscpp_android/patches/qhull.patch - - # Patch bfl - Build as static lib - apply_patch $my_loc/patches/bfl.patch - - # Patch orocos_kdl - Build as static lib - apply_patch $my_loc/patches/orocos_kdl.patch - - # Patch PCL - Disable optionals. - apply_patch $my_loc/patches/pcl-1.8.1.patch - - # Patch uuid - Avoiding stdlib.h include - apply_patch $my_loc/patches/uuid.patch - - # Patch yaml - Avoid building tests - apply_patch $my_loc/patches/yaml-cpp.patch - - # Patch bullet - Avoid building examples - apply_patch $my_loc/patches/bullet.patch - - ## ROS patches - - # Patch rosconsole - Add android backend - apply_patch $my_loc/patches/rosconsole.patch - - # Patch catkin - Fix transitive linking of interface libraries for static builds - apply_patch $my_loc/patches/catkin.patch - - # Patch map_server - Fix find yaml - apply_patch $my_loc/patches/map_server.patch - - # Patch bondcpp - Fix transitive linking problems - apply_patch $my_loc/patches/bondcpp.patch - - # Patch image_publisher - Fix linking problems, transitive linking, - # and changed shared to static library building. - apply_patch $my_loc/patches/image_publisher.patch - - # Patch image_rotate - Fix find opencv and transitive linking problem - apply_patch $my_loc/patches/image_rotate.patch - - # Patch opencv - Fix installation path - apply_patch $my_loc/patches/opencv.patch - - # Patch actionlib - problems with Boost changes. - apply_patch $my_loc/patches/actionlib.patch - - # Patch rospack - problems with Boost changes - # Also emptied some unnecessary functions to avoid problems related to including Python. - apply_patch $my_loc/patches/rospack.patch - - # Patch xmlrpcpp - problems with Boost changes. - apply_patch $my_loc/patches/xmlrpcpp.patch - - # Patch roslib - weird issue with rospack. - # TODO: Need to look further (only on catkin_make_isolated) - # apply_patch /opt/roscpp_android/patches/roslib.patch - - # Patch collada_parser - cmake detects mkstemps even though Android does not support it - # TODO: investigate how to prevent cmake to detect system mkstemps -# apply_patch $my_loc/patches/collada_parser.patch - - # Patch laser_assembler - Remove testing for Android - # TODO: It seems like there may be a better way to handle the test issues - # http://stackoverflow.com/questions/22055741/googletest-for-android-ndk - # apply_patch $my_loc/patches/laser_assembler.patch - - # Patch laser_filters - Remove testing for Android - # TODO: It seems like there may be a better way to handle the test issues - # http://stackoverflow.com/questions/22055741/googletest-for-android-ndk - # https://source.android.com/reference/com/android/tradefed/testtype/GTest.html - # apply_patch $my_loc/patches/laser_filters.patch - - # Patch camera_info_manager - remove testing for Android - # TODO: It seems like there may be a better way to handle the test issues - # http://stackoverflow.com/questions/22055741/googletest-for-android-ndk - # https://source.android.com/reference/com/android/tradefed/testtype/GTest.html - apply_patch $my_loc/patches/camera_info_manager.patch - - # Patch camera_calibration_parsers - deleted python things and solved problem finding Boost. - apply_patch $my_loc/patches/camera_calibration_parsers.patch - - # Patch cv_bridge - fix transitive linking in cv_bridge-extras.cmake - apply_patch $my_loc/patches/cv_bridge.patch - - # Patch theora_image_transport - fix transitive linking - apply_patch $my_loc/patches/theora_image_transport.patch - - # Patch robot_pose_ekf - Add bfl library cmake variables, also, remove tests - # TODO: The correct way to handle this would be to create .cmake files for bfl and do a findpackage(orocos-bfl) - # apply_patch $my_loc/patches/robot_pose_ekf.patch - - # Patch robot_state_publisher - Add ARCHIVE DESTINATION - # TODO: Create PR to add ARCHIVE DESTINATION - apply_patch $my_loc/patches/robot_state_publisher.patch - - # Patch moveit_core - Add fcl library cmake variables - # TODO: The correct way to handle this would be to create .cmake files for fcl and do a findpackage(fcl) - #apply_patch $my_loc/patches/moveit_core.patch - - # Patch moveit_core plugins - Add ARCHIVE DESTINATION - # TODO: PR merged: https://github.com/ros-planning/moveit_core/pull/251 - # Wait for next release to remove (current 0.6.15) - #apply_patch $my_loc/patches/moveit_core_plugins.patch - - # Patch camera_calibration_parsers - Fix yaml-cpp dependency - # TODO: PR created: https://github.com/ros-perception/image_common/pull/36 - # apply_patch $my_loc/patches/camera_calibration_parsers.patch - - # Patch image_view - Solved YAML linking problems, and transitive linking. - apply_patch $my_loc/patches/image_view.patch - - # Patch depth_image_proc - Solved transitive linking problems - apply_patch $my_loc/patches/depth_image_proc.patch - - # Patch urdf - Fixed linking with pluginlib and dependencies in downstream packages - apply_patch $my_loc/patches/urdf.patch - - # Patch global_planner - Add angles dependency - # TODO: PR merged: https://github.com/ros-planning/navigation/pull/359 - # Wait for next release to remove (current 1.12.4) - # apply_patch $my_loc/patches/global_planner.patch - - #Patch Poco lib - apply_patch $my_loc/patches/poco.patch - - # Plugin specific patches - if [ $use_pluginlib -ne 0 ]; then - # Patch pluginlib for static loading - apply_patch $my_loc/patches/pluginlib.patch - # apply_patch image_transport # to fix faulty export plugins - apply_patch $my_loc/patches/image_transport.patch - fi - - ## Demo Application specific patches - + run_cmd apply_patches $my_loc/patches/source_patches $prefix fi # Before build diff --git a/patches/collada_parser.patch b/patches/graveyard/collada_parser.patch similarity index 100% rename from patches/collada_parser.patch rename to patches/graveyard/collada_parser.patch diff --git a/patches/global_planner.patch b/patches/graveyard/global_planner.patch similarity index 100% rename from patches/global_planner.patch rename to patches/graveyard/global_planner.patch diff --git a/patches/laser_assembler.patch b/patches/graveyard/laser_assembler.patch similarity index 100% rename from patches/laser_assembler.patch rename to patches/graveyard/laser_assembler.patch diff --git a/patches/laser_filters.patch b/patches/graveyard/laser_filters.patch similarity index 100% rename from patches/laser_filters.patch rename to patches/graveyard/laser_filters.patch diff --git a/patches/moveit_core.patch b/patches/graveyard/moveit_core.patch similarity index 100% rename from patches/moveit_core.patch rename to patches/graveyard/moveit_core.patch diff --git a/patches/moveit_core_plugins.patch b/patches/graveyard/moveit_core_plugins.patch similarity index 100% rename from patches/moveit_core_plugins.patch rename to patches/graveyard/moveit_core_plugins.patch diff --git a/patches/qhull.patch b/patches/graveyard/qhull.patch similarity index 100% rename from patches/qhull.patch rename to patches/graveyard/qhull.patch diff --git a/patches/robot_pose_ekf.patch b/patches/graveyard/robot_pose_ekf.patch similarity index 100% rename from patches/robot_pose_ekf.patch rename to patches/graveyard/robot_pose_ekf.patch diff --git a/patches/roslib.patch b/patches/graveyard/roslib.patch similarity index 100% rename from patches/roslib.patch rename to patches/graveyard/roslib.patch diff --git a/patches/actionlib.patch b/patches/source_patches/actionlib.patch similarity index 100% rename from patches/actionlib.patch rename to patches/source_patches/actionlib.patch diff --git a/patches/assimp.patch b/patches/source_patches/assimp.patch similarity index 100% rename from patches/assimp.patch rename to patches/source_patches/assimp.patch diff --git a/patches/bfl.patch b/patches/source_patches/bfl.patch similarity index 100% rename from patches/bfl.patch rename to patches/source_patches/bfl.patch diff --git a/patches/bondcpp.patch b/patches/source_patches/bondcpp.patch similarity index 100% rename from patches/bondcpp.patch rename to patches/source_patches/bondcpp.patch diff --git a/patches/bullet.patch b/patches/source_patches/bullet.patch similarity index 100% rename from patches/bullet.patch rename to patches/source_patches/bullet.patch diff --git a/patches/camera_calibration_parsers.patch b/patches/source_patches/camera_calibration_parsers.patch similarity index 100% rename from patches/camera_calibration_parsers.patch rename to patches/source_patches/camera_calibration_parsers.patch diff --git a/patches/camera_info_manager.patch b/patches/source_patches/camera_info_manager.patch similarity index 100% rename from patches/camera_info_manager.patch rename to patches/source_patches/camera_info_manager.patch diff --git a/patches/catkin.patch b/patches/source_patches/catkin.patch similarity index 100% rename from patches/catkin.patch rename to patches/source_patches/catkin.patch diff --git a/patches/collada_dom.patch b/patches/source_patches/collada_dom.patch similarity index 100% rename from patches/collada_dom.patch rename to patches/source_patches/collada_dom.patch diff --git a/patches/console_bridge.patch b/patches/source_patches/console_bridge.patch similarity index 100% rename from patches/console_bridge.patch rename to patches/source_patches/console_bridge.patch diff --git a/patches/cv_bridge.patch b/patches/source_patches/cv_bridge.patch similarity index 100% rename from patches/cv_bridge.patch rename to patches/source_patches/cv_bridge.patch diff --git a/patches/depth_image_proc.patch b/patches/source_patches/depth_image_proc.patch similarity index 100% rename from patches/depth_image_proc.patch rename to patches/source_patches/depth_image_proc.patch diff --git a/patches/image_publisher.patch b/patches/source_patches/image_publisher.patch similarity index 100% rename from patches/image_publisher.patch rename to patches/source_patches/image_publisher.patch diff --git a/patches/image_rotate.patch b/patches/source_patches/image_rotate.patch similarity index 100% rename from patches/image_rotate.patch rename to patches/source_patches/image_rotate.patch diff --git a/patches/image_transport.patch b/patches/source_patches/image_transport.patch similarity index 100% rename from patches/image_transport.patch rename to patches/source_patches/image_transport.patch diff --git a/patches/image_view.patch b/patches/source_patches/image_view.patch similarity index 100% rename from patches/image_view.patch rename to patches/source_patches/image_view.patch diff --git a/patches/lz4.patch b/patches/source_patches/lz4.patch similarity index 100% rename from patches/lz4.patch rename to patches/source_patches/lz4.patch diff --git a/patches/map_server.patch b/patches/source_patches/map_server.patch similarity index 100% rename from patches/map_server.patch rename to patches/source_patches/map_server.patch diff --git a/patches/opencv.patch b/patches/source_patches/opencv.patch similarity index 100% rename from patches/opencv.patch rename to patches/source_patches/opencv.patch diff --git a/patches/orocos_kdl.patch b/patches/source_patches/orocos_kdl.patch similarity index 100% rename from patches/orocos_kdl.patch rename to patches/source_patches/orocos_kdl.patch diff --git a/patches/pcl-1.8.1.patch b/patches/source_patches/pcl-1.8.1.patch similarity index 100% rename from patches/pcl-1.8.1.patch rename to patches/source_patches/pcl-1.8.1.patch diff --git a/patches/pluginlib.patch b/patches/source_patches/pluginlib.patch similarity index 100% rename from patches/pluginlib.patch rename to patches/source_patches/pluginlib.patch diff --git a/patches/poco.patch b/patches/source_patches/poco.patch similarity index 100% rename from patches/poco.patch rename to patches/source_patches/poco.patch diff --git a/patches/robot_state_publisher.patch b/patches/source_patches/robot_state_publisher.patch similarity index 100% rename from patches/robot_state_publisher.patch rename to patches/source_patches/robot_state_publisher.patch diff --git a/patches/rosbag_storage.patch b/patches/source_patches/rosbag_storage.patch similarity index 100% rename from patches/rosbag_storage.patch rename to patches/source_patches/rosbag_storage.patch diff --git a/patches/rosconsole.patch b/patches/source_patches/rosconsole.patch similarity index 100% rename from patches/rosconsole.patch rename to patches/source_patches/rosconsole.patch diff --git a/patches/rospack.patch b/patches/source_patches/rospack.patch similarity index 100% rename from patches/rospack.patch rename to patches/source_patches/rospack.patch diff --git a/patches/theora_image_transport.patch b/patches/source_patches/theora_image_transport.patch similarity index 100% rename from patches/theora_image_transport.patch rename to patches/source_patches/theora_image_transport.patch diff --git a/patches/urdf.patch b/patches/source_patches/urdf.patch similarity index 100% rename from patches/urdf.patch rename to patches/source_patches/urdf.patch diff --git a/patches/urdfdom.patch b/patches/source_patches/urdfdom.patch similarity index 100% rename from patches/urdfdom.patch rename to patches/source_patches/urdfdom.patch diff --git a/patches/uuid.patch b/patches/source_patches/uuid.patch similarity index 100% rename from patches/uuid.patch rename to patches/source_patches/uuid.patch diff --git a/patches/xmlrpcpp.patch b/patches/source_patches/xmlrpcpp.patch similarity index 100% rename from patches/xmlrpcpp.patch rename to patches/source_patches/xmlrpcpp.patch diff --git a/patches/yaml-cpp.patch b/patches/source_patches/yaml-cpp.patch similarity index 100% rename from patches/yaml-cpp.patch rename to patches/source_patches/yaml-cpp.patch From a195fe63616a00efc7f85bc29266c82190fa69e7 Mon Sep 17 00:00:00 2001 From: Ivan Paunovic Date: Mon, 7 Jan 2019 10:32:55 -0300 Subject: [PATCH 06/29] Clearer format when logging with rosconsole. Some other nits modified --- patches/rosconsole.patch | 57 +++++++++++++++++++--------------------- 1 file changed, 27 insertions(+), 30 deletions(-) diff --git a/patches/rosconsole.patch b/patches/rosconsole.patch index 1da6087..eac79ef 100644 --- a/patches/rosconsole.patch +++ b/patches/rosconsole.patch @@ -1,6 +1,6 @@ --- catkin_ws/src/ros_comm/rosconsole/CMakeLists.txt +++ catkin_ws/src/ros_comm/rosconsole/CMakeLists.txt -@@ -10,9 +10,10 @@ +@@ -10,9 +10,10 @@ find_package(catkin REQUIRED COMPONENTS cpp_common rostime rosunit) find_package(Boost COMPONENTS regex system thread) # select rosconsole backend @@ -12,7 +12,7 @@ if(ROSCONSOLE_BACKEND STREQUAL "" OR ROSCONSOLE_BACKEND STREQUAL "log4cxx") find_package(Log4cxx QUIET) if(NOT LOG4CXX_LIBRARIES) -@@ -27,9 +28,22 @@ +@@ -27,9 +28,22 @@ if(ROSCONSOLE_BACKEND STREQUAL "" OR ROSCONSOLE_BACKEND STREQUAL "log4cxx") message(FATAL_ERROR "Couldn't find log4cxx library") endif() endif() @@ -37,7 +37,7 @@ if(GLOG_FOUND) list(APPEND rosconsole_backend_INCLUDE_DIRS ${GLOG_INCLUDE_DIRS}) list(APPEND rosconsole_backend_LIBRARIES rosconsole_glog rosconsole_backend_interface ${GLOG_LIBRARIES}) -@@ -85,6 +99,9 @@ +@@ -85,6 +99,9 @@ elseif(ROSCONSOLE_BACKEND STREQUAL "glog") elseif(ROSCONSOLE_BACKEND STREQUAL "print") add_library(rosconsole_print src/rosconsole/impl/rosconsole_print.cpp) target_link_libraries(rosconsole_print rosconsole_backend_interface) @@ -50,7 +50,7 @@ --- /dev/null +++ catkin_ws/src/ros_comm/rosconsole/src/rosconsole/impl/rosconsole_android.cpp -@@ -0,0 +1,128 @@ +@@ -0,0 +1,125 @@ +#include "ros/console.h" + +#include @@ -78,37 +78,34 @@ + } + + android_LogPriority android_log_level; -+ if(level == ::ros::console::levels::Info) -+ { -+ android_log_level = ANDROID_LOG_INFO; -+ } -+ else if(level == ::ros::console::levels::Warn) -+ { -+ android_log_level = ANDROID_LOG_WARN; -+ } -+ else if(level == ::ros::console::levels::Error) -+ { -+ android_log_level = ANDROID_LOG_ERROR; -+ } -+ else if(level == ::ros::console::levels::Fatal) -+ { -+ android_log_level = ANDROID_LOG_FATAL; -+ } -+ else if (level == ::ros::console::levels::Debug) -+ { -+ android_log_level = ANDROID_LOG_DEBUG; -+ } -+ else -+ { -+ // ignore debug -+ return; ++ ++ switch (level) { ++ case ::ros::console::levels::Info: ++ android_log_level = ANDROID_LOG_INFO; ++ break; ++ case ::ros::console::levels::Warn: ++ android_log_level = ANDROID_LOG_WARN; ++ break; ++ case ::ros::console::levels::Error: ++ android_log_level = ANDROID_LOG_ERROR; ++ break; ++ case ::ros::console::levels::Fatal: ++ android_log_level = ANDROID_LOG_FATAL; ++ break; ++ case ::ros::console::levels::Debug: ++ android_log_level = ANDROID_LOG_DEBUG; ++ break; ++ default: ++ return; + } + + std::string name = getName(handle); + + std::stringstream ss; -+ ss << name << ": in file:" << file << ":" << line; -+ __android_log_print(android_log_level, ss.str().c_str(), "%s", str); ++ ss << ": " << str; ++ // Note(ivanpauno): If file and line number are wanted, replace with ++ // ss << ", in file \'" << file << "\', line \'" << line << "\': " << str; ++ __android_log_print(android_log_level, name.c_str(), "%s", ss.str().c_str()); +} + +bool isEnabledFor(void* handle, ::ros::console::Level level) From ec542cedc042e54e65b4a7c99068c5301e7316f1 Mon Sep 17 00:00:00 2001 From: Ivan Paunovic Date: Mon, 7 Jan 2019 13:43:04 -0300 Subject: [PATCH 07/29] Corrected extra colon when logging with rosconsole --- patches/rosconsole.patch | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/patches/rosconsole.patch b/patches/rosconsole.patch index eac79ef..8d6292b 100644 --- a/patches/rosconsole.patch +++ b/patches/rosconsole.patch @@ -100,12 +100,12 @@ + } + + std::string name = getName(handle); ++ __android_log_print(android_log_level, name.c_str(), "%s", str); + -+ std::stringstream ss; -+ ss << ": " << str; + // Note(ivanpauno): If file and line number are wanted, replace with -+ // ss << ", in file \'" << file << "\', line \'" << line << "\': " << str; -+ __android_log_print(android_log_level, name.c_str(), "%s", ss.str().c_str()); ++ // std::stringstream ss; ++ // ss << "in file \'" << file << "\', line \'" << line << "\': " << str; ++ // __android_log_print(android_log_level, name.c_str(), "%s", ss.str().c_str()); +} + +bool isEnabledFor(void* handle, ::ros::console::Level level) From a0ce17ccd3d43488a7f405cb3954d9d6ec92503d Mon Sep 17 00:00:00 2001 From: Juan Ignacio Ubeira Date: Tue, 8 Jan 2019 10:32:30 -0300 Subject: [PATCH 08/29] Pluginlib support always enabled; removing flag. --- config.sh | 4 ---- do_everything.sh | 40 +++++++++++++++++++--------------------- 2 files changed, 19 insertions(+), 25 deletions(-) diff --git a/config.sh b/config.sh index ee8075a..5971111 100644 --- a/config.sh +++ b/config.sh @@ -6,7 +6,3 @@ export ANDROID_PLATFORM=android-24 # Enable this value for debug build #CMAKE_BUILD_TYPE=Debug CMAKE_BUILD_TYPE=Release - -# Enable this if you need to use pluginlib in Android. -# The plugins will be statically linked -use_pluginlib=1 diff --git a/do_everything.sh b/do_everything.sh index c0a2c72..ca00a31 100755 --- a/do_everything.sh +++ b/do_everything.sh @@ -119,29 +119,27 @@ fi # Before build # Search packages that depend on pluginlib and generate plugin loader. -if [ $use_pluginlib -ne 0 ]; then - echo - echo -e '\e[34mBuilding pluginlib support...\e[39m' - echo +echo +echo -e '\e[34mBuilding pluginlib support...\e[39m' +echo - pluginlib_helper_file=pluginlib_helper.cpp - $my_loc/files/pluginlib_helper/pluginlib_helper.py -scanroot $prefix/catkin_ws/src $user_workspace -cppout $my_loc/files/pluginlib_helper/$pluginlib_helper_file - cp $my_loc/files/pluginlib_helper/$pluginlib_helper_file $prefix/catkin_ws/src/pluginlib/src/ - line="add_library(pluginlib STATIC src/pluginlib_helper.cpp)" - # temporally turn off error detection - set +e - grep "$line" $prefix/catkin_ws/src/pluginlib/CMakeLists.txt - # if line is not already added, then add it to the pluginlib cmake - if [ $? -ne 0 ]; then - # backup the file - cp $prefix/catkin_ws/src/pluginlib/CMakeLists.txt $prefix/catkin_ws/src/pluginlib/CMakeLists.txt.bak - sed -i '/INCLUDE_DIRS include/a LIBRARIES ${PROJECT_NAME}' $prefix/catkin_ws/src/pluginlib/CMakeLists.txt - echo -e "\n"$line >> $prefix/catkin_ws/src/pluginlib/CMakeLists.txt - echo 'install(TARGETS pluginlib RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION} ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION} LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION})' >> $prefix/catkin_ws/src/pluginlib/CMakeLists.txt - fi - # turn error detection back on - set -e +pluginlib_helper_file=pluginlib_helper.cpp +$my_loc/files/pluginlib_helper/pluginlib_helper.py -scanroot $prefix/catkin_ws/src $user_workspace -cppout $my_loc/files/pluginlib_helper/$pluginlib_helper_file +cp $my_loc/files/pluginlib_helper/$pluginlib_helper_file $prefix/catkin_ws/src/pluginlib/src/ +line="add_library(pluginlib STATIC src/pluginlib_helper.cpp)" +# temporally turn off error detection +set +e +grep "$line" $prefix/catkin_ws/src/pluginlib/CMakeLists.txt +# if line is not already added, then add it to the pluginlib cmake +if [ $? -ne 0 ]; then + # backup the file + cp $prefix/catkin_ws/src/pluginlib/CMakeLists.txt $prefix/catkin_ws/src/pluginlib/CMakeLists.txt.bak + sed -i '/INCLUDE_DIRS include/a LIBRARIES ${PROJECT_NAME}' $prefix/catkin_ws/src/pluginlib/CMakeLists.txt + echo -e "\n"$line >> $prefix/catkin_ws/src/pluginlib/CMakeLists.txt + echo 'install(TARGETS pluginlib RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION} ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION} LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION})' >> $prefix/catkin_ws/src/pluginlib/CMakeLists.txt fi +# turn error detection back on +set -e echo echo -e '\e[34mBuilding library dependencies.\e[39m' From 74bb4b684d5c3f93e666e209a48f017d8e13d471 Mon Sep 17 00:00:00 2001 From: Juan Ignacio Ubeira Date: Tue, 8 Jan 2019 12:09:53 -0300 Subject: [PATCH 09/29] Moving patches one level up; replacing toolchain patch for a cmake file that includes the one inside NDK. --- android.toolchain.cmake | 27 ++++++++ do_everything.sh | 5 +- patches/{source_patches => }/actionlib.patch | 0 patches/android.toolchain.cmake.patch | 68 ------------------- patches/{source_patches => }/assimp.patch | 0 patches/{source_patches => }/bfl.patch | 0 patches/{source_patches => }/bondcpp.patch | 0 patches/{source_patches => }/bullet.patch | 0 .../camera_calibration_parsers.patch | 0 .../camera_info_manager.patch | 0 patches/{source_patches => }/catkin.patch | 0 .../{source_patches => }/collada_dom.patch | 0 .../{source_patches => }/console_bridge.patch | 0 patches/{source_patches => }/cv_bridge.patch | 0 .../depth_image_proc.patch | 0 .../image_publisher.patch | 0 .../{source_patches => }/image_rotate.patch | 0 .../image_transport.patch | 0 patches/{source_patches => }/image_view.patch | 0 patches/{source_patches => }/lz4.patch | 0 patches/{source_patches => }/map_server.patch | 0 patches/{source_patches => }/opencv.patch | 0 patches/{source_patches => }/orocos_kdl.patch | 0 patches/{source_patches => }/pcl-1.8.1.patch | 0 patches/{source_patches => }/pluginlib.patch | 0 patches/{source_patches => }/poco.patch | 0 .../robot_state_publisher.patch | 0 .../{source_patches => }/rosbag_storage.patch | 0 patches/{source_patches => }/rosconsole.patch | 0 patches/{source_patches => }/rospack.patch | 0 .../theora_image_transport.patch | 0 patches/{source_patches => }/urdf.patch | 0 patches/{source_patches => }/urdfdom.patch | 0 patches/{source_patches => }/uuid.patch | 0 patches/{source_patches => }/xmlrpcpp.patch | 0 patches/{source_patches => }/yaml-cpp.patch | 0 36 files changed, 29 insertions(+), 71 deletions(-) create mode 100644 android.toolchain.cmake rename patches/{source_patches => }/actionlib.patch (100%) delete mode 100644 patches/android.toolchain.cmake.patch rename patches/{source_patches => }/assimp.patch (100%) rename patches/{source_patches => }/bfl.patch (100%) rename patches/{source_patches => }/bondcpp.patch (100%) rename patches/{source_patches => }/bullet.patch (100%) rename patches/{source_patches => }/camera_calibration_parsers.patch (100%) rename patches/{source_patches => }/camera_info_manager.patch (100%) rename patches/{source_patches => }/catkin.patch (100%) rename patches/{source_patches => }/collada_dom.patch (100%) rename patches/{source_patches => }/console_bridge.patch (100%) rename patches/{source_patches => }/cv_bridge.patch (100%) rename patches/{source_patches => }/depth_image_proc.patch (100%) rename patches/{source_patches => }/image_publisher.patch (100%) rename patches/{source_patches => }/image_rotate.patch (100%) rename patches/{source_patches => }/image_transport.patch (100%) rename patches/{source_patches => }/image_view.patch (100%) rename patches/{source_patches => }/lz4.patch (100%) rename patches/{source_patches => }/map_server.patch (100%) rename patches/{source_patches => }/opencv.patch (100%) rename patches/{source_patches => }/orocos_kdl.patch (100%) rename patches/{source_patches => }/pcl-1.8.1.patch (100%) rename patches/{source_patches => }/pluginlib.patch (100%) rename patches/{source_patches => }/poco.patch (100%) rename patches/{source_patches => }/robot_state_publisher.patch (100%) rename patches/{source_patches => }/rosbag_storage.patch (100%) rename patches/{source_patches => }/rosconsole.patch (100%) rename patches/{source_patches => }/rospack.patch (100%) rename patches/{source_patches => }/theora_image_transport.patch (100%) rename patches/{source_patches => }/urdf.patch (100%) rename patches/{source_patches => }/urdfdom.patch (100%) rename patches/{source_patches => }/uuid.patch (100%) rename patches/{source_patches => }/xmlrpcpp.patch (100%) rename patches/{source_patches => }/yaml-cpp.patch (100%) diff --git a/android.toolchain.cmake b/android.toolchain.cmake new file mode 100644 index 0000000..286b902 --- /dev/null +++ b/android.toolchain.cmake @@ -0,0 +1,27 @@ + +if(ANDROID_NDK_TOOLCHAIN_INCLUDED) + return() +endif(ANDROID_NDK_TOOLCHAIN_INCLUDED) +include($ENV{ANDROID_NDK_HOME}/build/cmake/android.toolchain.cmake) + +# Debug and release flags. +list(REMOVE_ITEM ANDROID_COMPILER_FLAGS -g) +list(APPEND ANDROID_COMPILER_FLAGS_DEBUG -g) +list(APPEND ANDROID_COMPILER_FLAGS_RELWITHDEBINFO -g ${ANDROID_COMPILER_FLAGS_RELEASE}) + +if(ANDROID_TOOLCHAIN STREQUAL clang) + list(APPEND ANDROID_COMPILER_FLAGS_RELWITHDEBINFO -fno-limit-debug-info) +endif() + +# Toolchain ABI specific flags. +string(REPLACE ";" " " ANDROID_COMPILER_FLAGS_RELWITHDEBINFO "${ANDROID_COMPILER_FLAGS_RELWITHDEBINFO}") +set(CMAKE_C_FLAGS_RELWITHDEBINFO "" + CACHE STRING "Flags used by the compiler during relwithdebinfo builds.") +set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "" + CACHE STRING "Flags used by the compiler during relwithdebinfo builds.") +set(CMAKE_ASM_FLAGS_RELWITHDEBINFO "" + CACHE STRING "Flags used by the compiler during relwithdebinfo builds.") + +set(CMAKE_C_FLAGS_RELWITHDEBINFO "${ANDROID_COMPILER_FLAGS_RELWITHDEBINFO} ${CMAKE_C_FLAGS_RELWITHDEBINFO}") +set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${ANDROID_COMPILER_FLAGS_RELWITHDEBINFO} ${CMAKE_CXX_FLAGS_RELWITHDEBINFO}") +set(CMAKE_ASM_FLAGS_RELWITHDEBINFO "${ANDROID_COMPILER_FLAGS_RELWITHDEBINFO} ${CMAKE_ASM_FLAGS_RELWITHDEBINFO}") diff --git a/do_everything.sh b/do_everything.sh index ca00a31..253f919 100755 --- a/do_everything.sh +++ b/do_everything.sh @@ -101,8 +101,7 @@ mkdir -p $prefix/libs export TARGET_DIR=$prefix/target [ -d $TARGET_DIR ] || mkdir -p $TARGET_DIR -export RBA_TOOLCHAIN=$ANDROID_NDK_HOME/build/cmake/android.toolchain.cmake -apply_patch $my_loc/patches/android.toolchain.cmake.patch -d $ANDROID_NDK_HOME/build/cmake +export RBA_TOOLCHAIN=$my_loc/android.toolchain.cmake # Get all library dependencies. run_cmd get_system_dependencies $my_loc/system_deps.rosinstall $prefix/libs $my_loc/files @@ -114,7 +113,7 @@ echo if [[ $skip -ne 1 ]] ; then run_cmd get_catkin_packages $prefix - run_cmd apply_patches $my_loc/patches/source_patches $prefix + run_cmd apply_patches $my_loc/patches $prefix fi # Before build diff --git a/patches/source_patches/actionlib.patch b/patches/actionlib.patch similarity index 100% rename from patches/source_patches/actionlib.patch rename to patches/actionlib.patch diff --git a/patches/android.toolchain.cmake.patch b/patches/android.toolchain.cmake.patch deleted file mode 100644 index 3d43708..0000000 --- a/patches/android.toolchain.cmake.patch +++ /dev/null @@ -1,68 +0,0 @@ ---- android.toolchain.cmake 2018-12-04 14:30:11.366826315 +0000 -+++ android.toolchain.cmake 2018-12-04 14:36:09.124348720 +0000 -@@ -358,6 +358,7 @@ - set(ANDROID_COMPILER_FLAGS) - set(ANDROID_COMPILER_FLAGS_CXX) - set(ANDROID_COMPILER_FLAGS_DEBUG) -+set(ANDROID_COMPILER_FLAGS_RELWITHDEBINFO) - set(ANDROID_COMPILER_FLAGS_RELEASE) - set(ANDROID_LINKER_FLAGS) - set(ANDROID_LINKER_FLAGS_EXE) -@@ -517,7 +518,6 @@ - - # Generic flags. - list(APPEND ANDROID_COMPILER_FLAGS -- -g - -DANDROID - -ffunction-sections - -funwind-tables -@@ -532,15 +532,17 @@ - -Wl,-z,nocopyreloc) - - # Debug and release flags. --list(APPEND ANDROID_COMPILER_FLAGS_DEBUG -O0) -+list(APPEND ANDROID_COMPILER_FLAGS_DEBUG -g -O0) - if(ANDROID_ABI MATCHES "^armeabi" AND ANDROID_ARM_MODE STREQUAL thumb) - list(APPEND ANDROID_COMPILER_FLAGS_RELEASE -Oz) - else() - list(APPEND ANDROID_COMPILER_FLAGS_RELEASE -O2) - endif() - list(APPEND ANDROID_COMPILER_FLAGS_RELEASE -DNDEBUG) -+list(APPEND ANDROID_COMPILER_FLAGS_RELWITHDEBINFO -g ${ANDROID_COMPILER_FLAGS_RELEASE}) - if(ANDROID_TOOLCHAIN STREQUAL clang) - list(APPEND ANDROID_COMPILER_FLAGS_DEBUG -fno-limit-debug-info) -+ list(APPEND ANDROID_COMPILER_FLAGS_RELWITHDEBINFO -fno-limit-debug-info) - endif() - - # Toolchain and ABI specific flags. -@@ -702,6 +704,7 @@ - string(REPLACE ";" " " ANDROID_COMPILER_FLAGS "${ANDROID_COMPILER_FLAGS}") - string(REPLACE ";" " " ANDROID_COMPILER_FLAGS_CXX "${ANDROID_COMPILER_FLAGS_CXX}") - string(REPLACE ";" " " ANDROID_COMPILER_FLAGS_DEBUG "${ANDROID_COMPILER_FLAGS_DEBUG}") -+string(REPLACE ";" " " ANDROID_COMPILER_FLAGS_RELWITHDEBINFO "${ANDROID_COMPILER_FLAGS_RELWITHDEBINFO}") - string(REPLACE ";" " " ANDROID_COMPILER_FLAGS_RELEASE "${ANDROID_COMPILER_FLAGS_RELEASE}") - string(REPLACE ";" " " ANDROID_LINKER_FLAGS "${ANDROID_LINKER_FLAGS}") - string(REPLACE ";" " " ANDROID_LINKER_FLAGS_EXE "${ANDROID_LINKER_FLAGS_EXE}") -@@ -738,6 +741,12 @@ - CACHE STRING "Flags used by the compiler during debug builds.") - set(CMAKE_ASM_FLAGS_DEBUG "" - CACHE STRING "Flags used by the compiler during debug builds.") -+set(CMAKE_C_FLAGS_RELWITHDEBINFO "" -+ CACHE STRING "Flags used by the compiler during relwithdebinfo builds.") -+set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "" -+ CACHE STRING "Flags used by the compiler during relwithdebinfo builds.") -+set(CMAKE_ASM_FLAGS_RELWITHDEBINFO "" -+ CACHE STRING "Flags used by the compiler during relwithdebinfo builds.") - set(CMAKE_C_FLAGS_RELEASE "" - CACHE STRING "Flags used by the compiler during release builds.") - set(CMAKE_CXX_FLAGS_RELEASE "" -@@ -757,6 +766,9 @@ - set(CMAKE_C_FLAGS_DEBUG "${ANDROID_COMPILER_FLAGS_DEBUG} ${CMAKE_C_FLAGS_DEBUG}") - set(CMAKE_CXX_FLAGS_DEBUG "${ANDROID_COMPILER_FLAGS_DEBUG} ${CMAKE_CXX_FLAGS_DEBUG}") - set(CMAKE_ASM_FLAGS_DEBUG "${ANDROID_COMPILER_FLAGS_DEBUG} ${CMAKE_ASM_FLAGS_DEBUG}") -+set(CMAKE_C_FLAGS_RELWITHDEBINFO "${ANDROID_COMPILER_FLAGS_RELWITHDEBINFO} ${CMAKE_C_FLAGS_RELWITHDEBINFO}") -+set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${ANDROID_COMPILER_FLAGS_RELWITHDEBINFO} ${CMAKE_CXX_FLAGS_RELWITHDEBINFO}") -+set(CMAKE_ASM_FLAGS_RELWITHDEBINFO "${ANDROID_COMPILER_FLAGS_RELWITHDEBINFO} ${CMAKE_ASM_FLAGS_RELWITHDEBINFO}") - set(CMAKE_C_FLAGS_RELEASE "${ANDROID_COMPILER_FLAGS_RELEASE} ${CMAKE_C_FLAGS_RELEASE}") - set(CMAKE_CXX_FLAGS_RELEASE "${ANDROID_COMPILER_FLAGS_RELEASE} ${CMAKE_CXX_FLAGS_RELEASE}") - set(CMAKE_ASM_FLAGS_RELEASE "${ANDROID_COMPILER_FLAGS_RELEASE} ${CMAKE_ASM_FLAGS_RELEASE}") diff --git a/patches/source_patches/assimp.patch b/patches/assimp.patch similarity index 100% rename from patches/source_patches/assimp.patch rename to patches/assimp.patch diff --git a/patches/source_patches/bfl.patch b/patches/bfl.patch similarity index 100% rename from patches/source_patches/bfl.patch rename to patches/bfl.patch diff --git a/patches/source_patches/bondcpp.patch b/patches/bondcpp.patch similarity index 100% rename from patches/source_patches/bondcpp.patch rename to patches/bondcpp.patch diff --git a/patches/source_patches/bullet.patch b/patches/bullet.patch similarity index 100% rename from patches/source_patches/bullet.patch rename to patches/bullet.patch diff --git a/patches/source_patches/camera_calibration_parsers.patch b/patches/camera_calibration_parsers.patch similarity index 100% rename from patches/source_patches/camera_calibration_parsers.patch rename to patches/camera_calibration_parsers.patch diff --git a/patches/source_patches/camera_info_manager.patch b/patches/camera_info_manager.patch similarity index 100% rename from patches/source_patches/camera_info_manager.patch rename to patches/camera_info_manager.patch diff --git a/patches/source_patches/catkin.patch b/patches/catkin.patch similarity index 100% rename from patches/source_patches/catkin.patch rename to patches/catkin.patch diff --git a/patches/source_patches/collada_dom.patch b/patches/collada_dom.patch similarity index 100% rename from patches/source_patches/collada_dom.patch rename to patches/collada_dom.patch diff --git a/patches/source_patches/console_bridge.patch b/patches/console_bridge.patch similarity index 100% rename from patches/source_patches/console_bridge.patch rename to patches/console_bridge.patch diff --git a/patches/source_patches/cv_bridge.patch b/patches/cv_bridge.patch similarity index 100% rename from patches/source_patches/cv_bridge.patch rename to patches/cv_bridge.patch diff --git a/patches/source_patches/depth_image_proc.patch b/patches/depth_image_proc.patch similarity index 100% rename from patches/source_patches/depth_image_proc.patch rename to patches/depth_image_proc.patch diff --git a/patches/source_patches/image_publisher.patch b/patches/image_publisher.patch similarity index 100% rename from patches/source_patches/image_publisher.patch rename to patches/image_publisher.patch diff --git a/patches/source_patches/image_rotate.patch b/patches/image_rotate.patch similarity index 100% rename from patches/source_patches/image_rotate.patch rename to patches/image_rotate.patch diff --git a/patches/source_patches/image_transport.patch b/patches/image_transport.patch similarity index 100% rename from patches/source_patches/image_transport.patch rename to patches/image_transport.patch diff --git a/patches/source_patches/image_view.patch b/patches/image_view.patch similarity index 100% rename from patches/source_patches/image_view.patch rename to patches/image_view.patch diff --git a/patches/source_patches/lz4.patch b/patches/lz4.patch similarity index 100% rename from patches/source_patches/lz4.patch rename to patches/lz4.patch diff --git a/patches/source_patches/map_server.patch b/patches/map_server.patch similarity index 100% rename from patches/source_patches/map_server.patch rename to patches/map_server.patch diff --git a/patches/source_patches/opencv.patch b/patches/opencv.patch similarity index 100% rename from patches/source_patches/opencv.patch rename to patches/opencv.patch diff --git a/patches/source_patches/orocos_kdl.patch b/patches/orocos_kdl.patch similarity index 100% rename from patches/source_patches/orocos_kdl.patch rename to patches/orocos_kdl.patch diff --git a/patches/source_patches/pcl-1.8.1.patch b/patches/pcl-1.8.1.patch similarity index 100% rename from patches/source_patches/pcl-1.8.1.patch rename to patches/pcl-1.8.1.patch diff --git a/patches/source_patches/pluginlib.patch b/patches/pluginlib.patch similarity index 100% rename from patches/source_patches/pluginlib.patch rename to patches/pluginlib.patch diff --git a/patches/source_patches/poco.patch b/patches/poco.patch similarity index 100% rename from patches/source_patches/poco.patch rename to patches/poco.patch diff --git a/patches/source_patches/robot_state_publisher.patch b/patches/robot_state_publisher.patch similarity index 100% rename from patches/source_patches/robot_state_publisher.patch rename to patches/robot_state_publisher.patch diff --git a/patches/source_patches/rosbag_storage.patch b/patches/rosbag_storage.patch similarity index 100% rename from patches/source_patches/rosbag_storage.patch rename to patches/rosbag_storage.patch diff --git a/patches/source_patches/rosconsole.patch b/patches/rosconsole.patch similarity index 100% rename from patches/source_patches/rosconsole.patch rename to patches/rosconsole.patch diff --git a/patches/source_patches/rospack.patch b/patches/rospack.patch similarity index 100% rename from patches/source_patches/rospack.patch rename to patches/rospack.patch diff --git a/patches/source_patches/theora_image_transport.patch b/patches/theora_image_transport.patch similarity index 100% rename from patches/source_patches/theora_image_transport.patch rename to patches/theora_image_transport.patch diff --git a/patches/source_patches/urdf.patch b/patches/urdf.patch similarity index 100% rename from patches/source_patches/urdf.patch rename to patches/urdf.patch diff --git a/patches/source_patches/urdfdom.patch b/patches/urdfdom.patch similarity index 100% rename from patches/source_patches/urdfdom.patch rename to patches/urdfdom.patch diff --git a/patches/source_patches/uuid.patch b/patches/uuid.patch similarity index 100% rename from patches/source_patches/uuid.patch rename to patches/uuid.patch diff --git a/patches/source_patches/xmlrpcpp.patch b/patches/xmlrpcpp.patch similarity index 100% rename from patches/source_patches/xmlrpcpp.patch rename to patches/xmlrpcpp.patch diff --git a/patches/source_patches/yaml-cpp.patch b/patches/yaml-cpp.patch similarity index 100% rename from patches/source_patches/yaml-cpp.patch rename to patches/yaml-cpp.patch From 2c755cd743293d315cad7ab4b9887ce0b78eabd8 Mon Sep 17 00:00:00 2001 From: Johannes Meyer Date: Thu, 10 Jan 2019 16:27:19 +0100 Subject: [PATCH 10/29] docker: use cmake 3.6.4111459 provided by the Android SDK --- docker/Dockerfile | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/docker/Dockerfile b/docker/Dockerfile index a1a9d93..edec293 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -23,14 +23,8 @@ RUN apt-get update && apt-get install -y openjdk-8-jdk RUN wget https://dl.google.com/android/repository/sdk-tools-linux-4333796.zip RUN unzip sdk-tools-linux-4333796.zip -d /opt/android/sdk RUN yes | $ANDROID_HOME/tools/bin/sdkmanager --licenses -RUN $ANDROID_HOME/tools/bin/sdkmanager "build-tools;26.0.2" "platform-tools" "platforms;android-26" --sdk_root=/opt/android/sdk -ENV PATH /opt/android/sdk/tools:/opt/android/sdk/platform-tools:$PATH - -# Install CMake 3.6 -WORKDIR /opt -RUN wget https://cmake.org/files/v3.6/cmake-3.6.3-Linux-x86_64.sh && chmod +x cmake-3.6.3-Linux-x86_64.sh -RUN yes | sh '/opt/cmake-3.6.3-Linux-x86_64.sh' -RUN ln -s /opt/cmake-3.6.3-Linux-x86_64/bin/* -t /usr/local/bin +RUN $ANDROID_HOME/tools/bin/sdkmanager "build-tools;26.0.2" "platform-tools" "platforms;android-26" "cmake;3.6.4111459" --sdk_root=/opt/android/sdk +ENV PATH /opt/android/sdk/tools:/opt/android/sdk/platform-tools:/opt/android/sdk/cmake/3.6.4111459/bin:$PATH # Install Python libraries RUN apt-get install python-lxml -y From 0666975809a4da17a8b38bcd3b9a12fb2c9f0e7e Mon Sep 17 00:00:00 2001 From: Johannes Meyer Date: Thu, 10 Jan 2019 18:08:11 +0100 Subject: [PATCH 11/29] get_system_dependencies: fix permission errors when copying rospkg to files/ the second time --- get_system_dependencies.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/get_system_dependencies.sh b/get_system_dependencies.sh index 76aba70..2d5d53c 100755 --- a/get_system_dependencies.sh +++ b/get_system_dependencies.sh @@ -40,4 +40,4 @@ pushd $lib_prefix/boost popd # Rospkg -cp -r $lib_prefix/rospkg $files_prefix +cp -rn $lib_prefix/rospkg $files_prefix From c784b53e52d6c1c5054e7eceece5c21215791af5 Mon Sep 17 00:00:00 2001 From: Juan Ignacio Ubeira Date: Thu, 10 Jan 2019 14:10:48 -0300 Subject: [PATCH 12/29] Fix for toolchain flags. --- android.toolchain.cmake | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/android.toolchain.cmake b/android.toolchain.cmake index 286b902..5eadfc4 100644 --- a/android.toolchain.cmake +++ b/android.toolchain.cmake @@ -4,10 +4,13 @@ if(ANDROID_NDK_TOOLCHAIN_INCLUDED) endif(ANDROID_NDK_TOOLCHAIN_INCLUDED) include($ENV{ANDROID_NDK_HOME}/build/cmake/android.toolchain.cmake) -# Debug and release flags. -list(REMOVE_ITEM ANDROID_COMPILER_FLAGS -g) -list(APPEND ANDROID_COMPILER_FLAGS_DEBUG -g) -list(APPEND ANDROID_COMPILER_FLAGS_RELWITHDEBINFO -g ${ANDROID_COMPILER_FLAGS_RELEASE}) +## Build without debug symbols in Release mode and add RelWithDebInfo mode. +foreach(_var ANDROID_COMPILER_FLAGS CMAKE_C_FLAGS CMAKE_CXX_FLAGS CMAKE_ASM_FLAGS) + string(REPLACE "-g " "" ${_var} "${${_var}}") + set(${_var}_DEBUG "-g ${${_var}_DEBUG}") + set(${_var}_RELWITHDEBINFO "-g ${${_var}_RELEASE}") +endforeach() +unset(_var) if(ANDROID_TOOLCHAIN STREQUAL clang) list(APPEND ANDROID_COMPILER_FLAGS_RELWITHDEBINFO -fno-limit-debug-info) From 14e9d60cb8791e27c6d9882075702d16c91c358f Mon Sep 17 00:00:00 2001 From: Johannes Meyer Date: Thu, 10 Jan 2019 19:29:36 +0100 Subject: [PATCH 13/29] Fix standalone usage of build_catkin_workspace.sh --- build_catkin_workspace.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build_catkin_workspace.sh b/build_catkin_workspace.sh index 2dde671..ec93826 100755 --- a/build_catkin_workspace.sh +++ b/build_catkin_workspace.sh @@ -75,7 +75,7 @@ if [ "$PREFIX_PATH" = "" ]; then print_help exit 1 fi -: ${RBA_TOOLCHAIN:=$ANDROID_NDK/build/cmake/android.toolchain.cmake} +: ${RBA_TOOLCHAIN:=$my_loc/android.toolchain.cmake} # get the prefix path prefix=$(cd $PREFIX_PATH && pwd) From c034ca54f167934fa7b77b965105dea3be25dc94 Mon Sep 17 00:00:00 2001 From: Juan Ignacio Ubeira Date: Fri, 11 Jan 2019 12:28:18 -0300 Subject: [PATCH 14/29] Removing unnecessary code in android toolchain cmake. --- android.toolchain.cmake | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/android.toolchain.cmake b/android.toolchain.cmake index 5eadfc4..8e44702 100644 --- a/android.toolchain.cmake +++ b/android.toolchain.cmake @@ -15,16 +15,3 @@ unset(_var) if(ANDROID_TOOLCHAIN STREQUAL clang) list(APPEND ANDROID_COMPILER_FLAGS_RELWITHDEBINFO -fno-limit-debug-info) endif() - -# Toolchain ABI specific flags. -string(REPLACE ";" " " ANDROID_COMPILER_FLAGS_RELWITHDEBINFO "${ANDROID_COMPILER_FLAGS_RELWITHDEBINFO}") -set(CMAKE_C_FLAGS_RELWITHDEBINFO "" - CACHE STRING "Flags used by the compiler during relwithdebinfo builds.") -set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "" - CACHE STRING "Flags used by the compiler during relwithdebinfo builds.") -set(CMAKE_ASM_FLAGS_RELWITHDEBINFO "" - CACHE STRING "Flags used by the compiler during relwithdebinfo builds.") - -set(CMAKE_C_FLAGS_RELWITHDEBINFO "${ANDROID_COMPILER_FLAGS_RELWITHDEBINFO} ${CMAKE_C_FLAGS_RELWITHDEBINFO}") -set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${ANDROID_COMPILER_FLAGS_RELWITHDEBINFO} ${CMAKE_CXX_FLAGS_RELWITHDEBINFO}") -set(CMAKE_ASM_FLAGS_RELWITHDEBINFO "${ANDROID_COMPILER_FLAGS_RELWITHDEBINFO} ${CMAKE_ASM_FLAGS_RELWITHDEBINFO}") From bb73ee8a8558e7235f8bcb6080c0f59b3fc4b650 Mon Sep 17 00:00:00 2001 From: Juan Ignacio Ubeira Date: Fri, 11 Jan 2019 12:43:24 -0300 Subject: [PATCH 15/29] Fixing default workdir and command in dockerfile. --- docker/Dockerfile | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/docker/Dockerfile b/docker/Dockerfile index edec293..914041e 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -40,3 +40,7 @@ ENV PATH /usr/lib/ccache:$PATH # Clear entrypoint (do not source /opt/ros/kinetic) ENTRYPOINT [] + +VOLUME /opt/ros_android +WORKDIR /opt/ros_android +CMD ['bash'] From 0604ee523e790a367fd79c2c78dca552b5c1015a Mon Sep 17 00:00:00 2001 From: Johannes Meyer Date: Wed, 16 Jan 2019 19:38:31 +0100 Subject: [PATCH 16/29] docker/run.sh: apply extra arguments to docker run instead of bash This is needed to mount extra directories from the host, e.g. for the `do_everything.sh --extends-workspace` feature. --- docker/.dockerignore | 5 +++++ docker/run.sh | 9 ++------- 2 files changed, 7 insertions(+), 7 deletions(-) create mode 100644 docker/.dockerignore diff --git a/docker/.dockerignore b/docker/.dockerignore new file mode 100644 index 0000000..adc6666 --- /dev/null +++ b/docker/.dockerignore @@ -0,0 +1,5 @@ +build.sh +Dockerfile +.dockerignore +README.md +run.sh diff --git a/docker/run.sh b/docker/run.sh index 4008f43..9ebd4b0 100755 --- a/docker/run.sh +++ b/docker/run.sh @@ -4,14 +4,9 @@ SCRIPTPATH="$( cd "$(dirname "$0")" ; pwd -P )" REPO_ROOT=$SCRIPTPATH/../ IMAGE=android_ndk -if [ "$#" == 0 ]; then - EXTRA_ARGS="bash" -else - EXTRA_ARGS="bash -c \"$@\"" -fi - docker run \ -v ${REPO_ROOT}:/opt/ros_android \ --privileged \ -it \ - ${IMAGE} "${EXTRA_ARGS}" + "$@" \ + ${IMAGE} bash From b7dcd194291d31577f7571d282493d2473eab708 Mon Sep 17 00:00:00 2001 From: Johannes Meyer Date: Wed, 16 Jan 2019 19:31:50 +0100 Subject: [PATCH 17/29] pluginlib_helper: also include implicit (indirect) dependencies Some plugins from a custom workspace were missing. Packages providing plugins only need to depend on the package that provides the base class, but not necessarily on pluginlib directly. --- files/pluginlib_helper/plugin_collect.py | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/files/pluginlib_helper/plugin_collect.py b/files/pluginlib_helper/plugin_collect.py index 5efa424..9bc29c2 100644 --- a/files/pluginlib_helper/plugin_collect.py +++ b/files/pluginlib_helper/plugin_collect.py @@ -45,13 +45,8 @@ def collect_plugins(root_scan_dir): #print packages debug_print() - # Find all packages that depend on pluginlib and nodelet explicitely - pluginlib_users = rp.get_depends_on('pluginlib', implicit=False) - nodelet_users = rp.get_depends_on('nodelet', implicit=False) - image_transport_users = rp.get_depends_on('image_transport', implicit=False) - # Concatenate both lists removing the duplicates - pluginlib_users += list(set(nodelet_users) - set(pluginlib_users)) - pluginlib_users += list(set(image_transport_users) - set(pluginlib_users)) + # Find all packages that depend on pluginlib and nodelet explicitly or implicitly + pluginlib_users = set(rp.get_depends_on('pluginlib', implicit=True)) debug_print("Packages that depend on pluginlib:\n") debug_print(pluginlib_users) From a121628ca059bee3f107263ec20989d0ce081c71 Mon Sep 17 00:00:00 2001 From: Johannes Meyer Date: Wed, 16 Jan 2019 21:39:01 +0100 Subject: [PATCH 18/29] ros.rosinstall: uncomment many Python packages because other packages depend on them This commit reverts most of the changes in https://github.com/Intermodalics/ros_android/pull/63. --- ros.rosinstall | 158 +++++++++++++++++++++---------------------------- 1 file changed, 68 insertions(+), 90 deletions(-) diff --git a/ros.rosinstall b/ros.rosinstall index 7d5e6a5..91677db 100644 --- a/ros.rosinstall +++ b/ros.rosinstall @@ -22,11 +22,10 @@ local-name: bond_core/bondcpp uri: https://github.com/ros-gbp/bond_core-release/archive/release/kinetic/bondcpp/1.8.3-0.tar.gz version: bond_core-release-release-kinetic-bondcpp-1.8.3-0 -# Python based package, not needed -# - tar: -# local-name: bond_core/bondpy -# uri: https://github.com/ros-gbp/bond_core-release/archive/release/kinetic/bondpy/1.8.3-0.tar.gz -# version: bond_core-release-release-kinetic-bondpy-1.8.3-0 +- tar: + local-name: bond_core/bondpy + uri: https://github.com/ros-gbp/bond_core-release/archive/release/kinetic/bondpy/1.8.3-0.tar.gz + version: bond_core-release-release-kinetic-bondpy-1.8.3-0 - tar: local-name: bond_core/smclib uri: https://github.com/ros-gbp/bond_core-release/archive/release/kinetic/smclib/1.8.3-0.tar.gz @@ -216,11 +215,10 @@ local-name: geometry2/tf2_msgs uri: https://github.com/ros-gbp/geometry2-release/archive/release/kinetic/tf2_msgs/0.5.18-0.tar.gz version: geometry2-release-release-kinetic-tf2_msgs-0.5.18-0 -# Python based package, not needed -# - tar: -# local-name: geometry2/tf2_py -# uri: https://github.com/ros-gbp/geometry2-release/archive/release/kinetic/tf2_py/0.5.18-0.tar.gz -# version: geometry2-release-release-kinetic-tf2_py-0.5.18-0 +- tar: + local-name: geometry2/tf2_py + uri: https://github.com/ros-gbp/geometry2-release/archive/release/kinetic/tf2_py/0.5.18-0.tar.gz + version: geometry2-release-release-kinetic-tf2_py-0.5.18-0 - tar: local-name: geometry2/tf2_ros uri: https://github.com/ros-gbp/geometry2-release/archive/release/kinetic/tf2_ros/0.5.18-0.tar.gz @@ -450,11 +448,10 @@ local-name: orocos_kinematics_dynamics/orocos_kdl uri: https://github.com/smits/orocos-kdl-release/archive/release/kinetic/orocos_kdl/1.3.1-0.tar.gz version: orocos-kdl-release-release-kinetic-orocos_kdl-1.3.1-0 -# Python based package, not needed -# - tar: -# local-name: orocos_kinematics_dynamics/python_orocos_kdl -# uri: https://github.com/smits/orocos-kdl-release/archive/release/kinetic/python_orocos_kdl/1.3.1-0.tar.gz -# version: orocos-kdl-release-release-kinetic-python_orocos_kdl-1.3.1-0 +- tar: + local-name: orocos_kinematics_dynamics/python_orocos_kdl + uri: https://github.com/smits/orocos-kdl-release/archive/release/kinetic/python_orocos_kdl/1.3.1-0.tar.gz + version: orocos-kdl-release-release-kinetic-python_orocos_kdl-1.3.1-0 - tar: local-name: pcl_conversions uri: https://github.com/ros-gbp/pcl_conversions-release/archive/release/kinetic/pcl_conversions/0.2.1-0.tar.gz @@ -475,11 +472,10 @@ local-name: pluginlib uri: https://github.com/ros-gbp/pluginlib-release/archive/release/kinetic/pluginlib/1.11.3-0.tar.gz version: pluginlib-release-release-kinetic-pluginlib-1.11.3-0 -# Python based package, not needed -# - tar: -# local-name: python_qt_binding -# uri: https://github.com/ros-gbp/python_qt_binding-release/archive/release/kinetic/python_qt_binding/0.3.4-0.tar.gz -# version: python_qt_binding-release-release-kinetic-python_qt_binding-0.3.4-0 +- tar: + local-name: python_qt_binding + uri: https://github.com/ros-gbp/python_qt_binding-release/archive/release/kinetic/python_qt_binding/0.3.4-0.tar.gz + version: python_qt_binding-release-release-kinetic-python_qt_binding-0.3.4-0 - tar: local-name: random_numbers uri: https://github.com/ros-gbp/random_numbers-release/archive/release/kinetic/random_numbers/0.3.1-0.tar.gz @@ -506,26 +502,23 @@ # local-name: ros/ros # uri: https://github.com/ros-gbp/ros-release/archive/release/kinetic/ros/1.14.4-0.tar.gz # version: ros-release-release-kinetic-ros-1.14.4-0 -# Only bash scripts, not needed. -# - tar: -# local-name: ros/rosbash -# uri: https://github.com/ros-gbp/ros-release/archive/release/kinetic/rosbash/1.14.4-0.tar.gz -# version: ros-release-release-kinetic-rosbash-1.14.4-0 +- tar: + local-name: ros/rosbash + uri: https://github.com/ros-gbp/ros-release/archive/release/kinetic/rosbash/1.14.4-0.tar.gz + version: ros-release-release-kinetic-rosbash-1.14.4-0 # Scripts only, not needed. # - tar: # local-name: ros/rosboost_cfg # uri: https://github.com/ros-gbp/ros-release/archive/release/kinetic/rosboost_cfg/1.14.4-0.tar.gz # version: ros-release-release-kinetic-rosboost_cfg-1.14.4-0 -# Scripts only, not needed. -# - tar: -# local-name: ros/rosbuild -# uri: https://github.com/ros-gbp/ros-release/archive/release/kinetic/rosbuild/1.14.4-0.tar.gz -# version: ros-release-release-kinetic-rosbuild-1.14.4-0 -# Scripts only, not needed. -# - tar: -# local-name: ros/rosclean -# uri: https://github.com/ros-gbp/ros-release/archive/release/kinetic/rosclean/1.14.4-0.tar.gz -# version: ros-release-release-kinetic-rosclean-1.14.4-0 +- tar: + local-name: ros/rosbuild + uri: https://github.com/ros-gbp/ros-release/archive/release/kinetic/rosbuild/1.14.4-0.tar.gz + version: ros-release-release-kinetic-rosbuild-1.14.4-0 +- tar: + local-name: ros/rosclean + uri: https://github.com/ros-gbp/ros-release/archive/release/kinetic/rosclean/1.14.4-0.tar.gz + version: ros-release-release-kinetic-rosclean-1.14.4-0 # Scripts only, not needed. # - tar: # local-name: ros/roscreate @@ -574,70 +567,58 @@ local-name: ros_comm/roscpp uri: https://github.com/ros-gbp/ros_comm-release/archive/release/kinetic/roscpp/1.12.14-0.tar.gz version: ros_comm-release-release-kinetic-roscpp-1.12.14-0 -# Scripts only, needed by tf2_ros. - tar: local-name: ros_comm/rosgraph uri: https://github.com/ros-gbp/ros_comm-release/archive/release/kinetic/rosgraph/1.12.14-0.tar.gz version: ros_comm-release-release-kinetic-rosgraph-1.12.14-0 -# Scripts only, not needed. -# - tar: -# local-name: ros_comm/roslaunch -# uri: https://github.com/ros-gbp/ros_comm-release/archive/release/kinetic/roslaunch/1.12.14-0.tar.gz -# version: ros_comm-release-release-kinetic-roslaunch-1.12.14-0 +- tar: + local-name: ros_comm/roslaunch + uri: https://github.com/ros-gbp/ros_comm-release/archive/release/kinetic/roslaunch/1.12.14-0.tar.gz + version: ros_comm-release-release-kinetic-roslaunch-1.12.14-0 - tar: local-name: ros_comm/roslz4 uri: https://github.com/ros-gbp/ros_comm-release/archive/release/kinetic/roslz4/1.12.14-0.tar.gz version: ros_comm-release-release-kinetic-roslz4-1.12.14-0 -# Scripts only, not needed. -# - tar: -# local-name: ros_comm/rosmaster -# uri: https://github.com/ros-gbp/ros_comm-release/archive/release/kinetic/rosmaster/1.12.14-0.tar.gz -# version: ros_comm-release-release-kinetic-rosmaster-1.12.14-0 -# Scripts only, not needed. -# - tar: -# local-name: ros_comm/rosmsg -# uri: https://github.com/ros-gbp/ros_comm-release/archive/release/kinetic/rosmsg/1.12.14-0.tar.gz -# version: ros_comm-release-release-kinetic-rosmsg-1.12.14-0 -# Scripts only, not needed. -# - tar: -# local-name: ros_comm/rosnode -# uri: https://github.com/ros-gbp/ros_comm-release/archive/release/kinetic/rosnode/1.12.14-0.tar.gz -# version: ros_comm-release-release-kinetic-rosnode-1.12.14-0 -# Scripts only, not needed. -# - tar: -# local-name: ros_comm/rosout -# uri: https://github.com/ros-gbp/ros_comm-release/archive/release/kinetic/rosout/1.12.14-0.tar.gz -# version: ros_comm-release-release-kinetic-rosout-1.12.14-0 -# Scripts only, not needed. -# - tar: -# local-name: ros_comm/rosparam -# uri: https://github.com/ros-gbp/ros_comm-release/archive/release/kinetic/rosparam/1.12.14-0.tar.gz -# version: ros_comm-release-release-kinetic-rosparam-1.12.14-0 -# Python package, but needed by diagnostics. +- tar: + local-name: ros_comm/rosmaster + uri: https://github.com/ros-gbp/ros_comm-release/archive/release/kinetic/rosmaster/1.12.14-0.tar.gz + version: ros_comm-release-release-kinetic-rosmaster-1.12.14-0 +- tar: + local-name: ros_comm/rosmsg + uri: https://github.com/ros-gbp/ros_comm-release/archive/release/kinetic/rosmsg/1.12.14-0.tar.gz + version: ros_comm-release-release-kinetic-rosmsg-1.12.14-0 +- tar: + local-name: ros_comm/rosnode + uri: https://github.com/ros-gbp/ros_comm-release/archive/release/kinetic/rosnode/1.12.14-0.tar.gz + version: ros_comm-release-release-kinetic-rosnode-1.12.14-0 +- tar: + local-name: ros_comm/rosout + uri: https://github.com/ros-gbp/ros_comm-release/archive/release/kinetic/rosout/1.12.14-0.tar.gz + version: ros_comm-release-release-kinetic-rosout-1.12.14-0 +- tar: + local-name: ros_comm/rosparam + uri: https://github.com/ros-gbp/ros_comm-release/archive/release/kinetic/rosparam/1.12.14-0.tar.gz + version: ros_comm-release-release-kinetic-rosparam-1.12.14-0 - tar: local-name: ros_comm/rospy uri: https://github.com/ros-gbp/ros_comm-release/archive/release/kinetic/rospy/1.12.14-0.tar.gz version: ros_comm-release-release-kinetic-rospy-1.12.14-0 -# Scripts only, not needed. -# - tar: -# local-name: ros_comm/rosservice -# uri: https://github.com/ros-gbp/ros_comm-release/archive/release/kinetic/rosservice/1.12.14-0.tar.gz -# version: ros_comm-release-release-kinetic-rosservice-1.12.14-0 -# Scripts only, but needed by self_test. +- tar: + local-name: ros_comm/rosservice + uri: https://github.com/ros-gbp/ros_comm-release/archive/release/kinetic/rosservice/1.12.14-0.tar.gz + version: ros_comm-release-release-kinetic-rosservice-1.12.14-0 - tar: local-name: ros_comm/rostest uri: https://github.com/ros-gbp/ros_comm-release/archive/release/kinetic/rostest/1.12.14-0.tar.gz version: ros_comm-release-release-kinetic-rostest-1.12.14-0 -# Scripts only, not needed. -# - tar: -# local-name: ros_comm/rostopic -# uri: https://github.com/ros-gbp/ros_comm-release/archive/release/kinetic/rostopic/1.12.14-0.tar.gz -# version: ros_comm-release-release-kinetic-rostopic-1.12.14-0 -# Scripts only, not needed. -# - tar: -# local-name: ros_comm/roswtf -# uri: https://github.com/ros-gbp/ros_comm-release/archive/release/kinetic/roswtf/1.12.14-0.tar.gz -# version: ros_comm-release-release-kinetic-roswtf-1.12.14-0 +- tar: + local-name: ros_comm/rostopic + uri: https://github.com/ros-gbp/ros_comm-release/archive/release/kinetic/rostopic/1.12.14-0.tar.gz + version: ros_comm-release-release-kinetic-rostopic-1.12.14-0 +- tar: + local-name: ros_comm/roswtf + uri: https://github.com/ros-gbp/ros_comm-release/archive/release/kinetic/roswtf/1.12.14-0.tar.gz + version: ros_comm-release-release-kinetic-roswtf-1.12.14-0 - tar: local-name: ros_comm/topic_tools uri: https://github.com/ros-gbp/ros_comm-release/archive/release/kinetic/topic_tools/1.12.14-0.tar.gz @@ -690,12 +671,11 @@ local-name: roslint uri: https://github.com/ros-gbp/roslint-release/archive/release/kinetic/roslint/0.11.0-0.tar.gz version: roslint-release-release-kinetic-roslint-0.11.0-0 -# Scripts only, not needed. +# Roslisp is a client library for writing ROS nodes in idiomatic Common Lisp. -> not needed # - tar: # local-name: roslisp # uri: https://github.com/ros-gbp/roslisp-release/archive/release/kinetic/roslisp/1.9.21-0.tar.gz # version: roslisp-release-release-kinetic-roslisp-1.9.21-0 -# Needed by roslib. - tar: local-name: rospack uri: https://github.com/ros-gbp/rospack-release/archive/release/kinetic/rospack/2.4.4-0.tar.gz @@ -724,8 +704,6 @@ local-name: vision_opencv/vision_opencv uri: https://github.com/ros-gbp/vision_opencv-release/archive/release/kinetic/vision_opencv/1.12.8-0.tar.gz version: vision_opencv-release-release-kinetic-vision_opencv-1.12.8-0 -# Python based package, not needed. -# - tar: -# local-name: xacro -# uri: https://github.com/ros-gbp/xacro-release/archive/release/kinetic/xacro/1.11.3-0.tar.gz -# version: xacro-release-release-kinetic-xacro-1.11.3-0 + local-name: xacro + uri: https://github.com/ros-gbp/xacro-release/archive/release/kinetic/xacro/1.11.3-0.tar.gz + version: xacro-release-release-kinetic-xacro-1.11.3-0 From 5186239f64162f1c04f0aba420fd6054d962cdb3 Mon Sep 17 00:00:00 2001 From: Johannes Meyer Date: Thu, 17 Jan 2019 00:37:03 +0100 Subject: [PATCH 19/29] docker: fix CMD syntax that requires double quotes --- docker/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/Dockerfile b/docker/Dockerfile index 914041e..7a9e169 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -43,4 +43,4 @@ ENTRYPOINT [] VOLUME /opt/ros_android WORKDIR /opt/ros_android -CMD ['bash'] +CMD ["bash"] From 684bdc860456b632e7288e2ccd8970950f237b6c Mon Sep 17 00:00:00 2001 From: Johannes Meyer Date: Thu, 17 Jan 2019 00:55:10 +0100 Subject: [PATCH 20/29] docker: split command line at double dash and forward remainings arguments to docker run as a command --- docker/build.sh | 2 +- docker/run.sh | 29 +++++++++++++++++++++++++++-- 2 files changed, 28 insertions(+), 3 deletions(-) diff --git a/docker/build.sh b/docker/build.sh index 3f49a46..352adf6 100755 --- a/docker/build.sh +++ b/docker/build.sh @@ -3,5 +3,5 @@ IMAGE=android_ndk pushd "$( dirname "${BASH_SOURCE[0]}" )" -docker build -t ${IMAGE} . +docker build -t ${IMAGE} "$@" . popd diff --git a/docker/run.sh b/docker/run.sh index 9ebd4b0..3badb25 100755 --- a/docker/run.sh +++ b/docker/run.sh @@ -4,9 +4,34 @@ SCRIPTPATH="$( cd "$(dirname "$0")" ; pwd -P )" REPO_ROOT=$SCRIPTPATH/../ IMAGE=android_ndk +DOCKEROPTS=() +while [ $# -gt 0 ]; do + case "$1" in + --help) + # print usage + echo "Usage: $0 [DOCKER OPTIONS] [-- [COMMAND]]" + echo + echo "Docker options:" + docker run --help | tail -n +7 + exit 0 + ;; + --) + # end-of-options: all arguments after the -- will be interpreted as a command to run inside the container. + shift + break + ;; + *) + # collect docker options + DOCKEROPTS+=("$1") + shift + ;; + esac +done + +set -x docker run \ -v ${REPO_ROOT}:/opt/ros_android \ --privileged \ -it \ - "$@" \ - ${IMAGE} bash + "${DOCKEROPTS[@]}" \ + ${IMAGE} "$@" From b4f3e1d5c757cafb49c62d06dd8e2e00e6f3b40d Mon Sep 17 00:00:00 2001 From: Juan Ignacio Ubeira Date: Thu, 17 Jan 2019 11:56:42 -0300 Subject: [PATCH 21/29] Ignoring packages that are required by pluginlib support build, but are unneeded python deps. --- do_everything.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/do_everything.sh b/do_everything.sh index 253f919..80964bc 100755 --- a/do_everything.sh +++ b/do_everything.sh @@ -137,6 +137,9 @@ if [ $? -ne 0 ]; then echo -e "\n"$line >> $prefix/catkin_ws/src/pluginlib/CMakeLists.txt echo 'install(TARGETS pluginlib RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION} ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION} LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION})' >> $prefix/catkin_ws/src/pluginlib/CMakeLists.txt fi +# Ignore packages that are just needed to build pluginlib support, but are just python packages with C bindings that won't build. +touch $prefix/catkin_ws/src/geometry2/tf2_py/CATKIN_IGNORE +touch $prefix/catkin_ws/src/orocos_kinematics_dynamics/python_orocos_kdl/CATKIN_IGNORE # turn error detection back on set -e From 0a1f0921ed4be1453f08a97525380560fd3f8855 Mon Sep 17 00:00:00 2001 From: Juan Ignacio Ubeira Date: Thu, 17 Jan 2019 16:21:54 -0300 Subject: [PATCH 22/29] Revert "Ignoring packages that are required by pluginlib support build, but are unneeded python deps." This reverts commit b4f3e1d5c757cafb49c62d06dd8e2e00e6f3b40d. --- do_everything.sh | 3 --- 1 file changed, 3 deletions(-) diff --git a/do_everything.sh b/do_everything.sh index 80964bc..253f919 100755 --- a/do_everything.sh +++ b/do_everything.sh @@ -137,9 +137,6 @@ if [ $? -ne 0 ]; then echo -e "\n"$line >> $prefix/catkin_ws/src/pluginlib/CMakeLists.txt echo 'install(TARGETS pluginlib RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION} ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION} LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION})' >> $prefix/catkin_ws/src/pluginlib/CMakeLists.txt fi -# Ignore packages that are just needed to build pluginlib support, but are just python packages with C bindings that won't build. -touch $prefix/catkin_ws/src/geometry2/tf2_py/CATKIN_IGNORE -touch $prefix/catkin_ws/src/orocos_kinematics_dynamics/python_orocos_kdl/CATKIN_IGNORE # turn error detection back on set -e From 1ed3b4a58b78e8e76d4d1e8e241051e69d7641ca Mon Sep 17 00:00:00 2001 From: Juan Ignacio Ubeira Date: Thu, 17 Jan 2019 16:22:08 -0300 Subject: [PATCH 23/29] Patches for python_orocos_kdl and tf2_py: don't do anything but install the dummy package.xml file. --- patches/python_orocos_kdl.patch | 20 ++++++++++++++++++++ patches/tf2_py.patch | 18 ++++++++++++++++++ 2 files changed, 38 insertions(+) create mode 100644 patches/python_orocos_kdl.patch create mode 100644 patches/tf2_py.patch diff --git a/patches/python_orocos_kdl.patch b/patches/python_orocos_kdl.patch new file mode 100644 index 0000000..1b7ef1b --- /dev/null +++ b/patches/python_orocos_kdl.patch @@ -0,0 +1,20 @@ +--- catkin_ws/src/orocos_kinematics_dynamics/python_orocos_kdl/CMakeLists.txt ++++ catkin_ws/src/orocos_kinematics_dynamics/python_orocos_kdl/CMakeLists.txt +@@ -1,7 +1,7 @@ + cmake_minimum_required(VERSION 2.4.6) + + project(python_orocos_kdl) +- ++if(NOT ANDROID) + find_package(orocos_kdl) + include_directories(${orocos_kdl_INCLUDE_DIRS}) + link_directories(${orocos_kdl_LIBRARY_DIRS}) +@@ -20,5 +20,5 @@ set(SIP_INCLUDES ${SIP_FILES}) + set(SIP_EXTRA_OPTIONS "-o") + set(PYTHON_SITE_PACKAGES_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/${PYTHON_SITE_PACKAGES}) + add_sip_python_module(PyKDL PyKDL/PyKDL.sip ${orocos_kdl_LIBRARIES}) +- +-install(FILES package.xml DESTINATION share/python_orocos_kdl) +\ No newline at end of file ++endif() ++install(FILES package.xml DESTINATION share/python_orocos_kdl) diff --git a/patches/tf2_py.patch b/patches/tf2_py.patch new file mode 100644 index 0000000..d75f3f2 --- /dev/null +++ b/patches/tf2_py.patch @@ -0,0 +1,18 @@ +--- catkin_ws/src/geometry2/tf2_py/CMakeLists.txt ++++ catkin_ws/src/geometry2/tf2_py/CMakeLists.txt +@@ -1,6 +1,7 @@ + cmake_minimum_required(VERSION 2.8.3) + project(tf2_py) + ++if(NOT ANDROID) + ## Find catkin macros and libraries + ## if COMPONENTS list like find_package(catkin REQUIRED COMPONENTS xyz) + ## is used, also find other catkin packages +@@ -155,3 +156,7 @@ install(FILES ${CATKIN_DEVEL_PREFIX}/${CATKIN_PACKAGE_PYTHON_DESTINATION}/_tf2.s + + ## Add folders to be run by python nosetests + # catkin_add_nosetests(test) ++ ++else() ++install(FILES package.xml DESTINATION share/tf2_py) # Dummy install ++endif() From a29243735915479b611350307f1ed7658c02e877 Mon Sep 17 00:00:00 2001 From: Juan Ignacio Ubeira Date: Fri, 18 Jan 2019 17:26:09 -0300 Subject: [PATCH 24/29] Adjusting patches for tf2_py and python_orocos_kdl. --- patches/python_orocos_kdl.patch | 23 ++++++++++------------- patches/tf2_py.patch | 18 ++++++++---------- 2 files changed, 18 insertions(+), 23 deletions(-) diff --git a/patches/python_orocos_kdl.patch b/patches/python_orocos_kdl.patch index 1b7ef1b..75a2e20 100644 --- a/patches/python_orocos_kdl.patch +++ b/patches/python_orocos_kdl.patch @@ -1,20 +1,17 @@ --- catkin_ws/src/orocos_kinematics_dynamics/python_orocos_kdl/CMakeLists.txt +++ catkin_ws/src/orocos_kinematics_dynamics/python_orocos_kdl/CMakeLists.txt -@@ -1,7 +1,7 @@ - cmake_minimum_required(VERSION 2.4.6) +@@ -2,6 +2,13 @@ cmake_minimum_required(VERSION 2.4.6) project(python_orocos_kdl) -- -+if(NOT ANDROID) + ++# Skip package if building for Android ++if(ANDROID) ++ find_package(catkin REQUIRED) ++ catkin_package() ++ return() ++endif() ++ find_package(orocos_kdl) include_directories(${orocos_kdl_INCLUDE_DIRS}) link_directories(${orocos_kdl_LIBRARY_DIRS}) -@@ -20,5 +20,5 @@ set(SIP_INCLUDES ${SIP_FILES}) - set(SIP_EXTRA_OPTIONS "-o") - set(PYTHON_SITE_PACKAGES_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/${PYTHON_SITE_PACKAGES}) - add_sip_python_module(PyKDL PyKDL/PyKDL.sip ${orocos_kdl_LIBRARIES}) -- --install(FILES package.xml DESTINATION share/python_orocos_kdl) -\ No newline at end of file -+endif() -+install(FILES package.xml DESTINATION share/python_orocos_kdl) + diff --git a/patches/tf2_py.patch b/patches/tf2_py.patch index d75f3f2..57b3ea2 100644 --- a/patches/tf2_py.patch +++ b/patches/tf2_py.patch @@ -1,18 +1,16 @@ --- catkin_ws/src/geometry2/tf2_py/CMakeLists.txt +++ catkin_ws/src/geometry2/tf2_py/CMakeLists.txt -@@ -1,6 +1,7 @@ +@@ -1,6 +1,13 @@ cmake_minimum_required(VERSION 2.8.3) project(tf2_py) -+if(NOT ANDROID) ++# Skip package if building for Android ++if(ANDROID) ++ find_package(catkin REQUIRED) ++ catkin_package() ++ return() ++endif() ++ ## Find catkin macros and libraries ## if COMPONENTS list like find_package(catkin REQUIRED COMPONENTS xyz) ## is used, also find other catkin packages -@@ -155,3 +156,7 @@ install(FILES ${CATKIN_DEVEL_PREFIX}/${CATKIN_PACKAGE_PYTHON_DESTINATION}/_tf2.s - - ## Add folders to be run by python nosetests - # catkin_add_nosetests(test) -+ -+else() -+install(FILES package.xml DESTINATION share/tf2_py) # Dummy install -+endif() From 96aea07e3caa249df9c8f975428eea1b7c415ec3 Mon Sep 17 00:00:00 2001 From: Juan Ignacio Ubeira Date: Fri, 18 Jan 2019 17:26:29 -0300 Subject: [PATCH 25/29] Fixing issue with rosinstall file for tf2. --- ros.rosinstall | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ros.rosinstall b/ros.rosinstall index 91677db..7c9d7dd 100644 --- a/ros.rosinstall +++ b/ros.rosinstall @@ -198,7 +198,7 @@ - tar: local-name: geometry2/tf2 uri: https://github.com/ros-gbp/geometry2-release/archive/release/kinetic/tf2/0.5.18-0.tar.gz - version: geometry2-release-release-kinetic-tf2-0.5.18-0 + version: geometry2-release-release-kinetic-tf2 - tar: local-name: geometry2/tf2_eigen uri: https://github.com/ros-gbp/geometry2-release/archive/release/kinetic/tf2_eigen/0.5.18-0.tar.gz From 000fb17457dc2617c73978d27d49996ef4bda390 Mon Sep 17 00:00:00 2001 From: Juan Ignacio Ubeira Date: Fri, 18 Jan 2019 18:24:20 -0300 Subject: [PATCH 26/29] Adding catkin as buildtool for python_orocos_kdl. --- patches/python_orocos_kdl.patch | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/patches/python_orocos_kdl.patch b/patches/python_orocos_kdl.patch index 75a2e20..4ec9862 100644 --- a/patches/python_orocos_kdl.patch +++ b/patches/python_orocos_kdl.patch @@ -15,3 +15,13 @@ include_directories(${orocos_kdl_INCLUDE_DIRS}) link_directories(${orocos_kdl_LIBRARY_DIRS}) +--- catkin_ws/src/orocos_kinematics_dynamics/python_orocos_kdl/package.xml ++++ catkin_ws/src/orocos_kinematics_dynamics/python_orocos_kdl/package.xml +@@ -10,6 +10,7 @@ + LGPL + + cmake ++ catkin + + orocos_kdl + python-sip From 61f965ba035adf37ca945498cc4124ec79cf9e92 Mon Sep 17 00:00:00 2001 From: Johannes Meyer Date: Tue, 22 Jan 2019 15:25:26 +0100 Subject: [PATCH 27/29] patches: fixed linking to SDL library in map_server --- patches/map_server.patch | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/patches/map_server.patch b/patches/map_server.patch index 5fd5b7b..beb6370 100644 --- a/patches/map_server.patch +++ b/patches/map_server.patch @@ -1,6 +1,6 @@ --- catkin_ws/src/navigation/map_server/CMakeLists.txt +++ catkin_ws/src/navigation/map_server/CMakeLists.txt -@@ -12,10 +12,17 @@ find_package(Bullet REQUIRED) +@@ -12,17 +12,31 @@ find_package(Bullet REQUIRED) find_package(SDL REQUIRED) find_package(SDL_image REQUIRED) @@ -21,19 +21,21 @@ endif() catkin_package( -@@ -23,6 +30,11 @@ catkin_package( + INCLUDE_DIRS include ++ ${SDL_INCLUDE_DIR} LIBRARIES map_server_image_loader ++ ${SDL_LIBRARY} + DEPENDS + BULLET -+ SDL ++ #SDL # <-- Does not work because SDL_INCLUDE_DIRS and SDL_LIBRARIES is not set. + SDL_IMAGE + YAML_CPP CATKIN_DEPENDS roscpp nav_msgs -@@ -35,7 +47,7 @@ include_directories( +@@ -35,7 +49,7 @@ include_directories( ${catkin_INCLUDE_DIRS} ${SDL_INCLUDE_DIR} ${SDL_IMAGE_INCLUDE_DIRS} @@ -42,7 +44,7 @@ ) add_library(map_server_image_loader src/image_loader.cpp) -@@ -51,7 +63,7 @@ add_executable(map_server src/main.cpp) +@@ -51,7 +65,7 @@ add_executable(map_server src/main.cpp) add_dependencies(map_server ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS}) target_link_libraries(map_server map_server_image_loader From 7c809a11416b531be070b231bdda63c6b68a832a Mon Sep 17 00:00:00 2001 From: Johannes Meyer Date: Tue, 22 Jan 2019 16:05:48 +0100 Subject: [PATCH 28/29] ros.rosinstall: fixed yaml syntax error (introduced in a121628ca059bee3f107263ec20989d0ce081c71) --- ros.rosinstall | 1 + 1 file changed, 1 insertion(+) diff --git a/ros.rosinstall b/ros.rosinstall index 7c9d7dd..5fd45f9 100644 --- a/ros.rosinstall +++ b/ros.rosinstall @@ -704,6 +704,7 @@ local-name: vision_opencv/vision_opencv uri: https://github.com/ros-gbp/vision_opencv-release/archive/release/kinetic/vision_opencv/1.12.8-0.tar.gz version: vision_opencv-release-release-kinetic-vision_opencv-1.12.8-0 +- tar: local-name: xacro uri: https://github.com/ros-gbp/xacro-release/archive/release/kinetic/xacro/1.11.3-0.tar.gz version: xacro-release-release-kinetic-xacro-1.11.3-0 From 7714039fd1978b8e3116a95e99f209dfcdbb5c85 Mon Sep 17 00:00:00 2001 From: Ivan Paunovic Date: Wed, 23 Jan 2019 17:54:28 -0300 Subject: [PATCH 29/29] Basic app to connect to ros master --- build_example_workspace.sh | 37 ---- do_everything.sh | 8 +- .../app/{src/main/cpp => }/CMakeLists.txt | 22 +-- .../hello_world_example_app/app/build.gradle | 4 +- .../app/include/ros_android/main_thread.h | 40 +++++ .../app/src/main/AndroidManifest.xml | 14 +- .../app/src/main/cpp/main.cpp | 120 +++++-------- .../app/src/main/cpp/main_thread.cpp | 34 ++++ .../ros/example/hello_ros/MainActivity.java | 159 ++++++++++++++++++ ...ample_hello_ros_MainActivity_RosThread.cpp | 24 +++ ...example_hello_ros_MainActivity_RosThread.h | 45 +++++ .../app/src/main/res/layout/logging.xml | 34 ++++ .../app/src/main/res/values/strings.xml | 11 +- 13 files changed, 406 insertions(+), 146 deletions(-) delete mode 100755 build_example_workspace.sh rename example_workspace/src/hello_world_example_app/app/{src/main/cpp => }/CMakeLists.txt (63%) create mode 100644 example_workspace/src/hello_world_example_app/app/include/ros_android/main_thread.h create mode 100644 example_workspace/src/hello_world_example_app/app/src/main/cpp/main_thread.cpp create mode 100644 example_workspace/src/hello_world_example_app/app/src/main/java/com/ros/example/hello_ros/MainActivity.java create mode 100644 example_workspace/src/hello_world_example_app/app/src/main/jni/com_ros_example_hello_ros_MainActivity_RosThread.cpp create mode 100644 example_workspace/src/hello_world_example_app/app/src/main/jni/com_ros_example_hello_ros_MainActivity_RosThread.h create mode 100644 example_workspace/src/hello_world_example_app/app/src/main/res/layout/logging.xml diff --git a/build_example_workspace.sh b/build_example_workspace.sh deleted file mode 100755 index e3f37dd..0000000 --- a/build_example_workspace.sh +++ /dev/null @@ -1,37 +0,0 @@ - -CMAKE_BUILD_TYPE=Release -VERBOSE="" -ANDROID_ABI=arm64-v8a -ANDROID_STL=c++_shared # or c++_static, see https://developer.android.com/ndk/guides/cpp-support -ANDROID_PLATFORM=android-24 -RBA_TOOLCHAIN=$ANDROID_NDK_HOME/build/cmake/android.toolchain.cmake - -python=$(which python) -python_lib=/usr/lib/x86_64-linux-gnu/libpython2.7.so -python_inc=/usr/include/python2.7 -python2_inc=/usr/include/x86_64-linux-gnu/python2.7 -prefix=$(cd output && pwd) -TARGET=$prefix/target -export ROS_PARALLEL_JOBS="-j$PARALLEL_JOBS -l$PARALLEL_JOBS" - -cd example_workspace - -catkin config \ - --no-extend \ - --install-space $TARGET \ - --install \ - --isolate-devel \ - --cmake-args \ - -DCMAKE_TOOLCHAIN_FILE=$RBA_TOOLCHAIN \ - -DUSE_CATKIN=ON -DCMAKE_TOOLCHAIN_FILE=$RBA_TOOLCHAIN \ - -DANDROID_ABI=${ANDROID_ABI} -DANDROID_PLATFORM=${ANDROID_PLATFORM} -DANDROID_STL=${ANDROID_STL} \ - -DPYTHON_EXECUTABLE=$python -DPYTHON_LIBRARY=$python_lib \ - -DPYTHON_INCLUDE_DIR=$python_inc -DPYTHON_INCLUDE_DIR2=$python2_inc \ - -DBUILD_SHARED_LIBS=0 -DCMAKE_INSTALL_PREFIX=$TARGET \ - -DBoost_NO_BOOST_CMAKE=ON -DBOOST_ROOT=$TARGET -DANDROID=TRUE \ - -DBOOST_INCLUDEDIR=$TARGET/include/boost -DBOOST_LIBRARYDIR=$TARGET/lib \ - -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} \ - -DCMAKE_FIND_ROOT_PATH=$prefix -DTARGET=$TARGET \ - -DBUILD_TESTING=OFF -DCATKIN_ENABLE_TESTING=OFF - -catkin build \ No newline at end of file diff --git a/do_everything.sh b/do_everything.sh index 72cbc36..f5c5c9b 100755 --- a/do_everything.sh +++ b/do_everything.sh @@ -182,10 +182,10 @@ echo if [[ $debugging -eq 1 ]];then echo "Build type = DEBUG" - run_cmd build_cpp -w $prefix/catkin_ws -p $prefix -b Debug -v $verbose + run_cmd build_catkin_workspace -w $prefix/catkin_ws -p $prefix -b Debug -v $verbose else echo "Build type = RELEASE" - run_cmd build_cpp -w $prefix/catkin_ws -p $prefix -b Release -v $verbose + run_cmd build_catkin_workspace -w $prefix/catkin_ws -p $prefix -b Release -v $verbose fi if [[ $samples -eq 1 && "$user_workspace" != "" ]];then @@ -194,8 +194,8 @@ if [[ $samples -eq 1 && "$user_workspace" != "" ]];then echo if [[ $debugging -eq 1 ]];then - run_cmd build_cpp -w $user_workspace -p $prefix -b Debug -v $verbose + run_cmd build_catkin_workspace -w $user_workspace -p $prefix -b Debug -v $verbose else - run_cmd build_cpp -w $user_workspace -p $prefix -b Release -v $verbose + run_cmd build_catkin_workspace -w $user_workspace -p $prefix -b Release -v $verbose fi fi diff --git a/example_workspace/src/hello_world_example_app/app/src/main/cpp/CMakeLists.txt b/example_workspace/src/hello_world_example_app/app/CMakeLists.txt similarity index 63% rename from example_workspace/src/hello_world_example_app/app/src/main/cpp/CMakeLists.txt rename to example_workspace/src/hello_world_example_app/app/CMakeLists.txt index 632356c..5d75332 100644 --- a/example_workspace/src/hello_world_example_app/app/src/main/cpp/CMakeLists.txt +++ b/example_workspace/src/hello_world_example_app/app/CMakeLists.txt @@ -20,30 +20,30 @@ project(hello_ros) find_package(catkin REQUIRED COMPONENTS roscpp std_msgs rosconsole) -include_directories(${catkin_INCLUDE_DIRS}) +include_directories(include ${catkin_INCLUDE_DIRS}) # build native_app_glue as a static lib -set(${CMAKE_C_FLAGS}, "${CMAKE_C_FLAGS}") -add_library(native_app_glue STATIC - ${ANDROID_NDK}/sources/android/native_app_glue/android_native_app_glue.c) +# set(${CMAKE_C_FLAGS}, "${CMAKE_C_FLAGS}") +# add_library(native_app_glue STATIC +# ${ANDROID_NDK}/sources/android/native_app_glue/android_native_app_glue.c) # now build app's shared lib set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++11 -Wall -Werror") # Export ANativeActivity_onCreate(), # Refer to: https://github.com/android-ndk/ndk/issues/381. -set(CMAKE_SHARED_LINKER_FLAGS - "${CMAKE_SHARED_LINKER_FLAGS} -u ANativeActivity_onCreate") +# set(CMAKE_SHARED_LINKER_FLAGS + # "${CMAKE_SHARED_LINKER_FLAGS} -u ANativeActivity_onCreate") -add_library(native-activity SHARED main.cpp) +add_library(native-activity SHARED src/main/jni/com_ros_example_hello_ros_MainActivity_RosThread.cpp src/main/cpp/main.cpp src/main/cpp/main_thread.cpp) -target_include_directories(native-activity PRIVATE - ${ANDROID_NDK}/sources/android/native_app_glue) +# target_include_directories(native-activity PRIVATE + # ${ANDROID_NDK}/sources/android/native_app_glue) # add lib dependencies target_link_libraries(native-activity android - native_app_glue + # native_app_glue ${catkin_LIBRARIES} - log + # log ) diff --git a/example_workspace/src/hello_world_example_app/app/build.gradle b/example_workspace/src/hello_world_example_app/app/build.gradle index 9741d70..52087e4 100644 --- a/example_workspace/src/hello_world_example_app/app/build.gradle +++ b/example_workspace/src/hello_world_example_app/app/build.gradle @@ -4,7 +4,7 @@ android { compileSdkVersion 28 defaultConfig { - applicationId = 'com.example.hello_ros' + applicationId = 'com.ros.example.hello_ros' minSdkVersion 24 targetSdkVersion 24 externalNativeBuild { @@ -32,7 +32,7 @@ android { } externalNativeBuild { cmake { - path 'src/main/cpp/CMakeLists.txt' + path 'CMakeLists.txt' } } } diff --git a/example_workspace/src/hello_world_example_app/app/include/ros_android/main_thread.h b/example_workspace/src/hello_world_example_app/app/include/ros_android/main_thread.h new file mode 100644 index 0000000..4233962 --- /dev/null +++ b/example_workspace/src/hello_world_example_app/app/include/ros_android/main_thread.h @@ -0,0 +1,40 @@ +#ifndef __ROS_ANDROID_MAIN_THREAD_H__ +#define __ROS_ANDROID_MAIN_THREAD_H__ + +#include +#include +#include + +namespace ros_android { +class MainThread { + public: + MainThread(); + explicit MainThread(std::string); + virtual ~MainThread() = 0; + + typedef std::shared_ptr Ptr; + static Ptr Instance(void); + + virtual void run() = 0; + virtual void stop() = 0; + bool check_ros_master(std::string master_ip, std::string my_ip); + private: + std::string node_name; + + static std::mutex s_instance_mutex; + static Ptr s_instance; +}; +} // namespace ros_android + +#define MY_ROS_ANDROID_MAIN_THREAD(class_name) \ + ros_android::MainThread::Ptr ros_android::MainThread::Instance() { \ + Ptr instance = s_instance; \ + if (!instance) { \ + std::lock_guard lock(s_instance_mutex); \ + if (!s_instance) { \ + instance = s_instance = std::make_shared(); \ + } \ + } \ + return instance; \ + } +#endif // #ifndef __ROS_ANDROID_MAIN_THREAD_H__ diff --git a/example_workspace/src/hello_world_example_app/app/src/main/AndroidManifest.xml b/example_workspace/src/hello_world_example_app/app/src/main/AndroidManifest.xml index d36cdb8..b1970ea 100644 --- a/example_workspace/src/hello_world_example_app/app/src/main/AndroidManifest.xml +++ b/example_workspace/src/hello_world_example_app/app/src/main/AndroidManifest.xml @@ -1,7 +1,6 @@ - @@ -9,22 +8,16 @@ - + android:hasCode="true"> - - - - @@ -33,4 +26,3 @@ - diff --git a/example_workspace/src/hello_world_example_app/app/src/main/cpp/main.cpp b/example_workspace/src/hello_world_example_app/app/src/main/cpp/main.cpp index b0471a3..23243fa 100644 --- a/example_workspace/src/hello_world_example_app/app/src/main/cpp/main.cpp +++ b/example_workspace/src/hello_world_example_app/app/src/main/cpp/main.cpp @@ -1,94 +1,54 @@ -#include -#include +#include #include -#include -#include -#include -#include -#include -#include -#include +#include -#include "ros/ros.h" +#include +#include #include -#include +class HelloRos : public ros_android::MainThread { + public: + HelloRos() : ros_android::MainThread("hello_ros") {} -int loop_count_ = 0; -ros::Publisher chatter_pub; + virtual void run() override { + ros::NodeHandle n; -void chatterCallback(const std_msgs::String::ConstPtr& msg){ - ROS_INFO("%s", msg->data.c_str()); - loop_count_++; - std_msgs::String msgo; - std::stringstream ss; - ss << "hello world from android ndk " << loop_count_; - msgo.data = ss.str(); - chatter_pub.publish(msgo); - ROS_INFO_STREAM(msg->data.c_str()); -} + /* Write your main code here */ + ROS_INFO("GOING TO PUBLISHER"); -void android_main(android_app *state) { + // Creating a publisher and a subscriber + // When something is received in chatter topic, a message is published in a_chatter topic + chatter_pub = n.advertise("a_chatter", 1000); + ros::Subscriber sub = n.subscribe("chatter", 1000, std::bind(&HelloRos::chatterCallback, this, std::placeholders::_1)); - int argc = 3; + // Rate 1Hz + ros::WallRate loop_rate(1); - //*********************** NOTE: HARDCODE rosmaster ip addresses in __master, and hardcode the ip address of the android device in __ip ************************* - char* argv[] = {const_cast("nothing_important") , const_cast("__master:=http://10.34.0.120:11311"), const_cast("__ip:=10.34.0.121")}; - //********************************************************************************************************************************************************* - - for (int i = 0; i < argc; i++) { - ROS_INFO("%s",argv[i]); + while(ros::ok()) { + ros::spinOnce(); + loop_rate.sleep(); + } } - ros::init(argc, &argv[0], "android_ndk_native_cpp"); - - ROS_INFO("GOING TO NODEHANDLE"); - std::string master_uri = ros::master::getURI(); - - if (ros::master::check()) { - ROS_INFO("ROS MASTER IS UP!"); - } else { - ROS_INFO("NO ROS MASTER."); + virtual void stop() override { + /* Write your clean-up code here */ + ros::shutdown(); } - ROS_INFO("%s", master_uri.c_str()); - - ros::NodeHandle n; - - ROS_INFO("GOING TO PUBLISHER"); - - // Creating a publisher and a subscriber - // When something is received in chatter topic, a message is published in a_chatter topic - chatter_pub = n.advertise("a_chatter", 1000); - ros::Subscriber sub = n.subscribe("chatter", 1000, chatterCallback); - - // Rate 1Hz - ros::WallRate loop_rate(1); - while(1) { - int events; - struct android_poll_source* source; - - // Poll android events, without locking - while (ALooper_pollAll(0, NULL, &events, (void**)&source) >= 0) { - // Process this event - if (source != NULL) { - source->process(state, source); - } - - // Check if we are exiting. - if (state->destroyRequested != 0) { - ROS_INFO("APP DESTROYED BYE BYE"); - return; - } - } - - ros::spinOnce(); - - if (!ros::ok()) { - ROS_INFO("ROS ISN'T OK, BYE BYE"); - return; - } - - loop_rate.sleep(); + private: + int loop_count_ = 0; + ros::Publisher chatter_pub; + + void chatterCallback(const std_msgs::String::ConstPtr& msg){ + ROS_INFO("%s", msg->data.c_str()); + loop_count_++; + std_msgs::String msgo; + std::stringstream ss; + ss << "hello world from android ndk " << loop_count_; + msgo.data = ss.str(); + chatter_pub.publish(msgo); + ROS_INFO("%s", msg->data.c_str()); } -} +}; + +MY_ROS_ANDROID_MAIN_THREAD(HelloRos) diff --git a/example_workspace/src/hello_world_example_app/app/src/main/cpp/main_thread.cpp b/example_workspace/src/hello_world_example_app/app/src/main/cpp/main_thread.cpp new file mode 100644 index 0000000..4a34b6d --- /dev/null +++ b/example_workspace/src/hello_world_example_app/app/src/main/cpp/main_thread.cpp @@ -0,0 +1,34 @@ +#include +#include + +#include +#include + + +namespace ros_android { + std::mutex MainThread::s_instance_mutex; + MainThread::Ptr MainThread::s_instance; + MainThread::MainThread() : node_name("ros_android_node") {} + MainThread::MainThread(std::string name) : node_name(name) {} + MainThread::~MainThread() {} + + bool MainThread::check_ros_master(std::string master_ip, std::string my_ip) { + int argc = 3; + bool rv; + + const char* argv[] = {"nothing_important", + (std::string("__master:=http://") + master_ip + std::string(":11311")).c_str(), + (std::string("__ip:=") + my_ip).c_str() + }; + + ros::init(argc, const_cast(&argv[0]), node_name.c_str()); + rv = ros::master::check(); + if (rv) { + ROS_INFO("ROS MASTER IS UP!"); + } else { + ROS_INFO("NO ROS MASTER."); + } + ros::start(); + return rv; + } +} \ No newline at end of file diff --git a/example_workspace/src/hello_world_example_app/app/src/main/java/com/ros/example/hello_ros/MainActivity.java b/example_workspace/src/hello_world_example_app/app/src/main/java/com/ros/example/hello_ros/MainActivity.java new file mode 100644 index 0000000..2bc1459 --- /dev/null +++ b/example_workspace/src/hello_world_example_app/app/src/main/java/com/ros/example/hello_ros/MainActivity.java @@ -0,0 +1,159 @@ +package com.ros.example.hello_ros; + +import android.Manifest; +import android.app.Activity; +import android.os.Bundle; +import android.util.Log; +import android.view.View; +import android.widget.Button; +import android.widget.EditText; +import android.widget.TextView; +import android.widget.Toast; + +import java.lang.Runnable; +import java.net.Inet4Address; +import java.net.InetAddress; +import java.net.NetworkInterface; +import java.util.Enumeration; + +public class MainActivity extends Activity { + static { + System.loadLibrary("native-activity"); + } + + private final String TAG = "HELLO-WORLD-EXAMPLE"; + + private enum Status { + WAITING, RUNNING + } + + private class RosThread implements Runnable { + public RosThread() { + Log.i(TAG, "calling __RosThread"); + __RosThread(); + Log.i(TAG, "ended __RosThread"); + } + @Override + public native void run(); + public native void stop(); + public native boolean checkRosMaster(String masterIP, String myIP); + private native void __RosThread(); + } + + private RosThread mainThread; + private EditText masterIP; + private EditText myIP; + private Button runButton; + private TextView statusText; + private Status status; + + @Override + protected void onCreate(Bundle savedInstanceState) { + Log.i(TAG, "OnCreate()"); + super.onCreate(savedInstanceState); + setContentView(R.layout.logging); + + masterIP = (EditText) findViewById(R.id.master_ip); + myIP = (EditText) findViewById(R.id.my_ip); + runButton = (Button) findViewById(R.id.run_button); + statusText = (TextView) findViewById(R.id.status); + status = Status.WAITING; + + Log.i(TAG, "new RosThread"); + mainThread = new RosThread(); + Log.i(TAG, "end RosThread constructor"); + + runButton.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + runButtonCallback(); + } + }); + + String ip = getLocalIpAddress(); + if (ip != null) { + myIP.setText(ip); + } + } + + @Override + protected void onResume() { + super.onResume(); + if (status == Status.RUNNING) { + new Thread(mainThread).start(); + } + } + + @Override + protected void onPause() { + super.onPause(); + mainThread.stop(); + } + + @Override + protected void onDestroy() { + super.onDestroy(); + mainThread.stop(); + } + + private void runButtonCallback() { + String ipRegexExpression = + "^(([01]?\\d\\d?|2[0-4]\\d|25[0-5])\\.){3}([01]?\\d\\d?|2[0-4]\\d|25[0-5])$"; + + switch (status) { + case WAITING: + String sMasterIP = masterIP.getText().toString(); + if (! sMasterIP.matches(ipRegexExpression)) { + statusText.setText(R.string.status_masterIP_error); + break; + } + Log.i(TAG, "master ip is fine: " + sMasterIP); + + String sMyIP = myIP.getText().toString(); + if (! sMyIP.matches(ipRegexExpression)) { + statusText.setText(R.string.status_myIP_error); + break; + } + Log.i(TAG, "my ip is fine: " + sMyIP); + + if (! mainThread.checkRosMaster(sMasterIP, sMyIP)) { + statusText.setText(R.string.status_check_master_error); + break; + } + Log.i(TAG, "Master is ready"); + + statusText.setText(R.string.status_running); + runButton.setText(R.string.button_stop); + + new Thread(mainThread).start(); + status = Status.RUNNING; + break; + + case RUNNING: + statusText.setText(R.string.status_waiting); + runButton.setText(R.string.button_run); + + mainThread.stop(); + status = Status.WAITING; + break; + } + } + + private String getLocalIpAddress(){ + try { + for (Enumeration en = NetworkInterface.getNetworkInterfaces(); + en.hasMoreElements();) { + NetworkInterface intf = en.nextElement(); + for (Enumeration enumIpAddr = intf.getInetAddresses(); enumIpAddr.hasMoreElements();) { + InetAddress inetAddress = enumIpAddr.nextElement(); + if (!inetAddress.isLoopbackAddress() && inetAddress instanceof Inet4Address) { + return inetAddress.getHostAddress(); + } + } + } + } catch (Exception ex) { + Log.e("IP Address", ex.toString()); + } + return null; + } +} diff --git a/example_workspace/src/hello_world_example_app/app/src/main/jni/com_ros_example_hello_ros_MainActivity_RosThread.cpp b/example_workspace/src/hello_world_example_app/app/src/main/jni/com_ros_example_hello_ros_MainActivity_RosThread.cpp new file mode 100644 index 0000000..39c52f2 --- /dev/null +++ b/example_workspace/src/hello_world_example_app/app/src/main/jni/com_ros_example_hello_ros_MainActivity_RosThread.cpp @@ -0,0 +1,24 @@ +#include +#include "com_ros_example_hello_ros_MainActivity_RosThread.h" + +using namespace ros_android; + +JNIEXPORT void JNICALL Java_com_ros_example_hello_1ros_MainActivity_00024RosThread_run + (JNIEnv *, jobject) { + MainThread::Instance()->run(); +} + +JNIEXPORT void JNICALL Java_com_ros_example_hello_1ros_MainActivity_00024RosThread_stop + (JNIEnv *, jobject) { + MainThread::Instance()->stop(); +} + +JNIEXPORT jboolean JNICALL Java_com_ros_example_hello_1ros_MainActivity_00024RosThread_checkRosMaster + (JNIEnv *env, jobject, jstring j_master_ip, jstring j_my_ip) { + return MainThread::Instance()->check_ros_master(env->GetStringUTFChars(j_master_ip, nullptr), env->GetStringUTFChars(j_my_ip, nullptr)); +} + +JNIEXPORT void JNICALL Java_com_ros_example_hello_1ros_MainActivity_00024RosThread__1_1RosThread + (JNIEnv *, jobject) { + MainThread::Instance(); +} \ No newline at end of file diff --git a/example_workspace/src/hello_world_example_app/app/src/main/jni/com_ros_example_hello_ros_MainActivity_RosThread.h b/example_workspace/src/hello_world_example_app/app/src/main/jni/com_ros_example_hello_ros_MainActivity_RosThread.h new file mode 100644 index 0000000..0228a2d --- /dev/null +++ b/example_workspace/src/hello_world_example_app/app/src/main/jni/com_ros_example_hello_ros_MainActivity_RosThread.h @@ -0,0 +1,45 @@ +/* DO NOT EDIT THIS FILE - it is machine generated */ +#include +/* Header for class com_ros_example_hello_ros_MainActivity_RosThread */ + +#ifndef _Included_com_ros_example_hello_ros_MainActivity_RosThread +#define _Included_com_ros_example_hello_ros_MainActivity_RosThread +#ifdef __cplusplus +extern "C" { +#endif +/* + * Class: com_ros_example_hello_ros_MainActivity_RosThread + * Method: run + * Signature: ()V + */ +JNIEXPORT void JNICALL Java_com_ros_example_hello_1ros_MainActivity_00024RosThread_run + (JNIEnv *, jobject); + +/* + * Class: com_ros_example_hello_ros_MainActivity_RosThread + * Method: stop + * Signature: ()V + */ +JNIEXPORT void JNICALL Java_com_ros_example_hello_1ros_MainActivity_00024RosThread_stop + (JNIEnv *, jobject); + +/* + * Class: com_ros_example_hello_ros_MainActivity_RosThread + * Method: checkRosMaster + * Signature: (Ljava/lang/String;Ljava/lang/String;)Z + */ +JNIEXPORT jboolean JNICALL Java_com_ros_example_hello_1ros_MainActivity_00024RosThread_checkRosMaster + (JNIEnv *, jobject, jstring, jstring); + +/* + * Class: com_ros_example_hello_ros_MainActivity_RosThread + * Method: __RosThread + * Signature: ()V + */ +JNIEXPORT void JNICALL Java_com_ros_example_hello_1ros_MainActivity_00024RosThread__1_1RosThread + (JNIEnv *, jobject); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/example_workspace/src/hello_world_example_app/app/src/main/res/layout/logging.xml b/example_workspace/src/hello_world_example_app/app/src/main/res/layout/logging.xml new file mode 100644 index 0000000..4a8f710 --- /dev/null +++ b/example_workspace/src/hello_world_example_app/app/src/main/res/layout/logging.xml @@ -0,0 +1,34 @@ + + + + + + + + + +