You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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?
The text was updated successfully, but these errors were encountered:
In case someone who may have encountered the same issue finds this post in the future, I was able to bypass this issue by encoding the raw data into a Base64 string and passing the string to a simple service hosted on the robot (written in Python or C++), which would then decode the string and call sendRemoteBufferToOutput() function via qimessaging's Python (or C++) API.
In libqi, we can specify the "future callback type".
This influences the execution of callbacks: if the type is
Sync, then the callback is executed synchronously during setValue(…) or
then(…)/andThen(…). Otherwise, it is executed asynchronously.
For example:
Promise<String> promise = new Promise<>(FutureCallbackType.Sync);
System.out.println("#0");
promise.getFuture().andThen(new QiCallback<String>() {
@OverRide
public void onResult(String result) {
// executed in the same thread
System.out.println("#2");
}
});
System.out.println("#1");
promise.setValue("hello");
System.out.println("#3");
This code sample prints:
#0
#1#2#3
Change-Id: I732a76070a7ec67b58c1e666f0e538571689fede
Reviewed-on: http://gerrit.aldebaran.lan/72640
Reviewed-by: rvimont <[email protected]>
Tested-by: gerrit
Reviewed-by: epinault <[email protected]>
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?
The text was updated successfully, but these errors were encountered: