-
Notifications
You must be signed in to change notification settings - Fork 251
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 pause/resume options to the bag recorder #905
Add pause/resume options to the bag recorder #905
Conversation
Signed-off-by: Ivan Santiago Paunovic <ivanpauno@ekumenlabs.com>
Signed-off-by: Ivan Santiago Paunovic <ivanpauno@ekumenlabs.com>
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.
@ivanpauno Thanks for your contribution.
I think that paused_
defined as atomic<int>
is overkill and I don't see a real use case when it could be justified to use. I would propose to change it to the std::atomic<bool>
or std::atomic_bool
.
I would hide toggle_paused()
API as private method unless you need it outside. e.g. in Rqtbag. It's sort of ambiguous and difficult to determine an outcome from it and would be preferable to use pause
resume
explicitly outside of the Rosbag2.
I am also worry about recording termination by CRL+C
keyboard binding. As far as I understand, before start using KeyboardHandler in recording SIGINT
= CTRL+C
was handling somewhere inside Node
class and then re-translating to the SIGTERM
and we were catching and processing SIGTERM
in _transport.cpp.
However KeyboardHandler
override SIGINT
handler on construction and it looks like now rclcpp::shutdown();
will not be called and we will abnormally exit from process without properly finishing recording.
Interesting, I didn't thought about signal handling. |
Signed-off-by: Ivan Santiago Paunovic <ivanpauno@ekumenlabs.com>
Signed-off-by: Ivan Santiago Paunovic <ivanpauno@ekumenlabs.com>
Signed-off-by: Ivan Santiago Paunovic <ivanpauno@ekumenlabs.com>
I think it makes sense to offer the same API that the Player class uses. |
SIGINT isn't being retranslated to sigterm, the default rclcpp sigint signal handler is calling shutdown() asynchronously.
Yes, this is an issue. I will open a PR in the |
I think chaining signal handler would be a valid workaround. I can help with PR for |
@ivanpauno Wouldn't you mind to add at least one unit test to the https://github.com/ros2/rosbag2/blob/master/rosbag2_tests/test/rosbag2_tests/test_rosbag2_record_end_to_end.cpp |
@ivanpauno If you wouldn't mind I would suggest that I will take over issue relating to the signal handler in |
That sounds fine to me! |
…resume toggle key Signed-off-by: Ivan Santiago Paunovic <ivanpauno@ekumenlabs.com>
Signed-off-by: Ivan Santiago Paunovic <ivanpauno@ekumenlabs.com>
Signed-off-by: Ivan Santiago Paunovic <ivanpauno@ekumenlabs.com>
Test added in b6c35a6. |
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.
API looks good to me - I like a match with the Player. Sounds like you have the shutdown issue under control
@emersonknapp @ivanpauno I think we shouldn't merge this PR untill ros-tooling/keyboard_handler#10 will be merged, otherwise recording will be broken. |
Signed-off-by: Ivan Santiago Paunovic <ivanpauno@ekumenlabs.com>
Agreed, I will also have to update this PR to use the new signal handling options there. |
You can, but you don't have to. |
That's right, I forgot about that. |
@ivanpauno I see you have added unit test to cover keyboard press handling for pause/resume during recording. |
Signed-off-by: Ivan Santiago Paunovic <ivanpauno@ekumenlabs.com>
I'm having issues when running those tests locally, they always timeout even when using the Example output[==========] Running 16 tests from 1 test suite. I have added a |
The However - they are passing locally for me when built against master branch - I'm not sure what the issue is from the information you've provided. Are you building all of ros2 up to rosbag2, or are you building against something like Rolling? |
Yes, I'm doing that.
I have checked the output of the output
|
I'm inclined to move forward, given that everything is green. |
Agreed, I think it's ready to go |
Implements half of #558: ability to pause/resume recording.