ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
1 | initial version |
You can use the rosbags package: https://ternaris.gitlab.io/rosbags/
from rosbags.rosbag2 import Reader
from rosbags.serde import deserialize_cdr
# create reader instance and open for reading
with Reader('/home/ros/rosbag_2020_03_24') as reader:
# topic and msgtype information is available on .connections list
for connection in reader.connections:
print(connection.topic, connection.msgtype)
# iterate over messages
for connection, timestamp, rawdata in reader.messages():
if connection.topic == '/imu_raw/Imu':
msg = deserialize_cdr(rawdata, connection.msgtype)
print(msg.header.frame_id)