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

ROS2 rosbag2 read bag file

asked 2020-11-16 12:33:29 -0500

waspinator gravatar image

updated 2020-11-16 13:04:42 -0500

I recorded data using ros2 bag record --all --output test.bag in ROS2 Foxy. In ROS1 I could read the bag contents using something like:

import rosbag
bag = rosbag.Bag('test.bag')
for topic, msg, t in bag.read_messages(topics=['chatter', 'numbers']):
    print(msg)
bag.close()

What is the ROS2 equivalent code?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2020-11-16 15:35:17 -0500

soldierofhell gravatar image

I've searched recently and found nothing but tests, but they should be enough for your needs.

edit flag offensive delete link more

Comments

I have been trying to do this with ros eloquent. I am unable to deserialize when importing from rclpy.serialization import deserialize_message tells me that rclpy does not have serialization

wilkinsaf gravatar image wilkinsaf  ( 2021-05-04 11:41:19 -0500 )edit

It's not available in Eloquent and Foxy, you have to install Rolling/Galactic

soldierofhell gravatar image soldierofhell  ( 2021-05-04 15:48:01 -0500 )edit

Question Tools

2 followers

Stats

Asked: 2020-11-16 12:33:29 -0500

Seen: 1,316 times

Last updated: Nov 16 '20