How do you construct composite messages in rosjava?
Recently, rosjava changed so that you can no longer create a message structure like so:
org.ros.message.std_msgs.String str = new org.ros.message.std_msgs.String();
str.data = "Hello world! " + sequenceNumber;
Instead it looks like the only way to create a message is by calling "newMessage()" on a publisher and then using accessor methods like so:
std_msgs.String str = publisher.newMessage();
str.setData("Hello world! " + sequenceNumber);
This makes it really hard to construct things like geometry_msgs/PoseArray messages, where you need to create a bunch of other message types to populate the message. Listing the symbols defined in "rosjava_messages-0.0.0-SNAPSHOT.jar" I don't see any instance fields or ways to create messages without an unclear series of factories.
This diff shows the API change in use in the pubsub tutorial. (though it has changed a bit since then)
For the curious, the symbols defined for geometry_msgs.PoseArray are:
rosjava_messages-0.0.0-SNAPSHOT.jar(geometry_msgs/PoseArray.class):
00000279 C geometry_msgs.PoseArray
00000008 D geometry_msgs.PoseArray._TYPE:Ljava/lang/String;
00000008 D geometry_msgs.PoseArray._DEFINITION:Ljava/lang/String;
T geometry_msgs.PoseArray.getHeader:()Lstd_msgs/Header;
T geometry_msgs.PoseArray.setHeader:(Lstd_msgs/Header;)V
T geometry_msgs.PoseArray.getPoses:()Ljava/util/List;
T geometry_msgs.PoseArray.setPoses:(Ljava/util/List;)V
And in this case, it's unclear to me how to construct geometry_msgs/Pose messages to populate the list of Poses in geometry_msgs/PoseArray.