Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JNI ERROR of sensor_msgs.msg.Image on Android side but solved on ROS side #224

Open
ShanPoon opened this issue Sep 22, 2022 · 1 comment

Comments

@ShanPoon
Copy link

ShanPoon commented Sep 22, 2022

With reference to this issue #132

The crash message
JNI ERROR (app bug): expected jbyte but got value of 206 as argument 1 to void java.lang.Byte.(byte)

The crash message on android side showed that the received data from ros is unsigned byte (0-255) but the byte of java is signed (-128, 127).
Therefore, the proper way to solve this problem should be on android side to disable the check of data type.
https://android.googlesource.com/platform/art/+/master/runtime/reflection.cc line417

I have no idea to solve on android side but changed unit8[] data from http://docs.ros.org/en/noetic/api/sensor_msgs/html/msg/CompressedImage.html from to int8[] data and compile the ros2_java library again. The publish/subscribe of this message becomes normal without crash.

Is there alternative to solve this issue on Android side without changing the message type of CompressedImage?

@YasuChiba
Copy link

YasuChiba commented Feb 7, 2023

Hi, I'm currently working on porting ROS-Mobile-Android to ROS2 using rcljava. (https://github.com/YasuChiba/ROS2-Mobile-Android)
I encountered this JNI Error problem while implementing the function to display std_msgs.msg.Image in the app.
As a temporary workaround, I have confirmed that the error no longer occurs once I rewrite the msg.cpp.em file like this. (though performance is quite poor).
In my understanding, the osrf/ros2_java repository has resolved this issue, but are there any plans to merge the changes into
this repository?

@ivanpauno @jacobperron
I'm really sorry to mention both of you. Could you please tell me if you are planning to update this repository?
If not, I will try to implement it by my self :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants