Scanner

ROS bag file sets

marv_robotics.bag.scan(dirpath, dirnames, filenames)[source]

Default scanner for ROS bag files

Bags suffixed with a consecutive index are grouped into sets:

foo_0.bag
foo_1.bag
foo_3.bag
foo_4.bag

results in:

foo   [foo_0.bag, foo_1.bag]
foo_3 [foo_3.bag]
foo_4 [foo_4.bag]

In this example the bag with index 2 is missing which results in foo_3 and foo_4 to be individual sets with one bag each.

The timestamps used by rosbag record are stripped from the name given to sets, but are kept for the remaining individual sets in case a bag is missing:

foo_2018-01-12-14-05-12_0.bag
foo_2018-01-12-14-45-23_1.bag
foo_2018-01-12-14-55-42_3.bag

results in:

foo [foo_2018-01-12-14-05-12_0.bag,
     foo_2018-01-12-14-45-23_1.bag]
foo_2018-01-12-14-45-23_1 [foo_2018-01-12-14-45-23_1.bag]
foo_2018-01-12-14-55-42_3 [foo_2018-01-12-14-55-42_3.bag]

For more information on scanners see marv.scanner.

Parameters:
  • dirpath (str) – The path to the directory currently being scanned.
  • dirnames (str) – Sorted list of subdirectories of the directory currently being scanned. Change this in-place to control further traversal.
  • filenames (str) – Sorted list of files within the directory currently being scanned.
Returns:

A list of marv.scanner.DatasetInfo instances mapping set of files to dataset names. Absolute filenames must start with dirpath, relative filenames are automatically prefixed with it.

See scanner config key.