Git Product home page Git Product logo

libqi-java's People

Contributors

apiroelle avatar arnaudpiroelle avatar blastrock avatar cgestes avatar ckilner avatar clemolgat-sbr avatar dmerejkowsky avatar goreal avatar hcuche avatar jlanca avatar llec avatar qianaldeb avatar rom1v avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

libqi-java's Issues

cast byte[] to serializable Object; communicate with audio device

I want to be able to send binary audio data remotely to a pepper robot. While I was able to do so using Naoqi's sendRemoteBufferToOutput() method with qi framework and C++ SDK (2.5.5), I can't find a simple way to call that method in Java.

In C++, sendRemoteBufferToOutput() accepts an ALValue constructed from a binary buffer (ALValue.setBinary()); in Java it's even more ambiguous. According to jnaoqi's API, it accepts merely an Object. I tried passing a byte array or a list of bytes or a byteBuffer, none of which works, and I constantly get this error:
qimessaging.jni: Cannot serialize return value: Unable to convert JObject in AnyValue

(Additionally, when I was using qimessaging's API I got this error:
qimessaging.remoteobject: no promise found for req id:162 obj: 60 func: 2 type: Reply)

I looked into old documentations, and in version 1.14 there is a binding class for ALValue, called Variant, that I can't find in the new API. Qimessaging seemed to support customizable serializers, but I don't think it was included in the 2.5.5 release. So I ran out of ideas. Another way I can think of now is to wrap either ALValue or my entire C++ application in JNI, but I'd like to know the right way to call sendRemoteBufferToOutput() in Java before going that route.

In conclusion, my issue is: is it possible to pass a byte buffer to sendRemoteBufferToOutput() in Java?

CMake 3.16 or higher is required. You are running version 3.5.1

Hi,

I started over again, hence a new Issue.

I use Ubuntu 16.04 as virtual machine:

lsb_release -a
LSB Version:	core-9.20160110ubuntu0.2-amd64:core-9.20160110ubuntu0.2-noarch:printing-9.20160110ubuntu0.2-amd64:printing-9.20160110ubuntu0.2-noarch:security-9.20160110ubuntu0.2-amd64:security-9.20160110ubuntu0.2-noarch
Distributor ID:	Ubuntu
Description:	Ubuntu 16.04.7 LTS
Release:	16.04
Codename:	xenial

I installed python2.7 and pip:

python --version
Python 2.7.12

pip --version
pip 20.3.4 from /home/nao/.local/lib/python2.7/site-packages/pip (python 2.7)

I have a Pepper with NAOqi 2.5, so I used this guide:

https://developer.softbankrobotics.com/pepper-naoqi-25/naoqi-developer-guide/sdks/c-sdk/c-sdk-installation-guide

sudo apt-get install build-essential

My compilers are:

g++ --version
g++ (Ubuntu 5.4.0-6ubuntu1~16.04.12) 5.4.0 20160609
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

gcc --version
gcc (Ubuntu 5.4.0-6ubuntu1~16.04.12) 5.4.0 20160609
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

cmake --version
cmake version 3.5.1

CMake suite maintained and supported by Kitware (kitware.com/cmake).

Maybe I also have to need lower versions.

Then I run pip install qibuild --user.

After that I run (again) the qibuild config --wizard:

qibuild config --wizard
Found CMake: /usr/bin/cmake
:: Please choose a generator
   1 Unix Makefiles 	(default)
   2 Ninja
   3 Watcom WMake
   4 CodeBlocks - Ninja
   5 CodeBlocks - Unix Makefiles
   6 CodeLite - Ninja
   7 CodeLite - Unix Makefiles
   8 Eclipse CDT4 - Ninja
   9 Eclipse CDT4 - Unix Makefiles
   10 KDevelop3
   11 KDevelop3 - Unix Makefiles
   12 Kate - Ninja
   13 Kate - Unix Makefiles
   14 Sublime Text 2 - Ninja
   15 Sublime Text 2 - Unix Makefiles
> 1
:: Please choose an IDE
   1 None 	(default)
   2 QtCreator
   3 Eclipse CDT
> 1

:: Found a worktree in /home/nao/work/aldebaran
:: Do you want to configure settings for this worktree? (y/N)
> y
:: Found the following build configs:  android-x86_64, cross-atom, android-x86, myconfig, linux64, win32-vs2013, android-arm, mac64
:: Use one of these build configs by default (Y/n)
> y
:: Choose a build config to use by default
   1 android-x86_64 	(default)
   2 cross-atom
   3 android-x86
   4 myconfig
   5 linux64
   6 win32-vs2013
   7 android-arm
   8 mac64
> 7
:: Do you want to use a unique build dir? (mandatory when using Eclipse) (y/N)
> n

I got the toolchains with:

qitoolchain create --feed-name android-arm android-arm https://github.com/aldebaran/toolchains.git
qitoolchain create --feed-name android-x86 android-x86 https://github.com/aldebaran/toolchains.git
qitoolchain create --feed-name android-x86_64 android-x86_64 https://github.com/aldebaran/toolchains.git
qitoolchain create --feed-name linux64 linux64 https://github.com/aldebaran/toolchains.git
qitoolchain create --feed-name mac64 mac64 https://github.com/aldebaran/toolchains.git
qitoolchain create --feed-name win32-vs2013 win32-vs2013 https://github.com/aldebaran/toolchains.git

To /etc/environment I added:

ANDROID_HOME=/home/nao/Android/Sdk
ANDROID_NDK_HOME=/home/nao/Android/Sdk/ndk-bundle
ANDROID_NDK_ROOT=/home/nao/Android/Sdk/ndk-bundle

I installed Android Studio with the Ubuntu Software Center and donwloaded NDK manually and unzipped it to the directory above.

Then I added the qibuild configs:

qibuild add-config android-arm -t android-arm
qibuild add-config android-x86 -t android-x86
qibuild add-config android-x86_64 -t android-x86_64
qibuild add-config linux64 -t linux64
qibuild add-config mac64 -t mac64
qibuild add-config win32-vs2013 -t win32-vs2013

And fetched the sources:

mkdir -p ~/work/aldebaran
cd ~/work/aldebaran
qisrc init https://github.com/aldebaran/manifest.git

Because qisrc init [email protected]:aldebaran/manifest.git does not work.

And then I tried to configure my qibuild:

cd ~/work/aldebaran/sdk/libqi-java/jni
qibuild configure -c android-arm

I got following error:

* (1/3) Configuring gtest
-- Adjusting Android API level 'android-17' to 'android-14'
-- Using qibuild 3.17
-- Library: gtest
-- Library: gtest_main
-- Configuring done
-- Generating done
CMake Warning:
  Manually-specified variables were not used by the project:

    WITH_QIBUILD


-- Build files have been written to: /home/nao/work/aldebaran/sdk/libgtest/build-android-arm
* (2/3) Configuring libqi
CMake Error at CMakeLists.txt:5 (cmake_minimum_required):
  CMake 3.16 or higher is required.  You are running version 3.5.1


-- Configuring incomplete, errors occurred!
[ERROR]: ConfigureFailed

I tried it with this solution:
https://askubuntu.com/questions/355565/how-do-i-install-the-latest-version-of-cmake-from-the-command-line

Then I received following errors:

Using toolchain: android-arm
* (1/3) Configuring gtest
CMake Deprecation Warning at CMakeLists.txt:3 (cmake_minimum_required):
  Compatibility with CMake < 2.8.12 will be removed from a future version of
  CMake.

  Update the VERSION argument <min> value or use a ...<max> suffix to tell
  CMake that the project does not need compatibility with older versions.


CMake Deprecation Warning at /home/nao/.local/share/qi/toolchains/android-arm/ndk/toolchain.cmake:187 (cmake_minimum_required):
  Compatibility with CMake < 2.8.12 will be removed from a future version of
  CMake.

  Update the VERSION argument <min> value or use a ...<max> suffix to tell
  CMake that the project does not need compatibility with older versions.
Call Stack (most recent call first):
  /home/nao/.local/share/qi/toolchains/android-arm/toolchain-android-arm.cmake:5 (include)
  /usr/share/cmake-3.20/Modules/CMakeDetermineSystem.cmake:123 (include)
  CMakeLists.txt:4 (project)


