ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | Q&A
Ask Your Question

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']):

What is the ROS2 equivalent code?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

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


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

Your Answer

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

Add Answer

Question Tools



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

Seen: 985 times

Last updated: Nov 16 '20