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

Revision history [back]

click to hide/show revision 1
initial version

I have 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)

I have 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)