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

Ability to split already existing ros2 bags by time #599

Closed
Kaju-Bubanja opened this issue Jan 11, 2021 · 6 comments · Fixed by #1455
Closed

Ability to split already existing ros2 bags by time #599

Kaju-Bubanja opened this issue Jan 11, 2021 · 6 comments · Fixed by #1455
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@Kaju-Bubanja
Copy link
Contributor

Description

In rosbag there is the ability to split already existing bags by time. That functionality would be useful for ros2 as well.

Related Issues

None

Completion Criteria

  • A bag can be split by time

Implementation Notes / Suggestions

Check how it was done in rosbag and how it is currently done for bags which get split by time which are recorded live.

Testing Notes / Suggestions

Have a bag of 10s, split it after 5s to get 2 bags of 5s each.

@Kaju-Bubanja Kaju-Bubanja added the enhancement New feature or request label Jan 11, 2021
@emersonknapp emersonknapp added the help wanted Extra attention is needed label Jan 12, 2021
@vinnnyr
Copy link

vinnnyr commented Feb 21, 2021

@Kaju-Bubanja Can you please provide the example of the syntax the end user does to perform this in ROS1? I checked this wiki and could not identify this feature.

@Kaju-Bubanja
Copy link
Contributor Author

@Gilaadb
Copy link

Gilaadb commented Jan 19, 2023

As a workaround, in the mean time, I would recommend ros2bag_tools.
I looked for a way to cut a ros2 bag file to a shorter one, and it did just what I needed.

@emersonknapp
Copy link
Collaborator

emersonknapp commented Jan 20, 2023

This feature (as worded) is available in rosbag2 without external packages - seehttps://github.com/ros2/rosbag2#converting-bags for use of the ros2 bag convert command, which can provide the max_bagfile_duration argument for output bags.

However in verifying that this was so, I noticed that ros2 bag convert can't yet let you crop the time of a bagfile, writing out between start_time->end_time. This information is currently in PlayOptions struct (that you fill via ros2 bag play arguments), but that is not part of the convert process right now. Allowing for this would be a useful improvement to that feature!

(@Gilaadb ros2bag_tools looks like it has a lot of useful stuff, though! great idea using the verb extension point to add new commands)

@pfavr2
Copy link
Contributor

pfavr2 commented Sep 1, 2023

I would love to help implement convert-start-offset (similar to play offset). Currently trying to understand how the .py and .cpp work. Any help would be greatly appreciated?

pfavr2 added a commit to pfavr2/rosbag2 that referenced this issue Sep 3, 2023
resolves ros2#599

Signed-off-by: Peter Favrholdt <ros2github@how.dk>
MichaelOrlov pushed a commit that referenced this issue Sep 28, 2023
…1455)

* ros2 bag convert now excludes messages not in [start_time;end_time]
resolves #599

Signed-off-by: Peter Favrholdt <ros2github@how.dk>

* fix linelength and whitespace

Signed-off-by: Peter Favrholdt <ros2github@how.dk>

* minor fix warning %lld versus long int

Signed-off-by: Peter Favrholdt <ros2github@how.dk>

* Minor whitespace uncrustify fix

Signed-off-by: Peter Favrholdt <ros2github@how.dk>

* minor cpplint whitespace/indent change

Signed-off-by: Peter Favrholdt <ros2github@how.dk>

* minor whitespace fix

Signed-off-by: Peter Favrholdt <ros2github@how.dk>

* Remove dependency on rclcpp for sequential_writer by using uint64_t.
Moved timestamp check above Get TopicInformation
Added parsing test.

Signed-off-by: Peter Favrholdt <ros2github@how.dk>

* Remove superfluous dependency on rclcpp.

Signed-off-by: Peter Favrholdt <ros2github@how.dk>

* Add note that start_time_ns and end_time_ns are from storage_options.

Signed-off-by: Peter Favrholdt <ros2github@how.dk>

* Simplified message_within_accepted_time_range now uses int64_t.

Signed-off-by: Peter Favrholdt <ros2github@how.dk>

* whitespace fixes only

Signed-off-by: Peter Favrholdt <ros2github@how.dk>

* minor whitespace change

Signed-off-by: Peter Favrholdt <ros2github@how.dk>

* remove superfluous dependency on rclcpp from storage_sqlite3

Signed-off-by: Peter Favrholdt <ros2github@how.dk>

---------

Signed-off-by: Peter Favrholdt <ros2github@how.dk>
@ros-discourse
Copy link

This issue has been mentioned on ROS Discourse. There might be relevant details there:

https://discourse.ros.org/t/ros-2-tsc-meeting-minutes-2023-10-12/34178/1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants