Public Member Functions | Static Public Attributes | List of all members
grepros.api.Bag Class Reference
Inheritance diagram for grepros.api.Bag:
Inheritance graph
[legend]

Public Member Functions

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

Static Public Attributes

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

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__()

def grepros.api.Bag.__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__()

def grepros.api.Bag.__subclasshook__ (   cls,
  C 
)

Definition at line 412 of file api.py.

◆ autodetect()

def grepros.api.Bag.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

grepros.api.Bag.READER_CLASSES = set()
static

Bag reader classes, as {Cls, }.

Definition at line 366 of file api.py.

◆ WRITER_CLASSES

grepros.api.Bag.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:


grepros
Author(s): Erki Suurjaak
autogenerated on Sat Jan 6 2024 03:11:29