Rosjava converts custom message array to list

asked 2018-01-17 21:19:10 -0500

jbeard gravatar image

updated 2018-01-18 09:46:27 -0500

I have a custom ROS message file that is currently running in a ROS project. The message file looks like this:

Header header
float32[6] angle
time[6] time

I am using rosjava to convert the custom message to a jar package I then use in an Android application project. The process works well except for this type of message. That is one that contains an array of a non-primitive (Time in this instance). What happens is the jar package is built with a List<time> rather than Time[] and the resulting jar class has a structure that looks similar to:

Header getHeader();
void setHeader(Header var1);
float[] getAngle();
void setAngle(float[] var1);
List<Time> getTime();
void setTime(List<Time> var1);

This results in a run-time crash of the Android app when it subscribes and receives a message of this type. The error is a bit cryptic but basically it indicates that it expected a maximum of 2 bytes but read 4 bytes. I can perhaps work around this by changing the message structure and modifying how we are using it in our ROS project, however is there a better solution?

edit retag flag offensive close merge delete