ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

rosjava message serialization problems [closed]

asked 2012-05-26 09:27:44 -0500

LawrieGriffiths gravatar image

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?

edit retag flag offensive reopen merge delete

Closed for the following reason duplicate question by damonkohler
close date 2012-07-03 20:01:06

1 Answer

Sort by ยป oldest newest most voted
0

answered 2012-07-03 20:00:57 -0500

damonkohler gravatar image
edit flag offensive delete link more

Question Tools

Stats

Asked: 2012-05-26 09:27:44 -0500

Seen: 311 times

Last updated: Jul 03 '12