Ask Your Question
0

ROS2 rosbag2 read bag file

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

waspinator gravatar image

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

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 -0600

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 -0600 )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 -0600 )edit

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: 2020-11-16 12:33:29 -0600

Seen: 385 times

Last updated: Nov 16 '20