-
Notifications
You must be signed in to change notification settings - Fork 253
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for replaying based on publication timestamp #1876
Conversation
I totally forgot to update the timestamp that the |
Signed-off-by: Christophe Bedard <[email protected]>
1183b7a
to
e4ddb48
Compare
Done. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@christophebedard Thank you for your contribution.
-
What is missing yet is the handling of the newly added
play_options.message_order
field in theget_play_options_from_node_params(..)
.
Please add conversion from node parameters into therosbag2_transport/src/rosbag2_transport/config_options_from_node_params.cpp
also, in tests in the https://github.com/ros2/rosbag2/blob/rolling/rosbag2_transport/test/rosbag2_transport/test_composable_player.cpp#L177-L181
and in the resource file https://github.com/ros2/rosbag2/blob/rolling/rosbag2_transport/test/resources/player_node_params.yaml#L40-L43 -
Also, I have a concern about naming
MessageOrder::RECV_TIMESTAMP
and wordingrecv
. As usual, the naming is hard. However, let's try to keep it more readable and understandable, especially the user-facing API.
I would like to ask you to rename all new declarations and usage of theRECV_TIMESTAMP
,recv
and corresponding CLI option to the more readable and understandablereceived
andRECEIVED_TIMESTAMP
.
I know you were trying to be consistent and follow the naming of the underlyingSerializedBagMessage::recv_timestamp
. However, in my opinion, this is not the case when we need to follow consistency and sacrifice readability and understandability.
Initially, we shortenedreceived_timestamp
to therecv_timestamp
to be aligned with its other counterpart,send_timestamp,
by the number of characters in names. And we did it for the following reasons:
- It looks nice in the code when those two variables are aligned by the length, for instance in ceases:
or
output_message->recv_timestamp = message->recv_timestamp; output_message->send_timestamp = message->send_timestamp;
const rcutils_time_point_value_t & recv_timestamp, const rcutils_time_point_value_t & send_timestamp);
- The
SerializedBagMessage::recv_timestamp
is part of therosbag2_storage
namespace and sort of implementation details, and it is used a lot, mostly on underneath layers.
Although with the PlayOptions::message_order
the situation is different.
- We expose it for users as a structure for Player settings.
- It is used mostly on upper layers
rosbag2_transport
androsbag2_py
- In the current implementation, there are no places where a nice alignment of the enum definition or CLI option would really matter or look nicer than without alignment.
Signed-off-by: Christophe Bedard <[email protected]>
Signed-off-by: Christophe Bedard <[email protected]>
Changed I'm a bit annoyed that we're using "received" (past tense) and "send" (present tense), but that's how the timestamps are named. |
Signed-off-by: Christophe Bedard <[email protected]>
Thanks, I missed that. I added that in c6f02bf |
Signed-off-by: Christophe Bedard <[email protected]>
@christophebedard As regards:
I agree. May I ask you to rename it to the past tense |
This reverts commit a1b2b07. Signed-off-by: Christophe Bedard <[email protected]>
Signed-off-by: Christophe Bedard <[email protected]>
Signed-off-by: Christophe Bedard <[email protected]>
Signed-off-by: Christophe Bedard <[email protected]>
Signed-off-by: Christophe Bedard <[email protected]>
done in 57970c0 |
|
I could mention this new change in that issue, since it affects it. Also, that reminds me of the logic for rosbag2/rosbag2_transport/src/rosbag2_transport/player.cpp Lines 429 to 435 in c8feaea
starting_time the recv_timestamp of the first message? Since we call reader->seek(starting_time_); and clock_->jump(starting_time_); before playing, but call clock_->jump(get_message_order_timestamp(message_ptr)); (which could use the send_timestamp ), couldn't that lead to incorrect replaying?
|
@christophebedard As regards:
No. The replaying order will be preserved. The worst case scenario would be when we do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@christophebedard Thank you for the PR and for addressing my review comments.
Now it looks good to me.
rosbag2_transport/test/rosbag2_transport/rosbag2_transport_test_fixture.hpp
Outdated
Show resolved
Hide resolved
Signed-off-by: Christophe Bedard <[email protected]>
Should I mention the new |
Oh yes, I completely forgot about readme file. Yes please update it. |
Signed-off-by: Christophe Bedard <[email protected]>
See 71474ca. I only documented the main options. |
Pulls: #1876 |
This PR adds support for replaying messages chronologically based on their publication timestamp, i.e.,
rosbag2_storage::SerializedBagMessage::send_timestamp
. To enable this, this PR adds a new enum option torosbag2_transport::PlayOptions
:MessageOrder message_order
. The possible enum values are:RECEIVED_TIMESTAMP
: order chronologically by message reception timestamp, which is the default and the current behaviourSENT_TIMESTAMP
: order chronologically by message publication timestampThis is exposed through
ros2 bag play
with a new--message-order {received,sent}
option. The choices correspond to theMessageOrder
values, withreceived
(RECEIVED_TIMESTAMP
) being the default.This relies on the
std::priority_queue
added in #1848 to order messages. Since there is a chance that messages could still not be correctly ordered (mostly withSENT_TIMESTAMP
), I mentioned it in the documentation forrosbag2_transport::PlayOptions::message_order
documentation and theros2 bag play
--message-order
option. I also mentioned increasing theread_ahead_queue_size
value as a possible solution.Note: This PR is not backportable since it has ABI incompatible changes, because we added a new field to the
rosbag2_transport::PlayOptions
structure and as a consequence changed the size of thePlayOptions
structure.