Ask Your Question
0

topic_tools feed missing covariance

asked 2017-02-02 09:46:33 -0500

Chrisando gravatar image

updated 2017-02-02 09:47:10 -0500

I have a bag file with missing information in one of the topics. I would like to feed missing covariance values to imu topic.

orientation: 
  x: -0.01318359375
  y: -0.0069580078125
  z: 0.885437011719
  w: 0.464538574219
orientation_covariance: [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]

I've tried to use topic_tools transform to feed in missing information

rosrun topic_tools transform /imu_data/orientation_covariance /imu_filtered std_msgs/Float64[9] '[1, 1, 1, 1, 1, 1, 1, 1, 1
]'

but I receive error like this:

ValueError: topic parameter 'data_class' is not initialized

Is it possible to feed missing data somehow? Thanks!

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2017-02-02 11:04:31 -0500

Chrisando gravatar image

updated 2017-02-02 11:04:46 -0500

I haven't found command line solution to this problem, but I've managed to use rosbag API to populate missing covariance values.

import rospy
import rosbag

output_bag = 'loop_closing_filtered_with_covariance.bag'
input_bag = 'loop_closing_filtered.bag'

with rosbag.Bag(output_bag, 'w') as outbag:
    for topic, msg, t in rosbag.Bag(input_bag).read_messages():
        if topic == "/imu_data":
            msg.orientation_covariance = [10000.0, 0.0, 0.0, 0.0, 10000.0, 
                                          0.0, 0.0, 0.0, 0.0025]
            msg.linear_acceleration_covariance = [0.04, 0.0, 0.0, 0.0, 10000.0,
                                                  0.0, 0.0, 0.0, 10000.0]
            outbag.write(topic, msg, t)
        else:
            outbag.write(topic, msg, t)
edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

2 followers

Stats

Asked: 2017-02-02 09:46:33 -0500

Seen: 102 times

Last updated: Feb 02 '17