Public Member Functions | Static Public Attributes | Private Member Functions | Private Attributes | List of all members
grepros.plugins.embag.EmbagReader Class Reference
Inheritance diagram for grepros.plugins.embag.EmbagReader:
Inheritance graph
[legend]

Public Member Functions

def __contains__ (self, key)
 
def __init__ (self, filename, mode="r", **__)
 
def __next__ (self)
 
def autodetect (cls, filename)
 
def close (self)
 
def closed (self)
 
def filename (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_start_time (self)
 
def get_topic_info (self, *_, **__)
 
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 topics (self)
 
- Public Member Functions inherited from grepros.api.BaseBag
def __bool__ (self)
 
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 __nonzero__ (self)
 
def __str__ (self)
 
def flush (self)
 
def get_qoses (self, topic, typename)
 
def get_topic_info (self, counts=True)
 
def read_messages (self, topics=None, start_time=None, end_time=None, raw=False, **__)
 
def stop_on_error (self)
 
def stop_on_error (self, flag)
 
def write (self, topic, msg, t=None, raw=False, **kwargs)
 

Static Public Attributes

tuple MODES = ("r", )
 Supported opening modes. More...
 
string ROSBAG_MAGIC = b"#ROSBAG"
 ROS1 bag file header magic start bytes. More...
 
bool STREAMABLE = False
 Whether bag supports reading or writing stream objects, overridden in subclasses. 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...
 

Private Member Functions

def _populate_message (self, msg, embagval)
 
def _populate_meta (self)
 

Private Attributes

 _filename
 
 _hashdefs
 
 _iterer
 
 _topics
 
 _ttinfo
 
 _typedefs
 
 _types
 
 _view
 

Detailed Description

embag reader interface, providing most of rosbag.Bag interface.

Definition at line 26 of file embag.py.

Constructor & Destructor Documentation

◆ __init__()

def grepros.plugins.embag.EmbagReader.__init__ (   self,
  filename,
  mode = "r",
**  __ 
)

Definition at line 38 of file embag.py.

Member Function Documentation

◆ __contains__()

def grepros.plugins.embag.EmbagReader.__contains__ (   self,
  key 
)
Returns whether bag contains given topic.

Reimplemented from grepros.api.BaseBag.

Definition at line 234 of file embag.py.

◆ __next__()

def grepros.plugins.embag.EmbagReader.__next__ (   self)
Retrieves next message from bag as (topic, message, timestamp).

Reimplemented from grepros.api.BaseBag.

Definition at line 239 of file embag.py.

◆ _populate_message()

def grepros.plugins.embag.EmbagReader._populate_message (   self,
  msg,
  embagval 
)
private
Returns the ROS1 message populated from a corresponding embag.RosValue.

Definition at line 262 of file embag.py.

◆ _populate_meta()

def grepros.plugins.embag.EmbagReader._populate_meta (   self)
private
Populates bag metainfo.

Definition at line 246 of file embag.py.

◆ autodetect()

def grepros.plugins.embag.EmbagReader.autodetect (   cls,
  filename 
)
Returns whether file is readable as ROS1 bag.

Definition at line 286 of file embag.py.

◆ close()

def grepros.plugins.embag.EmbagReader.close (   self)
Closes the bag file.

Reimplemented from grepros.api.BaseBag.

Definition at line 196 of file embag.py.

◆ closed()

def grepros.plugins.embag.EmbagReader.closed (   self)
Returns whether file is closed.

Reimplemented from grepros.api.BaseBag.

Definition at line 205 of file embag.py.

◆ filename()

def grepros.plugins.embag.EmbagReader.filename (   self)
Returns bag file path.

Reimplemented from grepros.api.BaseBag.

Definition at line 217 of file embag.py.

◆ get_end_time()

def grepros.plugins.embag.EmbagReader.get_end_time (   self)
Returns the end time of the bag, as UNIX timestamp, or None if bag empty.

Reimplemented from grepros.api.BaseBag.

Definition at line 74 of file embag.py.

◆ get_message_class()

def grepros.plugins.embag.EmbagReader.get_message_class (   self,
  typename,
  typehash = None 
)
Returns rospy message class for typename, or None if unknown message type for bag.

Generates class dynamically if not already generated.

@param   typehash  message type definition hash, if any

Reimplemented from grepros.api.BaseBag.

Definition at line 80 of file embag.py.

◆ get_message_count()

def grepros.plugins.embag.EmbagReader.get_message_count (   self,
  topic_filters = None 
)
Returns the number of messages in the bag.

@param   topic_filters  list of topics or a single topic to filter by, if any

Reimplemented from grepros.api.BaseBag.

Definition at line 55 of file embag.py.

◆ get_message_definition()

def grepros.plugins.embag.EmbagReader.get_message_definition (   self,
  msg_or_type 
)
Returns ROS1 message type definition full text from bag, including subtype definitions.

Returns None if unknown message type for bag.

Reimplemented from grepros.api.BaseBag.

Definition at line 95 of file embag.py.

◆ get_message_type_hash()

def grepros.plugins.embag.EmbagReader.get_message_type_hash (   self,
  msg_or_type 
)
Returns ROS1 message type MD5 hash, or None if unknown message type for bag.

Reimplemented from grepros.api.BaseBag.

Definition at line 107 of file embag.py.

◆ get_start_time()

def grepros.plugins.embag.EmbagReader.get_start_time (   self)
Returns the start time of the bag, as UNIX timestamp, or None if bag empty.

Reimplemented from grepros.api.BaseBag.

Definition at line 68 of file embag.py.

◆ get_topic_info()

def grepros.plugins.embag.EmbagReader.get_topic_info (   self,
_,
**  __ 
)
Returns topic and message type metainfo as {(topic, typename, typehash): count}.

Definition at line 114 of file embag.py.

◆ get_type_and_topic_info()

def grepros.plugins.embag.EmbagReader.get_type_and_topic_info (   self,
  topic_filters = None 
)
Returns thorough metainfo on topic and message types.

@param   topic_filters  list of topics or a single topic to filter returned topics-dict by,
                if any
@return                 TypesAndTopicsTuple(msg_types, topics) namedtuple,
                msg_types as dict of {typename: typehash},
                topics as a dict of {topic: TopicTuple() namedtuple}.

Reimplemented from grepros.api.BaseBag.

Definition at line 119 of file embag.py.

◆ mode()

def grepros.plugins.embag.EmbagReader.mode (   self)
Returns file open mode.

Reimplemented from grepros.api.BaseBag.

Definition at line 229 of file embag.py.

◆ open()

def grepros.plugins.embag.EmbagReader.open (   self)
Opens the bag file if not already open.

Reimplemented from grepros.api.BaseBag.

Definition at line 191 of file embag.py.

◆ read_messages()

def grepros.plugins.embag.EmbagReader.read_messages (   self,
  topics = None,
  start_time = None,
  end_time = None,
  raw = False 
)
Yields messages from the bag, optionally filtered by topic and timestamp.

@param   topics      list of topics or a single topic to filter by, if at all
@param   start_time  earliest timestamp of message to return, as ROS time or convertible
             (int/float/duration/datetime/decimal)
@param   end_time    latest timestamp of message to return, as ROS time or convertible
             (int/float/duration/datetime/decimal)
@param   raw         if true, then returned messages are tuples of
             (typename, bytes, typehash, typeclass)
@return              BagMessage namedtuples of (topic, message, timestamp as rospy.Time)

Definition at line 159 of file embag.py.

◆ size()

def grepros.plugins.embag.EmbagReader.size (   self)
Returns current file size.

Reimplemented from grepros.api.BaseBag.

Definition at line 223 of file embag.py.

◆ topics()

def grepros.plugins.embag.EmbagReader.topics (   self)
Returns the list of topics in bag, in alphabetic order.

Reimplemented from grepros.api.BaseBag.

Definition at line 211 of file embag.py.

Member Data Documentation

◆ _filename

grepros.plugins.embag.EmbagReader._filename
private

Definition at line 50 of file embag.py.

◆ _hashdefs

grepros.plugins.embag.EmbagReader._hashdefs
private

Definition at line 45 of file embag.py.

◆ _iterer

grepros.plugins.embag.EmbagReader._iterer
private

Definition at line 47 of file embag.py.

◆ _topics

grepros.plugins.embag.EmbagReader._topics
private

Definition at line 43 of file embag.py.

◆ _ttinfo

grepros.plugins.embag.EmbagReader._ttinfo
private

Definition at line 48 of file embag.py.

◆ _typedefs

grepros.plugins.embag.EmbagReader._typedefs
private

Definition at line 46 of file embag.py.

◆ _types

grepros.plugins.embag.EmbagReader._types
private

Definition at line 44 of file embag.py.

◆ _view

grepros.plugins.embag.EmbagReader._view
private

Definition at line 49 of file embag.py.

◆ MODES

tuple grepros.plugins.embag.EmbagReader.MODES = ("r", )
static

Supported opening modes.

Definition at line 30 of file embag.py.

◆ ROSBAG_MAGIC

string grepros.plugins.embag.EmbagReader.ROSBAG_MAGIC = b"#ROSBAG"
static

ROS1 bag file header magic start bytes.

Definition at line 36 of file embag.py.

◆ STREAMABLE

bool grepros.plugins.embag.EmbagReader.STREAMABLE = False
static

Whether bag supports reading or writing stream objects, overridden in subclasses.

Definition at line 33 of file embag.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:30