Skip to content

Conversation

@MichaelOrlov
Copy link
Contributor

@MichaelOrlov MichaelOrlov commented Sep 13, 2025

Description

Make the player respect the original messages' order with the same timestamp.
Note: The messages with the same recv_timestamps are a common situation when doing a recording with sim_time

Is this user-facing behavior change?

Yes. Playback will respect the originally saved messages' order even if messages have the same timestamps.
However, playback from multiple bags can't preserve the original order of messages with the same timestamps in different bags because we don't know which one was first during recording, although the order is at least the same for each playback.

Did you use Generative AI?

Yes, I am using GitHub Copilot, GPT-4.1 in my workflow.

Additional Information

N/A

- Add insertion sequence number to the LockedPriorityQueue to ensure
 that it can provide stable runtime sort algorithm.

Signed-off-by: Michael Orlov <morlovmr@gmail.com>
@MichaelOrlov MichaelOrlov changed the title Make the player respect the original messages' order with the same timestamp [draft] Make the player respect the original messages' order with the same timestamp Sep 13, 2025
@MichaelOrlov MichaelOrlov force-pushed the morlov/respect-msg-order-in-piority-queue branch from d91dd30 to bf14ecd Compare September 14, 2025 21:00
@MichaelOrlov MichaelOrlov marked this pull request as ready for review September 14, 2025 21:05
@MichaelOrlov MichaelOrlov changed the title [draft] Make the player respect the original messages' order with the same timestamp Make the player respect the original messages' order with the same timestamp Sep 14, 2025
@MichaelOrlov
Copy link
Contributor Author

cc: @DaleKoenig

MichaelOrlov added a commit that referenced this pull request Sep 14, 2025
Signed-off-by: Michael Orlov <michael.orlov@apex.ai>
Signed-off-by: Michael Orlov <michael.orlov@apex.ai>
MichaelOrlov added a commit that referenced this pull request Sep 19, 2025
* Bugfix: Player can't play with read_ahead_queue_size equal 1

Signed-off-by: Michael Orlov <morlovmr@gmail.com>

* Add missing deserialize_test_message() from #2172

Signed-off-by: Michael Orlov <michael.orlov@apex.ai>

* Address review comments

Co-Authored by: Christophe Bedard <bedard.christophe@gmail.com>

Co-authored-by: Christophe Bedard <bedard.christophe@gmail.com>
Signed-off-by: Michael Orlov <morlovmr@gmail.com>

---------

Signed-off-by: Michael Orlov <morlovmr@gmail.com>
Signed-off-by: Michael Orlov <michael.orlov@apex.ai>
Co-authored-by: Christophe Bedard <bedard.christophe@gmail.com>
mergify bot pushed a commit that referenced this pull request Sep 19, 2025
* Bugfix: Player can't play with read_ahead_queue_size equal 1

Signed-off-by: Michael Orlov <morlovmr@gmail.com>

* Add missing deserialize_test_message() from #2172

Signed-off-by: Michael Orlov <michael.orlov@apex.ai>

* Address review comments

Co-Authored by: Christophe Bedard <bedard.christophe@gmail.com>

Co-authored-by: Christophe Bedard <bedard.christophe@gmail.com>
Signed-off-by: Michael Orlov <morlovmr@gmail.com>

---------

Signed-off-by: Michael Orlov <morlovmr@gmail.com>
Signed-off-by: Michael Orlov <michael.orlov@apex.ai>
Co-authored-by: Christophe Bedard <bedard.christophe@gmail.com>
(cherry picked from commit 951d175)
mergify bot pushed a commit that referenced this pull request Sep 19, 2025
* Bugfix: Player can't play with read_ahead_queue_size equal 1

Signed-off-by: Michael Orlov <morlovmr@gmail.com>

* Add missing deserialize_test_message() from #2172

Signed-off-by: Michael Orlov <michael.orlov@apex.ai>

* Address review comments

Co-Authored by: Christophe Bedard <bedard.christophe@gmail.com>

Co-authored-by: Christophe Bedard <bedard.christophe@gmail.com>
Signed-off-by: Michael Orlov <morlovmr@gmail.com>

---------

Signed-off-by: Michael Orlov <morlovmr@gmail.com>
Signed-off-by: Michael Orlov <michael.orlov@apex.ai>
Co-authored-by: Christophe Bedard <bedard.christophe@gmail.com>
(cherry picked from commit 951d175)

# Conflicts:
#	rosbag2_transport/test/rosbag2_transport/rosbag2_transport_test_fixture.hpp
@MichaelOrlov
Copy link
Contributor Author

MichaelOrlov commented Sep 20, 2025

Pulls: #2172
Gist: https://gist.githubusercontent.com/MichaelOrlov/e5c50201d418c76d1b8b52e7d8c1eaad/raw/ef3b73d955f50d17110225dd5014a8f403966e61/ros2.repos
BUILD args: --packages-above-and-dependencies rosbag2_transport rosbag2_tests
TEST args: --packages-above rosbag2_transport rosbag2_tests
ROS Distro: rolling
Job: ci_launcher
ci_launcher ran: https://ci.ros2.org/job/ci_launcher/17035

  • Linux Build Status
  • Linux-aarch64 Build Status
  • Linux-rhel Build Status
  • Windows Build Status

@christophebedard
Copy link
Member

christophebedard commented Sep 22, 2025

I found the job that was retriggered for ci_linux-aarch64, but the ci_windows job wasn't automatically retriggered, so I did it manually.

@MichaelOrlov MichaelOrlov merged commit 6b462de into rolling Sep 22, 2025
12 checks passed
@MichaelOrlov MichaelOrlov deleted the morlov/respect-msg-order-in-piority-queue branch September 22, 2025 23:52
MichaelOrlov added a commit that referenced this pull request Sep 23, 2025
…2179)