-- Adjusting Android API level 'android-17' to 'android-14'
CMake Deprecation Warning at /usr/share/cmake-3.20/Modules/CMakeForceCompiler.cmake:75 (message):
  The CMAKE_FORCE_C_COMPILER macro is deprecated.  Instead just set
  CMAKE_C_COMPILER and allow CMake to identify the compiler.
Call Stack (most recent call first):
  /home/nao/.local/share/qi/toolchains/android-arm/ndk/toolchain.cmake:1162 (CMAKE_FORCE_C_COMPILER)
  /home/nao/.local/share/qi/toolchains/android-arm/toolchain-android-arm.cmake:5 (include)
  /usr/share/cmake-3.20/Modules/CMakeDetermineSystem.cmake:123 (include)
  CMakeLists.txt:4 (project)


CMake Deprecation Warning at /usr/share/cmake-3.20/Modules/CMakeForceCompiler.cmake:89 (message):
  The CMAKE_FORCE_CXX_COMPILER macro is deprecated.  Instead just set
  CMAKE_CXX_COMPILER and allow CMake to identify the compiler.
Call Stack (most recent call first):
  /home/nao/.local/share/qi/toolchains/android-arm/ndk/toolchain.cmake:1174 (CMAKE_FORCE_CXX_COMPILER)
  /home/nao/.local/share/qi/toolchains/android-arm/toolchain-android-arm.cmake:5 (include)
  /usr/share/cmake-3.20/Modules/CMakeDetermineSystem.cmake:123 (include)
  CMakeLists.txt:4 (project)


CMake Deprecation Warning at /home/nao/.local/share/qi/toolchains/android-arm/ndk/toolchain.cmake:187 (cmake_minimum_required):
  Compatibility with CMake < 2.8.12 will be removed from a future version of
  CMake.

  Update the VERSION argument <min> value or use a ...<max> suffix to tell
  CMake that the project does not need compatibility with older versions.
Call Stack (most recent call first):
  /home/nao/.local/share/qi/toolchains/android-arm/toolchain-android-arm.cmake:5 (include)
  build-android-arm/CMakeFiles/3.20.5/CMakeSystem.cmake:6 (include)
  CMakeLists.txt:4 (project)


CMake Error: CMake was unable to find a build program corresponding to "Unix Makefiles".  CMAKE_MAKE_PROGRAM is not set.  You probably need to select a different build tool.
-- Configuring incomplete, errors occurred!
See also "/home/nao/work/aldebaran/sdk/libgtest/build-android-arm/CMakeFiles/CMakeOutput.log".
[ERROR]: ConfigureFailed

As suggested I changed cmake_minimum_required to 2.8.12. Before that it was set to 2.6.x.

Then I got errors like CMAKE_FORCE_C_COMPILER macro is deprecated or CMAKE_FORCE_CXX_COMPILER macro is deprecated. I found a solution here:

https://stackoverflow.com/questions/66329704/cmake-deprecation-warning-messagedeprecation-the-cmake-force-c-compiler-mac

I remove it by commenting it out.

And if I run qibuild configure -c android-arm again I got:

Using toolchain: android-arm
* (1/3) Configuring gtest
-- Adjusting Android API level 'android-17' to 'android-14'
CMake Error: CMake was unable to find a build program corresponding to "Unix Makefiles".  CMAKE_MAKE_PROGRAM is not set.  You probably need to select a different build tool.
-- Configuring incomplete, errors occurred!
See also "/home/nao/work/aldebaran/sdk/libgtest/build-android-arm/CMakeFiles/CMakeOutput.log".
[ERROR]: ConfigureFailed

A solution which I have found is that you have to install sudo apt install build-essential. It is installed so I purged it and install it again. But the error still exists.

Specified toolchain "arm-linux-androideabi-4.9" is missing in your NDK or broken

Hi,

I tried to use the toolchain for android-arm but I got this error:

