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] Add "--sort" CLI option to the "ros2 bag info" command (backport #1804) #1838

Merged
merged 3 commits into from
Dec 2, 2024

Conversation

mergify[bot]
Copy link

@mergify mergify bot commented Oct 17, 2024

This PR adds the "--sort" CLI option to the "ros2 bag info" command. With "--sort" CLI option user will be able to sort topics and services by name, topic type or number of recorded messages.

  • generate sorted indices for topics from multiple different options (topic name, type, count or serialization format)
  • defaults to sorting by topic name
  • use sorted indices rather than using strict increasing indices for printing out the topics
  • potential use of different sorting options through CLI by passing sort_method argument to format_topics_with_type function

This is an automatic backport of pull request #1804 done by [Mergify](https://mergify.com).

@mergify mergify bot added the conflicts label Oct 17, 2024
@mergify mergify bot requested a review from a team as a code owner October 17, 2024 05:06
@mergify mergify bot removed the request for review from a team October 17, 2024 05:06
Copy link
Author

mergify bot commented Oct 17, 2024

Cherry-pick of 25304dd has failed:

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

You are currently cherry-picking commit 25304dd3.
  (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/CMakeLists.txt
	new file:   rosbag2_py/src/rosbag2_py/info_sorting_method.cpp
	new file:   rosbag2_py/src/rosbag2_py/info_sorting_method.hpp
	new file:   rosbag2_py/src/rosbag2_py/service_event_info.hpp
	modified:   rosbag2_tests/test/rosbag2_tests/test_rosbag2_info_end_to_end.cpp

Unmerged paths:
  (use "git add <file>..." to mark resolution)
	both modified:   ros2bag/ros2bag/verb/info.py
	both modified:   rosbag2_py/rosbag2_py/_info.pyi
	both modified:   rosbag2_py/src/rosbag2_py/_info.cpp
	both modified:   rosbag2_py/src/rosbag2_py/format_bag_metadata.cpp
	both modified:   rosbag2_py/src/rosbag2_py/format_bag_metadata.hpp
	both modified:   rosbag2_py/src/rosbag2_py/format_service_info.cpp
	both modified:   rosbag2_py/src/rosbag2_py/format_service_info.hpp

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 MichaelOrlov and hidmic October 17, 2024 05:07
@MichaelOrlov MichaelOrlov changed the title Add "--sort" CLI option to the "ros2 bag info" command (backport #1804) [jazzy] Add "--sort" CLI option to the "ros2 bag info" command (backport #1804) Oct 17, 2024
* sort info output by topic name

Signed-off-by: Soenke Prophet <[email protected]>

* add missing imports

Signed-off-by: Soenke Prophet <[email protected]>

* add sorting to service topics and remove sorting option by serialization format

Signed-off-by: Soenke Prophet <[email protected]>

* add CLI option for sorting output and move sorting methods to enum

Signed-off-by: Soenke Prophet <[email protected]>

* add sorting by name to topic only option of info output

Signed-off-by: Soenke Prophet <[email protected]>

* move InfoSortingMethod and generate sorted idx functions to seprate files; move ServiceInformation and ServiceMetadata struct to storage package for clear include structure

Signed-off-by: Soenke Prophet <[email protected]>

* move ServiceInformation struct to its own header file and rename to ServiceEventInformation; replace if-else by switch-case for differantiating between sorting methods; bugfix sorting method from string resolution and service info verbose not being sorted

Signed-off-by: Soenke Prophet <[email protected]>

* add test-cases for sorted info output

Signed-off-by: Soenke Prophet <[email protected]>

* Fix linker issues

- Add missing const qualifier for the generate_sorted_idx(..) version
with rosbag2_cpp::rosbag2_service_info_t
- Small cleanups

Signed-off-by: Michael Orlov <[email protected]>

* Regenerate pyi stub files

Signed-off-by: Michael Orlov <[email protected]>

* Small nitpick for using const reference in the for loop

Signed-off-by: Michael Orlov <[email protected]>

---------

Signed-off-by: Soenke Prophet <[email protected]>
Signed-off-by: Michael Orlov <[email protected]>
Co-authored-by: Soenke Prophet <[email protected]>
Co-authored-by: Michael Orlov <[email protected]>
@MichaelOrlov MichaelOrlov force-pushed the mergify/bp/jazzy/pr-1804 branch from 4e5e021 to 3de438a Compare December 2, 2024 17:17
- On Jazzy parameters in the "format_bag_meta_data(..)" has a different
order. The "sizes" at the end. Changed calling function accordingly.

Signed-off-by: Michael Orlov <[email protected]>
- Add default value for newly added argument "sorting_method" in
"print_output(..)" and "print_output_verbose(..)"

Signed-off-by: Michael Orlov <[email protected]>
@MichaelOrlov MichaelOrlov force-pushed the mergify/bp/jazzy/pr-1804 branch from 3de438a to 27a280e Compare December 2, 2024 17:18
@MichaelOrlov MichaelOrlov self-assigned this Dec 2, 2024
Copy link
Contributor

@MichaelOrlov MichaelOrlov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I made this PR API/ABI compatible by adding a default value for the newly added argument "sorting_method" in
"print_output(..)" and "print_output_verbose(..)"

@MichaelOrlov
Copy link
Contributor

Pulls: #1838
Gist: https://gist.githubusercontent.com/MichaelOrlov/891990f4749462d21f0fa893c767bb21/raw/5458c816ad2d8c1330591a7741cec8fd434b864a/ros2.repos
BUILD args: --packages-above-and-dependencies ros2bag rosbag2_py rosbag2_tests
TEST args: --packages-above ros2bag rosbag2_py rosbag2_tests
ROS Distro: jazzy
Job: ci_launcher
ci_launcher ran: https://ci.ros2.org/job/ci_launcher/14887

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

@MichaelOrlov MichaelOrlov merged commit 47c5c53 into jazzy Dec 2, 2024
12 checks passed
@MichaelOrlov MichaelOrlov deleted the mergify/bp/jazzy/pr-1804 branch December 2, 2024 20:14
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