cras_bag_tools package

Submodules

cras_bag_tools.topic_set module

Efficient data structure to hold a static set of topics with super-fast is-in-set queries.

The querying is done using expressions like topic in set or topic not in set.

class cras_bag_tools.topic_set.TopicSet(items=None)

Bases: object

Efficient data structure to hold a static set of topics with super-fast is-in-set queries.

Build the data structure. Adding items later is not supported.

Parameters:items (Iterable[AnyStr]|None) – The topics to search.

cras_bag_tools.tqdm_bag module

Bag file reader that shows progressbars when loading index or reading messages.

class cras_bag_tools.tqdm_bag.TqdmBag(f, mode='r', compression='none', chunk_threshold=786432, allow_unindexed=False, options=None, skip_index=False)

Bases: rosbag.bag.Bag

Drop-in replacement for rosbag.bag.Bag which shows nice progressbars when loading index and reading messages.

Open a bag file. The mode can be ‘r’, ‘w’, or ‘a’ for reading (default), writing or appending. The file will be created if it doesn’t exist when opened for writing or appending; it will be truncated when opened for writing. Simultaneous reading and writing is allowed when in writing or appending mode. @param f: filename of bag to open or a stream to read from @type f: str or file @param mode: mode, either ‘r’, ‘w’, or ‘a’ @type mode: str @param compression: compression mode, see U{rosbag.Compression} for valid modes @type compression: str @param chunk_threshold: minimum number of uncompressed bytes per chunk @type chunk_threshold: int @param allow_unindexed: if True, allow opening unindexed bags @type allow_unindexed: bool @param options: the bag options (currently: compression and chunk_threshold) @type options: dict @param skip_index: if True, don’t read the connection index records on open [2.0+] @type skip_index: bool @raise ValueError: if any argument is invalid @raise ROSBagException: if an error occurs opening file @raise ROSBagFormatException: if bag format is corrupted

read_index()

Force reading index if it was skipped in the constructor.

read_messages(topics=None, start_time=None, end_time=None, connection_filter=None, raw=False, return_connection_header=False)

Module contents