Using toolchain: android-arm
* (1/1) Configuring qimessaging-jni
CMake Error at /home/nao/.local/share/qi/toolchains/android-arm/ndk/toolchain.cmake:773 (message):
  Specified toolchain "arm-linux-androideabi-4.9" is missing in your NDK or
  broken.  Please verify that your NDK is working or select another compiler
  toolchain.

  To configure the toolchain set CMake variable ANDROID_TOOLCHAIN_NAME to one
  of the following values:

    * arm-linux-androideabi-4.4.3
    * arm-linux-androideabi-4.6
    * arm-linux-androideabi-4.7
    * arm-linux-androideabi-clang3.1
    * arm-linux-androideabi-clang3.2
    * mipsel-linux-android-4.4.3
    * mipsel-linux-android-4.6
    * mipsel-linux-android-4.7
    * mipsel-linux-android-clang3.1
    * mipsel-linux-android-clang3.2
    * x86-4.4.3
    * x86-4.6
    * x86-4.7
    * x86-clang3.1
    * x86-clang3.2

Call Stack (most recent call first):
  /home/nao/.local/share/qi/toolchains/android-arm/toolchain-android-arm.cmake:5 (include)
  /usr/share/cmake-3.5/Modules/CMakeDetermineSystem.cmake:98 (include)
  CMakeLists.txt:2 (project)


CMake Error: CMAKE_C_COMPILER not set, after EnableLanguage
CMake Error: CMAKE_CXX_COMPILER not set, after EnableLanguage
-- Configuring incomplete, errors occurred!

So, one step after another...

I created a Ubuntu 16.04 virtual machine. I installed Python 2.7 and pip for Python 2.7. Then I installed the Python SDK. After that I installed the C++ SDK and qibuild. Then I downloaded the Java SDK and the JavaScript SDK. With all this I have written basic examples for a Pepper with NAOqi 2.5. Then I tried to use the Java SDK in my Android Project. Sadly this does not work. After that I have seen in libqi-java that there could be a possibility.

java -version
openjdk version "1.8.0_292"
OpenJDK Runtime Environment (build 1.8.0_292-8u292-b10-0ubuntu1~16.04.1-b10)
OpenJDK 64-Bit Server VM (build 25.292-b10, mixed mode)

I installed Android Studio by using the Ubuntu Software Center. At first I have installed NDK by going to Tools --> SDK Manager --> SDK Tools. But sadly this was NDK 24.x. Then I uninstalled this version. The oldest version I can find inside SDK Tools was 16.x. I then downloaded android-ndk-r8e. I unzipped it to the location where Android Studio normally would install Android NDK.

For better understandig... This are my enviroment variables:

export PYTHONPATH=$PYTHONPATH:/home/nao/naoqi/pynaoqi-python2.7-2.5.7.1-linux64/lib/python2.7/site-packages:/home/nao/naoqi/pynaoqi-python2.7-2.5.7.1-linux64/lib/python2.7/dist-packages:/home/nao/.local/lib/python2.7/site-packages

PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/home/nao/.local/bin:/usr/lib/jvm/java-8-openjdk-amd64/bin:/home/nao/Android/Sdk:/home/nao/Android/Sdk/ndk-bundle"
JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64
ROS_HOSTNAME="$(hostname -f)"
ROS_MASTER_URI=http://$ROS_HOSTNAME:11311
ROS_IP="$(hostname -I | awk '{print $1;}')"
ANDROID_HOME=/home/nao/Android/Sdk
ANDROID_NDK_HOME=/home/nao/Android/Sdk/ndk-bundle
ANDROID_NDK_ROOT=/home/nao/Android/Sdk/ndk-bundle

You have written in your README.md that ANDROID_NDK_HOME should point to /path/to/android-ndk-r8e. If I run qibuild the ANDROID_NDK_ROOT should point to that location. I fixed it. But inside of the android-ndk-r8e there is no arm-linux-androideabi-4.9. I then edited /home/nao/.local/share/qi/toolchains/android-arm/ndk/toolchain.cmake by adding:

set(ANDROID_TOOLCHAIN_NAME "arm-linux-androideabi-4.4.3")

After that I run into the next error:

* (1/1) Configuring qimessaging-jni
-- Adjusting Android API level 'android-17' to 'android-14'
-- Using qibuild 3.17
-- Library: qimessagingjni
CMake Error at /home/nao/.local/share/cmake/qibuild/internal/uselib.cmake:80 (find_package):
  By not providing "FindQI.cmake" in CMAKE_MODULE_PATH this project has asked
  CMake to find a package configuration file provided by "QI", but CMake did
  not find one.

  Could not find a package configuration file provided by "QI" with any of
  the following names:

    QIConfig.cmake
    qi-config.cmake

  Add the installation prefix of "QI" to CMAKE_PREFIX_PATH or set "QI_DIR" to
  a directory containing one of the above files.  If "QI" provides a separate
  development package or SDK, be sure it has been installed.
Call Stack (most recent call first):
  /home/nao/.local/share/cmake/qibuild/internal/uselib.cmake:197 (_qi_use_lib_get_deps)
  /home/nao/.local/share/cmake/qibuild/stage.cmake:247 (_qi_use_lib_internal)
  /home/nao/.local/share/cmake/qibuild/target.cmake:277 (qi_use_lib)
  CMakeLists.txt:59 (qi_create_lib)


-- Configuring incomplete, errors occurred!
See also "/home/nao/worktree/libqi-java/jni/build-android-arm/CMakeFiles/CMakeOutput.log".

I can locate it:

locate qi-config.cmake
/home/nao/naoqi/ctc-linux64-atom-2.5.10.7/libqi/share/cmake/qi/qi-config.cmake
/home/nao/naoqi/naoqi-sdk-2.5.7.1-linux64/share/cmake/qi/qi-config.cmake

Maybe you have a solution for this issue.

What I have done before was doing following steps:

qitoolchain create --feed-name android-arm android-arm https://github.com/aldebaran/toolchains.git
qitoolchain create --feed-name android-x86 android-x86 https://github.com/aldebaran/toolchains.git
qitoolchain create --feed-name android-x86_64 android-x86_64 https://github.com/aldebaran/toolchains.git
qitoolchain create --feed-name linux64 linux64 https://github.com/aldebaran/toolchains.git
qitoolchain create --feed-name mac64 mac64 https://github.com/aldebaran/toolchains.git
qitoolchain create --feed-name win32-vs2013 win32-vs2013 https://github.com/aldebaran/toolchains.git


qitoolchain list
Known toolchains:
* android-arm
* android-x86
* android-x86_64
* cross-atom
* linux64
* mac64
* mytoolchain
* win32-vs2013



qibuild add-config android-arm -t android-arm
qibuild add-config android-x86 -t android-x86
qibuild add-config android-x86_64 -t android-x86_64
qibuild add-config linux64 -t linux64
qibuild add-config mac64 -t mac64
qibuild add-config win32-vs2013 -t win32-vs2013

The next step would not work:

mkdir -p ~/work/aldebaran
cd ~/work/aldebaran
qisrc init [email protected]:aldebaran/manifest.git

You can find this issue here:

aldebaran/manifest#2

A workaround is to clone it from github directly.

I also does not use ~/work. I will use ~/worktree. Because this was described so in the installation guide for the C++ SDK.

The next steps would be:

cd /home/nao/worktree/libqi-java/jni
qibuild configure --release -c android-arm
qibuild make -j4 -c android-arm
mkdir -p ../qimessaging/lib/armeabi-v7a
mkdir -p /tmp/libqi-java/android-arm/
qibuild install --runtime -c android-arm

cd /tmp/libqi-java/android-arm/

for file in $(find -name [*](https://github.com/aldebaran/libqi-java#id1).so) do
    cp $file ~/work/aldebaran/sdk/libqi-java/qimessaging/lib/armeabi-v7a
done

cd ~/work/aldebaran/sdk/libqi-java
rm -rf /tmp/libqi-java/android-arm/
cp -f jni/build-android-arm/sdk/lib/libgnustl_shared.so qimessaging/lib/armeabi-v7a
cd qimessaging
mvn install -DskipTests=true # use -f pom-android.xml version=$(cat pom-android.xml | grep -oPm1 "(?<=<version>)[^<]+")
zip -r target/libqi-java-$version.jar lib/

Perhaps in the further procedure would be even more errors that I become aware of.

Thanks in advance.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.