Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This adds support for replaying multiple bags with
ros2 bag play
and the underlying classes (rosbag2_transport::Player
/rosbag2_py::Player
).To replay multiple bags:
Messages are played in order, based on their
recv_timestamp
(recorder reception timestamp).rosbag2_transport::Player
uses a simple implementation of a priority queue to select the "next" message from all input bags. This does assume that the messages in each bag are ordered byrecv_timestamp
.Note that the priority queue implementation does require locking, but the "ordering" it does is very simple given the aforementioned ordering assumption. However, I did make it consider the trivial case where there's only 1 underlying queue (i.e., input bag), in which case there is no need to track priorities and thus no need for locking. Furthermore, this priority queue does not support actually ordering messages, e.g., to re-order an input bag's messages by
send_timestamp
.Other notes:
ros2 bag convert
, I added the-i, --input
option that takes a bag URI and an optional explicit storage ID. This option can be used multiple times for multiple bags.bag_path
positional argument (but made it optional) because it is quite nice to be able to just doros2 bag play my-bag
. However, I deprecated the storage ID option (--storage
); users will have to use-i, --input
to specify an explicit storage ID for an input bag.rosbag2_transport::Player::get_storage_options()
to make it return astd::vector<rosbag2_storage::StorageOptions>
. This is apparently only used in tests. I also brokerosbag2_py::Player::play_impl()
, but it apparently onlyprotected
(and notprivate
) for testing purposes.