rosjava message serialization problems [closed]
I am having problems creating nav_msgs/Odometry messages with the latest version of rosjava (updated today).
The problem is that parts of the message, when viewed by rostopic echo, are corrupted. For example, the covariance fields have a spurious value in the first element, and setting the Twist.Twist.angular.Z field sets the wrong value and corrupts the previous Y value.
The following output from rostopic echo odom_test:
header: seq: 1 stamp: secs: 0 nsecs: 0 frame_id: '' child_frame_id: '' pose: pose: position: x: 0.0 y: 0.0 z: 0.0 orientation: x: 0.0 y: 0.0 z: 0.0 w: 0.0 covariance: [1.8e-322, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0] twist: twist: linear: x: 0.0 y: 0.0 z: 0.0 angular: x: 0.0 y: 1.91251260352e-180 z: 5.3357055732e-315 covariance: [7.63918484747e-313, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0] ---
was produced by:
private Odometry odom;
private Publisher<Odometry> odomTopic;
private String odomMessageType = "nav_msgs/Odometry";
@Override
public void onStart(ConnectedNode node) {
odom = node.getTopicMessageFactory().newFromType(Odometry._TYPE);
odomTopic = node.newPublisher("odom_test", odomMessageType);
// Leave message all blank, except ...
odom.getTwist().getTwist().getAngular().setY(123.456);
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
}
odomTopic.publish(odom);
}
You can see the corrupted covariance and Y and Z values. Similar things happen with other messages such as Imu.
Is this a bug or am I doing something wrong?