Skip to content
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

[jazzy] Upstream quality changes from Apex.AI part 1 (backport #1903) #1909

Merged
merged 2 commits into from
Feb 10, 2025

Conversation

mergify[bot]
Copy link

@mergify mergify bot commented Feb 6, 2025

This PR consolidates fixes related to the code quality and stability after backporting Rosbag2 PRs to Apex.AI. PART 1

List of changes:

  1. Fix for memory leaks in tests
    Details: Need to use custom deleter when releasing rcl serialized buffer to a shared pointer.
  2. Move wait_for_playback_to_start() to public section
    • Rationale: Need to use in another package
    • Also added timeout parameter for the wait_for_playback_to_start(..) to make it non-blocking call optionally and return boolean value.
  3. Gracefully handle exceptions from on-play callbacks in player
    Rationale: Avoid abnormal termination in case of unhandled exceptions happening in callbacks.
  4. Address Axivion warnings in rosbag2_py
    Description:
    1. MisraC++2023-8.1.1 [required]: _transport.cpp:286 This variable shall not be implicitly captured in a lambda expression.; Field: []
    2. MisraC++2023-8.2.3 [required]: _transport.cpp:50 Cast removes const qualification; Field: [const char*->char*]
  5. Fix the clang16 warning that the timestamp comparator is not initialized
  6. Make sure to start with a clean subscriptions list in Recorder::record()
    Rationale: It could be some residual subscriptions in the list in case if the previous call to Recorder::record() failed for some reason and Recorder::stop() wasn't called.
  7. Call discovery_future_.get() if it's ready in the stop_discovery()
  8. Use absolute path instead of relative path in the InfoEndToEndTestFixture
  9. Don't keep trying to publish the next message if we fail the first time. The Player::play_next() should return false right away if, for some reason, failed to publish the current message.
    This is an automatic backport of pull request Upstream quality changes from Apex.AI part 1 #1903 done by Mergify.

* Make sure to start with clean subscriptions list in Recorder::record()

- It could be some residual subscriptions in list in case if previous
call to Recorder::record() failed for some reason and Recorder::stop()
wasn't called.

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

* Fix clang16 warning that timestamp comparator is not initialized

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

* Address Axivion warnings in rosbag2_py

1. MisraC++2023-8.1.1 [required]: _transport.cpp:286 This variable shall
 not be implicitly captured in a lambda expression.; Field: []
2. MisraC++2023-8.2.3 [required]: _transport.cpp:50
 Cast removes const qualification; Field: [const char*->char*]

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

* Gracefully handle exceptions from on-play callbacks in player

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

* Move wait_for_playback_to_start() to public section

- Rationale: Need to use in another package
- Added timeout parameter for the wait_for_playback_to_start(..) to make
it non-blocking call optionally and return boolean value.

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

* Fix memory leaks in tests

- Use custom deleter when releasing rcl serialized buffer to a shared
pointer.

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

* Don't keep trying to publish next message if we failed first time

- The Player::play_next() should return false right away if for some
reason failed to publish current message.

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

* Wrap run_play_msg_pre_callbacks(message) in its own try-catch

- Also added `play_next_returns_false_if_pre_callback_throw_exception`
unit test.

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

* Use absolute path instead of relative path in the InfoEndToEndTestFixture

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

* Call discovery_future_.get() if it's ready in the `stop_discovery()`

- Also add missing `include <unordered_set>`

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

* Move wait_for_playback_to_start(..) declaration and fixed wording

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

---------

Signed-off-by: Michael Orlov <michael.orlov@apex.ai>
(cherry picked from commit 871a447)

# Conflicts:
#	rosbag2_transport/src/rosbag2_transport/player.cpp
@mergify mergify bot requested a review from a team as a code owner February 6, 2025 21:08
@mergify mergify bot added the conflicts label Feb 6, 2025
Copy link
Author

mergify bot commented Feb 6, 2025

Cherry-pick of 871a447 has failed:

On branch mergify/bp/jazzy/pr-1903
Your branch is up to date with 'origin/jazzy'.

You are currently cherry-picking commit 871a447.
  (fix conflicts and run "git cherry-pick --continue")
  (use "git cherry-pick --skip" to skip this patch)
  (use "git cherry-pick --abort" to cancel the cherry-pick operation)

Changes to be committed:
	modified:   rosbag2_py/src/rosbag2_py/_transport.cpp
	modified:   rosbag2_storage_mcap/test/rosbag2_storage_mcap/test_mcap_storage.cpp
	modified:   rosbag2_test_common/include/rosbag2_test_common/memory_management.hpp
	modified:   rosbag2_tests/test/rosbag2_tests/test_rosbag2_info_end_to_end.cpp
	modified:   rosbag2_transport/include/rosbag2_transport/player.hpp
	modified:   rosbag2_transport/src/rosbag2_transport/recorder.cpp
	modified:   rosbag2_transport/test/rosbag2_transport/test_play_next.cpp

Unmerged paths:
  (use "git add <file>..." to mark resolution)
	both modified:   rosbag2_transport/src/rosbag2_transport/player.cpp

To fix up this pull request, you can check it out locally. See documentation: https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/reviewing-changes-in-pull-requests/checking-out-pull-requests-locally

@mergify mergify bot requested review from james-rms and jhdcs and removed request for a team February 6, 2025 21:08
@MichaelOrlov MichaelOrlov changed the title Upstream quality changes from Apex.AI part 1 (backport #1903) [jazzy] Upstream quality changes from Apex.AI part 1 (backport #1903) Feb 6, 2025
- Adjust for missing "Replay by sent timestamp" feature on Jazzy.

Signed-off-by: Michael Orlov <michael.orlov@apex.ai>
@MichaelOrlov
Copy link
Contributor

Pulls: #1909
Gist: https://gist.githubusercontent.com/MichaelOrlov/81ff00abae0fa1fe751c971e1446e0ea/raw/5aa04dbab9c2ec17e884015ddc93bf9256f48bdc/ros2.repos
BUILD args: --packages-above-and-dependencies rosbag2_transport rosbag2_py rosbag2_storage_mcap rosbag2_test_common rosbag2_tests
TEST args: --packages-above rosbag2_transport rosbag2_py rosbag2_storage_mcap rosbag2_test_common rosbag2_tests
ROS Distro: jazzy
Job: ci_launcher
ci_launcher ran: https://ci.ros2.org/job/ci_launcher/15142

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

@MichaelOrlov MichaelOrlov merged commit 43cbf33 into jazzy Feb 10, 2025
12 checks passed
@MichaelOrlov MichaelOrlov deleted the mergify/bp/jazzy/pr-1903 branch February 10, 2025 19:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant