-
Notifications
You must be signed in to change notification settings - Fork 913
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
ROSBAG: add snapshot subcommand #1414
Conversation
#!/usr/bin/env python | ||
# Software License Agreement (BSD License) | ||
# | ||
# Copyright (c) 2008, Open Source Robotics Foundation, Inc. |
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.
2018
The spelling of Though, I would actually just use |
2c8dd7f
to
fda4b36
Compare
@ironmig do you have any thoughts about this comment? |
That makes more sense to me, but it may be preferred to follow the convention established for that package (play.cpp player.cpp record.cpp recorder.cpp) |
fda4b36
to
4a4349d
Compare
Ah, that makes sense. I had seen the python file rosbag_main.py, but there is more of a pattern in the c++ code. |
Thanks for this feature @ironmig, it's very useful! Would the ros_comm maintainers consider merging it into melodic? |
This needs to be rebased to resolve merge conflicts. |
@kev-the-dev I'd be happy to if you don't have time. |
4a4349d
to
cedae13
Compare
cedae13
to
39144e2
Compare
I'm happy to see this through assuming it doesn't require a significant redesign. I rebased and squashed it. I'll look into the CI failures to see if they're trivial |
You can ignore the Noetic related CI results for now. Since not all dependencies of this repo have been released yet they are expected to fail. |
@ros-pull-request-builder retest this please |
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.
I am not sure that this 1.5k lines contribution should be merged into this repository. It adds another message (which will implicitly be part of ros_core
) as well as a new command which will implicitly be maintained by me (since you won't be easily able to watch for incoming issues related to it, create patches, and do releases on demand).
Therefore I am leaning towards suggesting to move the proposed implementation into a separate repository.
<name>rosbag_msgs</name> | ||
<version>1.0.0</version> | ||
<description>Service and message definitions for rosbag</description> | ||
<maintainer email="dthomas@osrfoundation.org">Dirk Thomas</maintainer> |
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.
Your name should be listed here.
<description>Service and message definitions for rosbag</description> | ||
<maintainer email="dthomas@osrfoundation.org">Dirk Thomas</maintainer> | ||
<license>BSD</license> | ||
<author>Kevin Allen</author> |
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.
Same here.
That's fair, it is a lot to ask to maintain this much new code in ros_comm. Another package is probably the best option. It might be a few weeks/months, but I'll start on that when I get the time |
We've been using this command for ~1 year at Locus, thanks for the contribution @kev-the-dev. |
There is a memory leak in A possible fix (albeit not a very nice one) is.
|
I am working on a refactor of this contribution to work as an independent package. Would it be possible to get https://github.com/ros/rosbag_snapshot willed into existence? |
@DLu I'd suggest you get it going locally and then we can transfer it into the organization. |
Assuming this feature will land in its own package I will go ahead and close this ticket. |
@tfoote After much ado, the package is now available: https://github.com/locusrobotics/rosbag_snapshot |
@tfoote Can you get it forked over at ros/rosbag_snapshot? Also, is there a proper organization for the release repository for something in |
We can fork it, but usually we prefer to transfer it so that we can keep the history of issues and PRs etc. This one doesn't have much history so that's not a big problem. One other thing about a fork is that apparently github search only searches the parent fork so if development is going to diverge it's better to transfer, or you have to request to "break the fork" from github customer service. If you transfer it to me I can then transfer it into the organization. For the gbp I can create one for you at in https://github.com/ros-gbp: https://github.com/ros-gbp/rosbag_snapshot-release |
I have requested the transfer. (You can only transfer from an organization to yourself, so I had to transfer it to DLu first, then to you) |
It's now here: https://github.com/ros/rosbag_snapshot |
This pull request has been mentioned on ROS Discourse. There might be relevant details there: |
Description
Addresses #1399 by adding a new subcommand,
rosbag snapshot
which acts similarly to the deprecatedrosrecord -s
command but with additional features. It seemed easier to me to implement this as a new subcommand rather than trying to add this torosbag record
without breaking API/ABI (I can still try that approach if it is preferred). It subscribes to topics and maintains a buffer of recent messages like a dash cam. This is useful in live testing where unexpected events can occur which would be useful to have data on but the opportunity is missed ifrosbag record
was not running (disk space limits make always runningrosbag record
impracticable). Instead, users may run snapshot in the background and save data from the recent past to disk as needed.Usage
rosbag snapshot
can be configured through command line flags and with ROS params for more granular control. By default, the command will run in server mode (buffering data). When certain flags are used, program will act as a client by requesting that the server write data to disk or freezing the buffer to preserve interesting data until a user can decide what to write.CLI usage
Hold a buffer of the last 30 seconds of data from selected topics until triggered to write
rosbag snapshot -d 30 /tf /odom /camera/image_color /camera/camera_info /velodyne_points
Buffer the most recent gigabyte of the following topics in the camera namespace
ROS_NAMESPACE=camera rosbag snapshot -s 1000 image_rect_color camera_info
Example launch file
Client examples
Write all buffered data to
<datatime>.bag
rosbag snapshot -t
Write buffered data from selected topics to
new_lighting<datatime>.bag
rosbag snapshot -t -o new_lighting /camera/image_raw /camera/camera_info
Write all buffered data to
/home/user/crashed_into_wall.bag
rosbag snapshot -t -O /home/user/crashed_into_wall
Pause buffering of new data, holding current buffer in memory until -t or -r is used
rosbag snapshot -p
Resume buffering new data
rosbag snapshot -r
Call trigger service manually, specifying absolute window start and stop time for written data
View status of buffered data (useful for future tools/GUI)