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

Pause and resume recording via service call. #1130

Closed
rshanor opened this issue Oct 18, 2022 · 4 comments · Fixed by #1131
Closed

Pause and resume recording via service call. #1130

rshanor opened this issue Oct 18, 2022 · 4 comments · Fixed by #1131
Labels
enhancement New feature or request

Comments

@rshanor
Copy link
Contributor

rshanor commented Oct 18, 2022

Recorder already has a pause and resume feature: #905
Feature would look a lot like the SplitBagfile service: #1115

Figured I would add a file rosbag2_interfaces/srv/EnableRecorder.srv that looks something like

bool is_enabled
---

@MichaelOrlov thoughts? My robot sits around running but not doing anything useful 90% of the time.

@rshanor rshanor added the enhancement New feature or request label Oct 18, 2022
@MichaelOrlov
Copy link
Contributor

@rshanor Agree that it would be nice to have such feature.
Please reuse interface and subset of APIs from rosbag2 player instead of creating new rosbag2_interfaces/srv/EnableRecorder.srv

srv_pause_ = create_service<rosbag2_interfaces::srv::Pause>(
"~/pause",
[this](
rosbag2_interfaces::srv::Pause::Request::ConstSharedPtr,
rosbag2_interfaces::srv::Pause::Response::SharedPtr)
{
pause();
});
srv_resume_ = create_service<rosbag2_interfaces::srv::Resume>(
"~/resume",
[this](
rosbag2_interfaces::srv::Resume::Request::ConstSharedPtr,
rosbag2_interfaces::srv::Resume::Response::SharedPtr)
{
resume();
});
srv_toggle_paused_ = create_service<rosbag2_interfaces::srv::TogglePaused>(
"~/toggle_paused",
[this](
rosbag2_interfaces::srv::TogglePaused::Request::ConstSharedPtr,
rosbag2_interfaces::srv::TogglePaused::Response::SharedPtr)
{
toggle_paused();
});
srv_is_paused_ = create_service<rosbag2_interfaces::srv::IsPaused>(
"~/is_paused",
[this](
rosbag2_interfaces::srv::IsPaused::Request::ConstSharedPtr,
rosbag2_interfaces::srv::IsPaused::Response::SharedPtr response)
{
response->paused = is_paused();
});

Also to accomplish this feature it would be nice to add bool start_paused flag to the RecordOptions and expose it as command line option. The same way as it was done for player.

// Start paused.
bool start_paused = false;

and
parser.add_argument(
'-p', '--start-paused', action='store_true', default=False,
help='Start the playback player in a paused state.')

@rshanor
Copy link
Contributor Author

rshanor commented Oct 18, 2022

Ack, I will work on getting this PRed soon. Thanks!

rshanor added a commit to rshanor/rosbag2 that referenced this issue Oct 19, 2022
Add service calls to pause recording and resume recording.

Fixes ros2#1130

Signed-off-by: Rick Shanor <rickshanor@gmail.com>
@MichaelOrlov
Copy link
Contributor

@rshanor Thank you. Your contribution very welcome.
We have this "feature" in our roadmap in ApexAI. But unfortunately I am very busy with other high priority tasks.
There are to much on my plate currently.

@MichaelOrlov
Copy link
Contributor

This feature will be very useful for distributed recording 😉

rshanor added a commit to rshanor/rosbag2 that referenced this issue Nov 5, 2022
Add service calls to pause recording and resume recording.

Fixes ros2#1130

Signed-off-by: Rick Shanor <rickshanor@gmail.com>
MichaelOrlov pushed a commit that referenced this issue Nov 5, 2022
* feat(recorder): Add pause and resume service calls.

Add service calls to pause recording and resume recording.

Fixes #1130

Signed-off-by: Rick Shanor <rickshanor@gmail.com>

* feat(recorder): pause, resume, and is_paused PR comments.

Address PR comments. Add is_paused service. Update tests accordingly.

Signed-off-by: Rick Shanor <rickshanor@gmail.com>

Signed-off-by: Rick Shanor <rickshanor@gmail.com>
haudren-woven pushed a commit to haudren-woven/rosbag2 that referenced this issue Aug 24, 2023
* feat(recorder): Add pause and resume service calls.

Add service calls to pause recording and resume recording.

Fixes ros2#1130

Signed-off-by: Rick Shanor <rickshanor@gmail.com>

* feat(recorder): pause, resume, and is_paused PR comments.

Address PR comments. Add is_paused service. Update tests accordingly.

Signed-off-by: Rick Shanor <rickshanor@gmail.com>

Signed-off-by: Rick Shanor <rickshanor@gmail.com>
tonynajjar pushed a commit to angsa-robotics/rosbag2 that referenced this issue Mar 11, 2024
* feat(recorder): Add pause and resume service calls.

Add service calls to pause recording and resume recording.

Fixes ros2#1130

Signed-off-by: Rick Shanor <rickshanor@gmail.com>

* feat(recorder): pause, resume, and is_paused PR comments.

Address PR comments. Add is_paused service. Update tests accordingly.

Signed-off-by: Rick Shanor <rickshanor@gmail.com>

Signed-off-by: Rick Shanor <rickshanor@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants