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

Progress-bar for ros2 bag play #1836

Open
wants to merge 36 commits into
base: rolling
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 12 commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
616df0d
Start adding progress-bar for ros2 bag play
nicolaloi Oct 15, 2024
2cb732d
clean #include
nicolaloi Oct 15, 2024
4ba1a8c
remove new progress bar class, integrate functionality in PlayerImpl
nicolaloi Oct 20, 2024
a00bdc4
convert to template
nicolaloi Oct 23, 2024
43fa0f8
Code review
nicolaloi Oct 28, 2024
9cdf5ad
update default rate
nicolaloi Nov 10, 2024
bac4e9f
update to avoid synchronization issues
nicolaloi Nov 17, 2024
0c99597
add burst status, reduce cout setprecision
nicolaloi Nov 18, 2024
372b8a2
Merge branch 'rolling' into nicolaloi/bag-play-progress-bar
nicolaloi Dec 2, 2024
6051e6c
some updates after merge with rolling
nicolaloi Dec 2, 2024
0ef3f26
comments
nicolaloi Dec 4, 2024
47dff3d
Progress bar with nanosecond precision and shorter length
nicolaloi Dec 5, 2024
19df032
change progress bar string, change 'frequency' terms to 'update rate'
nicolaloi Dec 6, 2024
fb464b0
comments
nicolaloi Dec 6, 2024
6a47a7f
Merge branch 'rolling' into nicolaloi/bag-play-progress-bar
nicolaloi Dec 8, 2024
8625164
add custom space between playback output and progress bar
nicolaloi Dec 8, 2024
913de31
stubgen
nicolaloi Dec 8, 2024
5ed1994
Add test_xmllint.py to python packages. (#1879)
clalancette Dec 10, 2024
ab7cd93
Add more logging info to storage and reader/writer open operations (#…
MichaelOrlov Dec 12, 2024
79ae2d0
Increase timeout to 180s for test_rosbag2_record_end_to_end (#1889)
Yadunund Dec 28, 2024
a7aa5f0
Bugfix. Event publisher not starting for second run after stop (#1888)
MichaelOrlov Dec 30, 2024
1f99a37
Bugfix: Recorder discovery does not restart after being stopped (#1894)
oysstu Jan 22, 2025
6e75a9d
Change type of progress_bar_update_rate to int32_t
MichaelOrlov Jan 11, 2025
ec11778
Remove "in_burst_mode" from play_next() method
MichaelOrlov Jan 11, 2025
510a248
Move progress bar to a separate PlayerProgressBar class
MichaelOrlov Jan 25, 2025
681c1ed
Move PlayerStatus inside PlayerProgressBar
MichaelOrlov Jan 26, 2025
3a8301b
Move PlayerProgressBar class to a separate h(c)pp files
MichaelOrlov Jan 26, 2025
bb8dc2a
Use Pimpl design pattern for PlayerProgressBar class
MichaelOrlov Jan 26, 2025
8798397
Replace logger and std::cout with reference to the std::ostream
MichaelOrlov Jan 26, 2025
8e45042
Use std::stringstream and rdbuf() to avoid extra data copy to string
MichaelOrlov Jan 26, 2025
295e137
Change type of the `progress_bar_separation_lines` to the `uint32_t`
MichaelOrlov Jan 26, 2025
36e07c5
Simplify logic by using update period in milliseconds
MichaelOrlov Jan 26, 2025
3709879
Regenerate pyi stub files
MichaelOrlov Jan 26, 2025
2f6e66b
Add test_player_progress_bar.cpp with TODOs
MichaelOrlov Jan 26, 2025
74bc915
Add some unit tests
nicolaloi Jan 30, 2025
0995532
Merge branch 'rolling' into nicolaloi/bag-play-progress-bar
nicolaloi Jan 30, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions docs/design/rosbag2_record_replay_service.md
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,10 @@ Added or changed parameters:

Rename from `--exclude`. Exclude topics and services containing provided regular expression.

- `--progress-bar [ProgressBarFrequency]`

Print a progress bar of the playback player at a specific frequency in Hz. Negative values mark an update for every published message, while a zero value disables the progress bar. Default to a positive low value.

`-e REGEX, --regex REGEX` affects both topics and services.

## Implementation Staging
Expand Down
8 changes: 8 additions & 0 deletions ros2bag/ros2bag/verb/play.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,13 @@ def add_arguments(self, parser, cli_name): # noqa: D102
'--log-level', type=str, default='info',
choices=['debug', 'info', 'warn', 'error', 'fatal'],
help='Logging level.')
parser.add_argument(
'--progress-bar', type=float, default=3.0,
help='Print a progress bar of the playback player at a specific frequency in Hz. '
'Default is %(default)d. '
'Negative values mark an update for every published message, while '
' a zero value disables the progress bar.',
metavar='PROGRESS_BAR_FREQUENCY')

def get_playback_until_from_arg_group(self, playback_until_sec, playback_until_nsec) -> int:
nano_scale = 1000 * 1000 * 1000
Expand Down Expand Up @@ -275,6 +282,7 @@ def main(self, *, args): # noqa: D102
play_options.service_requests_source = ServiceRequestsSource.SERVICE_INTROSPECTION
else:
play_options.service_requests_source = ServiceRequestsSource.CLIENT_INTROSPECTION
play_options.progress_bar_print_frequency = args.progress_bar

player = Player(args.log_level)
try:
Expand Down
1 change: 1 addition & 0 deletions rosbag2_py/rosbag2_py/_transport.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ class PlayOptions:
node_prefix: str
playback_duration: float
playback_until_timestamp: int
progress_bar_print_frequency: float
publish_service_requests: bool
rate: float
read_ahead_queue_size: int
Expand Down
1 change: 1 addition & 0 deletions rosbag2_py/src/rosbag2_py/_transport.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -556,6 +556,7 @@ PYBIND11_MODULE(_transport, m) {
"playback_until_timestamp",
&PlayOptions::getPlaybackUntilTimestamp,
&PlayOptions::setPlaybackUntilTimestamp)
.def_readwrite("progress_bar_print_frequency", &PlayOptions::progress_bar_print_frequency)
.def_readwrite("wait_acked_timeout", &PlayOptions::wait_acked_timeout)
.def_readwrite("disable_loan_message", &PlayOptions::disable_loan_message)
.def_readwrite("publish_service_requests", &PlayOptions::publish_service_requests)
Expand Down
3 changes: 3 additions & 0 deletions rosbag2_transport/include/rosbag2_transport/play_options.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,9 @@ struct PlayOptions

// The source of the service request
ServiceRequestsSource service_requests_source = ServiceRequestsSource::SERVICE_INTROSPECTION;

// Rate in Hz at which to print progress bar.
double progress_bar_print_frequency = 3.0;
};

} // namespace rosbag2_transport
Expand Down
5 changes: 5 additions & 0 deletions rosbag2_transport/src/rosbag2_transport/play_options.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ Node convert<rosbag2_transport::PlayOptions>::encode(

node["disable_loan_message"] = play_options.disable_loan_message;

node["progress_bar_print_frequency"] = play_options.progress_bar_print_frequency;

return node;
}

Expand Down Expand Up @@ -114,6 +116,9 @@ bool convert<rosbag2_transport::PlayOptions>::decode(

optional_assign<bool>(node, "disable_loan_message", play_options.disable_loan_message);

optional_assign<double>(
node, "progress_bar_print_frequency", play_options.progress_bar_print_frequency);

return true;
}

Expand Down
Loading
Loading