Scanner

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

Scan for directories containing bags (ROS1 and ROS2).

For rosbag2 datasets this scanner behaves identical to default scan() below.

For ROS1 bag files it looks for directories containing at least one bag file and will create a dataset with all files contained, ignoring further subdirectories, including rosbag2 datasets; warnings are logged if any such subdirectories are ignored.

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

Scan for sets of ROS bag files (ROS1 and ROS2).

Find rosbag2 datasets and log warnings if they contain additional files, not listed in metadata.yaml

The remainder is for sets of ROS1 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_api.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_api.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.