Open AadityaRavindran opened 6 months ago
@AadityaRavindran But how to count the number of messages to record if multiple topics need to be recorded with different frequencies?
@AadityaRavindran But how to count the number of messages to record if multiple topics need to be recorded with different frequencies?
@MichaelOrlov Regardless of the different frequencies, it should record the same number of messages. If that means one of the topics will finish recording/playing back before other topics are recorded/played back, then that should be totally fine. Recording should stop after all specified topics have the specified number of messages each. Should have the same behavior as the ros1 version --limit argument http://wiki.ros.org/rosbag/Commandline#rosbag_record
@AadityaRavindran besides ROS 1 rosbag supports it, what use case do you have? i think this is reasonable option to have, but what could be the actual use case?
@AadityaRavindran besides ROS 1 rosbag supports it, what use case do you have? i think this is reasonable option to have, but what could be the actual use case?
@fujitatomoya I have integration tests where I need to record 1 message each of a few topics (Eg: the static map). These messages are used as inputs to gtest a class. I wrote my own bag recorder using rosbag2_cpp, but it would be extremely useful if I could generalize this to other gtests. I could write a generic bag recorder which takes in just 1 message of a list of topics, but if it was baked into rosbag2 cli, it would be helpful.
In general, if you have topic interfaces to a class, it's extremely useful to be able to write a unit/integration test (ros2 lifecycle nodes makes this easy to write and fast to run)
If there were multiple messages needed at different times or order, you would store 1 message each of the various topics in different bags, and play them back whenever needed by the test.
Description
rosbag record has an argument which records a limited number of messages of any topic(s). Eg:
rosbag record -l 1000 /chatter
Related Issues
Completion Criteria
ros2 bag record --limit <NUM> <topics>
Implementation Notes / Suggestions
https://github.com/ros/ros_comm/blob/noetic-devel/tools/rosbag/src/record.cpp#L62
Testing Notes / Suggestions