-
Notifications
You must be signed in to change notification settings - Fork 255
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
Snapshot should write to a different file every time it is triggered #1099
Comments
I second this feature request. This seems helpful. |
+1 |
Note - the recorder does provide the service |
Shall we extend the
To this?
In line with this: https://github.com/ros/rosbag_snapshot/blob/main/rosbag_snapshot_msgs/srv/TriggerSnapshot.srv We probably need to come up with a way to append the timestamp as well. Perhaps if we enter something like |
@Timple Extend |
I guess I'm surprised that just adding the ability to name the file seems not trivial to implement. But I have no knowledge of the structure of the code. |
Would it make sense to align on the service call syntax already? ROS2 Jade is coming up, and changing a service after release won't be possible I guess. Implementation can then be worked on after the interface is agreed. |
Yes, it would make sense on the service call syntax. Was there a proposal for an updated syntax? |
Hi all, Thanks for all the information so far. I've read this issue and studied this PR with all its comments. Based on this info and fiddling a bit in the
I rapidly implemented this and this seemed to work. This will give the following output:
@bijoua29 @dkorenkovnl @Timple @MichaelOrlov could you give your feedback on this approach before I send a PR? Thanks! |
@reinzor That is one more very hacky way to implement this feature.
|
Thanks for your feedback @MichaelOrlov ; could you perhaps point me in the right direction for this implementation? Regarding point 1, what would be your suggestion instead of renaming? As far as I know, the name of the file is already defined when starting the record so if we would like the snapshot to have a specific filename, this would not be possible. We could maybe add some additional data to the |
I believe #1584 was a step in that direction. However some workarounds where proposed there and now it's closed. @MichaelOrlov you seem to be most familiar with the codebase in this thread. Would it be possible to write up a small set of steps to take to tackle this issue? |
I am sorry folks, I am currently kinda busy with Jazzy release preparation. A lot of PRs and other things need to wrap up. |
I'm not quite sure why the bagfile is already open actually. Because that is where this problem is originating from. Why not open it upon receiving a snapshot request? |
sounds reasonable, file should be named and created upon snapshot capture request by user. but i am not sure how we can deal with |
@fujitatomoya @MichaelOrlov How can we best continue with this implementation. There appears to be a lot of interest in this functionality together with a fixed duration for a bag file. We can help in the implementation but this would require some pointing in the correct direction. Let us know :). |
@reinzor @MichaelOrlov @Timple just a question though, do we need to support both |
@fujitatomoya Yes, I would expect snapshot for a certain cache size or duration. So I wouldn't expect or need the snapshot to be split. |
@bijoua29 We need to move the completion criteria
to a separate issue with feature request. |
Our use-case: In the case of a event (e.g. robot collision) we want to have a snapshot of (almost) all data available. Single fileThis snapshot should be a single rosbag. Having 12 snapshots in a single file still makes this file hard to offload from the robot. Also it's hard to link this file to an event as it contains multiple. Also closing the file makes for other synchronization services to kick-in. If the file keeps being open for the duration of the robots uptime, we would not be able to offload it until the next reboot. File namesIdeally we can also control the name of the bagfile. Such that it can be easier linked with events. Although this can also be solved with metadata inside the bagfile. DurationHaving a fixed duration (like 30seconds) makes more sense for our usecase than say (1gb of data). Because the amount of data can verify. And will most likely increase as our software evolves, making the bagfiles shorter. Not all three points might belong to this issue, but I thought I'd fully clarify our usecase. Edit: Appendix: We also record all data on our machines. With a cleanup script to prevent the disk getting full. Currently there is quite a CPU hog as all data is received twice (once per bag process). If the standard bag service would provide snapshot feature alongside it's standard recording, that would be awesome! Although I currently have no idea how this would look like, so might be far-fetched. |
Hi @Timple, Thank you for posting real use cases. Your feedback is precious.
We meant that it shouldn't happen As regards filenames. I looked at the code yesterday, and I can say that it is possible to implement a custom name for the snapshot file. We can correct the file name in metadata before saving and rename file at the right moment after the closing it. I understand that users want to somehow tag the snapshot and know the recorded filename.
The request for a fixed snapshot duration is valid and desirable for almost everybody. However, it is not easy to implement with the current design. We are bound by the double buffering, lock-free scheme with the fixed size on the As regards to the proposal of saving snapshot during normal recording. It is hard to implement and will likely require a similar amount of additional CPU resources as if running one more instance of the rosbag recorder in parallel. BTW liikely it will be possible to reduce the CPU burden by disabling discovery in the recorder or increasing the timeout for it via CLI option. |
@MichaelOrlov That's fine to move this to a separate issue. Regarding the options you propose for filename, I'm fine with option 3 where it returns the filename in the service response. I assume the service response is returned after the file is written to disk so I can safely rename the file if I so choose. |
Hi @bijoua29, Option 3, returning the filename, as a service response may not work for all use cases. However, at least one corner case exists. When we enable per-file compression and use The most robust way to know when and what filename is available after trigering a snapshot is the option 2.
|
Hi @reinzor. You were asking how to move forward with the implementation of snapshot writing for the different files and the time-bounded snapshot features. And also were willing to help with it. The first item Make snapshot writing into a new file each time it is triggered has been done and recently merged to rolling. It was a smooth backport to the jazzy but with some hiccups on Windows CI. However, the backport to the Humble needs to be adjusted. I've made good progress on the second item The time bounded snapshot feature #1844. I've made all the required changes for this feature. However, I didn't have time to test it and write unit tests. |
Description
When you trigger multiple snapshots through the service call, each snapshot data is written to the same file. This is not very useful for multiple snapshots.
The typical use-case for the snapshot feature is to save a snapshot when the user see something "interesting". This might happen multiple times. Usually triggering a snapshot is not always a one-time event.
Related Issues
N/A
Completion Criteria
Implementation Notes / Suggestions
N/A
Testing Notes / Suggestions
N/A
The text was updated successfully, but these errors were encountered: