rosbag2
rosbag2 copied to clipboard
Duration in metadata.yaml is wrong when bag is split by time and size (humble)
Description
When recording a bag in humble, I expect the metadata.yaml duration field to be equal to last_message_timestamp - first_message_timestamp. However, it is set to whatever the split duration is when splitting by time, and some function of the split duration when splitting by size.
Expected Behavior
Record a bag for 30 seconds split at 5 second intervals. Metadata.yaml duration is 30 * 1e9
command I use ros2 bag record -a -d 5 -b 86016
Actual Behavior
Record a bag for 30 seconds with ros2 bag record -a -d 5 -b 86016
Inspect metadata.yaml. Duration is 5 * 1e9, the length of the split.
To Reproduce
** Steps to reproduce the behavior, e.g.
- Go to '...'
- Click on '....'
- Scroll down to '....'
- Logs print error '...' **
Terminal 1:
ros2 topic pub /foobar std_msgs/msg/Empty "{}"
Terminal 2:
ros2 bag record -a -d 5 -b 86016
wait 30 seconds. stop the bag. inspect.
System (please complete the following information)
- OS: Ubuntu Jammy
- ROS 2 Distro: Humble
- Version: Latest from APT
Additional context
We use a backport to foxy which shows this behavior in rosbag2, but that isn't a surprise as its the same codebase.