* Bugfix: Player can't play with read_ahead_queue_size equal 1



* Add missing deserialize_test_message() from #2172



* Address review comments

Co-Authored by: Christophe Bedard <bedard.christophe@gmail.com>




---------




(cherry picked from commit 951d175)

Signed-off-by: Michael Orlov <morlovmr@gmail.com>
Signed-off-by: Michael Orlov <michael.orlov@apex.ai>
Co-authored-by: Michael Orlov <morlovmr@gmail.com>
Co-authored-by: Christophe Bedard <bedard.christophe@gmail.com>
MichaelOrlov added a commit that referenced this pull request Sep 23, 2025
…(backport #2174) (#2180)

* Bugfix: Player can't play with read_ahead_queue_size equal 1 (#2174)

* Bugfix: Player can't play with read_ahead_queue_size equal 1

Signed-off-by: Michael Orlov <morlovmr@gmail.com>

* Add missing deserialize_test_message() from #2172

Signed-off-by: Michael Orlov <michael.orlov@apex.ai>

* Address review comments

Co-Authored by: Christophe Bedard <bedard.christophe@gmail.com>

Co-authored-by: Christophe Bedard <bedard.christophe@gmail.com>
Signed-off-by: Michael Orlov <morlovmr@gmail.com>

---------

Signed-off-by: Michael Orlov <morlovmr@gmail.com>
Signed-off-by: Michael Orlov <michael.orlov@apex.ai>
Co-authored-by: Christophe Bedard <bedard.christophe@gmail.com>
(cherry picked from commit 951d175)

# Conflicts:
#	rosbag2_transport/test/rosbag2_transport/rosbag2_transport_test_fixture.hpp

* Address merge conflicts

Signed-off-by: Michael Orlov <michael.orlov@apex.ai>

* Adjust test for absence of the "play_options_.message_order"

Signed-off-by: Michael Orlov <michael.orlov@apex.ai>

---------

Signed-off-by: Michael Orlov <michael.orlov@apex.ai>
Co-authored-by: Michael Orlov <morlovmr@gmail.com>
@MichaelOrlov
Copy link
Contributor Author

https://github.com/Mergifyio backport kilted jazzy

@mergify
Copy link

mergify bot commented Sep 23, 2025

backport kilted jazzy

✅ Backports have been created

mergify bot pushed a commit that referenced this pull request Sep 23, 2025
…mestamp (#2172)

* Make player respect original msgs order with the same timestamp

- Add insertion sequence number to the LockedPriorityQueue to ensure
 that it can provide stable runtime sort algorithm.

Signed-off-by: Michael Orlov <morlovmr@gmail.com>

* Simplify comparator's API by hiding inner sequence number inside queue

Signed-off-by: Michael Orlov <michael.orlov@apex.ai>

---------

Signed-off-by: Michael Orlov <morlovmr@gmail.com>
Signed-off-by: Michael Orlov <michael.orlov@apex.ai>
(cherry picked from commit 6b462de)
mergify bot pushed a commit that referenced this pull request Sep 23, 2025
…mestamp (#2172)

* Make player respect original msgs order with the same timestamp

- Add insertion sequence number to the LockedPriorityQueue to ensure
 that it can provide stable runtime sort algorithm.

Signed-off-by: Michael Orlov <morlovmr@gmail.com>

* Simplify comparator's API by hiding inner sequence number inside queue

Signed-off-by: Michael Orlov <michael.orlov@apex.ai>

---------

Signed-off-by: Michael Orlov <morlovmr@gmail.com>
Signed-off-by: Michael Orlov <michael.orlov@apex.ai>
(cherry picked from commit 6b462de)

# Conflicts:
#	rosbag2_transport/src/rosbag2_transport/player.cpp
MichaelOrlov added a commit that referenced this pull request Sep 24, 2025
…mestamp (#2172) (#2187)

* Make player respect original msgs order with the same timestamp

- Add insertion sequence number to the LockedPriorityQueue to ensure
 that it can provide stable runtime sort algorithm.



* Simplify comparator's API by hiding inner sequence number inside queue



---------



(cherry picked from commit 6b462de)

Signed-off-by: Michael Orlov <morlovmr@gmail.com>
Signed-off-by: Michael Orlov <michael.orlov@apex.ai>
Co-authored-by: Michael Orlov <morlovmr@gmail.com>
MichaelOrlov added a commit that referenced this pull request Sep 26, 2025
… same timestamp (backport #2172) (#2188)

* Make the player respect the original messages' order with the same timestamp (#2172)

* Make player respect original msgs order with the same timestamp

- Add insertion sequence number to the LockedPriorityQueue to ensure
 that it can provide stable runtime sort algorithm.

Signed-off-by: Michael Orlov <morlovmr@gmail.com>

* Simplify comparator's API by hiding inner sequence number inside queue

Signed-off-by: Michael Orlov <michael.orlov@apex.ai>

---------

Signed-off-by: Michael Orlov <morlovmr@gmail.com>
Signed-off-by: Michael Orlov <michael.orlov@apex.ai>
(cherry picked from commit 6b462de)

# Conflicts:
#	rosbag2_transport/src/rosbag2_transport/player.cpp

* Address merge conflicts and code difference

Signed-off-by: Michael Orlov <michael.orlov@apex.ai>

---------

Signed-off-by: Michael Orlov <michael.orlov@apex.ai>
Co-authored-by: Michael Orlov <morlovmr@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Player does not preserve the order of messages with the same timestamp

3 participants