grepros 1.3.0
grep for ROS bag files and live topics
Loading...
Searching...
No Matches
Bag Class Reference
Inheritance diagram for Bag:
Inheritance graph

Public Member Functions

 __new__ (cls, f, mode="r", reindex=False, progress=False, **kwargs)
 
 __subclasshook__ (cls, C)
 
 autodetect (cls, f)
 
- Public Member Functions inherited from BaseBag
 __bool__ (self)
 
 __contains__ (self, key)
 
 __copy__ (self)
 
 __deepcopy__ (self, memo=None)
 
 __enter__ (self)
 
 __exit__ (self, exc_type, exc_value, traceback)
 
 __getitem__ (self, key)
 
 __iter__ (self)
 
 __len__ (self)
 
 __next__ (self)
 
 __nonzero__ (self)
 
 __str__ (self)
 
 close (self)
 
 closed (self)
 
 filename (self)
 
 flush (self)
 
 get_end_time (self)
 
 get_message_class (self, typename, typehash=None)
 
 get_message_count (self, topic_filters=None)
 
 get_message_definition (self, msg_or_type)
 
 get_message_type_hash (self, msg_or_type)
 
 get_qoses (self, topic, typename)
 
 get_start_time (self)
 
 get_topic_info (self, counts=True)
 
 get_type_and_topic_info (self, topic_filters=None)
 
 mode (self)
 
 open (self)
 
 read_messages (self, topics=None, start_time=None, end_time=None, raw=False, **__)
 
 size (self)
 
 stop_on_error (self)
 
 stop_on_error (self, flag)
 
 topics (self)
 
 write (self, topic, msg, t=None, raw=False, **kwargs)
 

Static Public Attributes

 READER_CLASSES = set()
 Bag reader classes, as {Cls, }.
 
 WRITER_CLASSES = set()
 Bag writer classes, as {Cls, }.
 
- Static Public Attributes inherited from BaseBag
 BagMessage = collections.namedtuple("BagMessage", "topic message timestamp")
 Returned from read_messages() as (topic name, ROS message, ROS timestamp object).
 
tuple MODES = ("r", "w", "a")
 Supported opening modes, overridden in subclasses.
 
 next
 
bool STREAMABLE = True
 Whether bag supports reading or writing stream objects, overridden in subclasses.
 
 TopicTuple
 Returned from get_type_and_topic_info() as (typename, message count, connection count, median frequency).
 
 TypesAndTopicsTuple = collections.namedtuple("TypesAndTopicsTuple", ["msg_types", "topics"])
 Returned from get_type_and_topic_info() as ({typename: typehash}, {topic name: TopicTuple}).
 

Detailed Description

%Bag factory metaclass.

Result is a format-specific class instance, auto-detected from file extension or content:
an extended rosbag.Bag for ROS1 bags, otherwise an object with a conforming interface.

E.g. {@link grepros.plugins.mcap.McapBag McapBag} if {@link grepros.plugins.mcap mcap}
plugin loaded and file recognized as MCAP format.

User plugins can add their own format support to READER_CLASSES and WRITER_CLASSES.
Classes can have a static/class method `autodetect(filename)`
returning whether given file is in recognizable format for the plugin class.

Definition at line 350 of file api.py.

Member Function Documentation

◆ __new__()

__new__ (   cls,
  f,
  mode = "r",
  reindex = False,
  progress = False,
**  kwargs 
)
Returns an object for reading or writing ROS bags.

Suitable Bag class is auto-detected by file extension or content.

@param   f         bag file path, or a stream object
                   (streams not supported for ROS2 .db3 SQLite bags)
@param   mode      return reader if "r" else writer
@param   reindex   reindex unindexed bag (ROS1 only), making a backup if indexed format
@param   progress  show progress bar with reindexing status
@param   kwargs    additional keyword arguments for format-specific Bag constructor,
                   like `compression` for ROS1 bag

Definition at line 371 of file api.py.

◆ __subclasshook__()

__subclasshook__ (   cls,
  C 
)

Definition at line 412 of file api.py.

◆ autodetect()

autodetect (   cls,
  f 
)
Returns registered bag class auto-detected from file, or None.

Definition at line 403 of file api.py.

Member Data Documentation

◆ READER_CLASSES

READER_CLASSES = set()
static

Bag reader classes, as {Cls, }.

Definition at line 366 of file api.py.

◆ WRITER_CLASSES

WRITER_CLASSES = set()
static

Bag writer classes, as {Cls, }.

Definition at line 369 of file api.py.


The documentation for this class was generated from the following file: