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

Public Member Functions

def __init__ (self, args=None, **kwargs)
 
def close (self)
 
def close_batch (self)
 
def format_message_meta (self, topic, msg, stamp, index=None)
 
def format_meta (self)
 
def get_batch (self)
 
def get_message_class (self, typename, typehash=None)
 
def get_message_definition (self, msg_or_type)
 
def get_message_meta (self, topic, msg, stamp, index=None)
 
def get_message_type_hash (self, msg_or_type)
 
def get_meta (self)
 
def is_processable (self, topic, msg, stamp, index=None)
 
def notify (self, status)
 
def read (self)
 
def validate (self)
 
- Public Member Functions inherited from grepros.inputs.Source
def __enter__ (self)
 
def __exit__ (self, exc_type, exc_value, traceback)
 
def __iter__ (self)
 
def bind (self, sink)
 
def thread_excepthook (self, text, exc)
 
- Public Member Functions inherited from grepros.inputs.ConditionMixin
def conditions_get_topics (self)
 
def conditions_register_message (self, topic, msg)
 
def conditions_set_topic_state (self, topic, pure)
 
def has_conditions (self)
 
def is_conditions_topic (self, topic, pure=True)
 

Public Attributes

 args
 
 bar
 
 valid
 
- Public Attributes inherited from grepros.inputs.Source
 args
 
 bar
 ProgressBar instance, if any. More...
 
 preprocess
 Apply all filter arguments when reading, not only topic and type. More...
 
 sink
 outputs.Sink instance bound to this source More...
 
 topics
 All topics in source, as {(topic, typenane, typehash): total message count or None}. More...
 
 valid
 Result of validate() More...
 

Static Public Attributes

 DEFAULT_ARGS
 Constructor argument defaults. More...
 
string MESSAGE_META_TEMPLATE = "{topic} {index}/{total} ({type} {dt} {stamp})"
 Template for message metainfo line. More...
 
string META_TEMPLATE = "\nFile {file} ({size}), {tcount} topics, {mcount:,d} messages\n" \
 Template for bag metainfo header. More...
 
- Static Public Attributes inherited from grepros.inputs.Source
 DEFAULT_ARGS
 Constructor argument defaults. More...
 
string MESSAGE_META_TEMPLATE = "{topic} #{index} ({type} {dt} {stamp})"
 Template for message metainfo line. More...
 
- Static Public Attributes inherited from grepros.inputs.ConditionMixin
 DEFAULT_ARGS = dict(CONDITION=())
 Constructor argument defaults. More...
 
 TOPIC_RGX = re.compile(r"<topic\s+([^\s><]+)\s*>")
 

Private Member Functions

def _configure (self, filename=None, bag=None)
 
def _ensure_totals (self)
 
def _init_progress (self)
 
def _produce (self, topics, start_time=None)
 
def _produce_bags (self)
 

Private Attributes

 _args0
 
 _bag
 
 _bag0
 
 _filename
 
 _meta
 
 _running
 
 _status
 
 _sticky
 
 _topics
 
 _totals_ok
 
 _types_ok
 

Detailed Description

Produces messages from ROS bagfiles.

Definition at line 428 of file inputs.py.

Constructor & Destructor Documentation

◆ __init__()

def grepros.inputs.BagSource.__init__ (   self,
  args = None,
**  kwargs 
)
@param   args                   arguments as namespace or dictionary, case-insensitive;
                        or a single path as the ROS bagfile to read,
                        or a stream to read from,
                        or one or more {@link grepros.api.Bag Bag} instances
<!--sep-->

Bag-specific arguments:
@param   args.file              names of ROS bagfiles to read if not all in directory,
                        or a stream to read from;
                        or one or more {@link grepros.api.Bag Bag} instances
@param   args.path              paths to scan if not current directory
@param   args.recurse           recurse into subdirectories when looking for bagfiles
@param   args.orderby           "topic" or "type" if any to group results by
@param   args.decompress        decompress archived bags to file directory
@param   args.reindex           make a copy of unindexed bags and reindex them (ROS1 only)
@param   args.write             outputs, to skip in input files
@param   args.bag               one or more {@link grepros.api.Bag Bag} instances
<!--sep-->

General arguments:
@param   args.topic             ROS topics to read if not all
@param   args.type              ROS message types to read if not all
@param   args.skip_topic        ROS topics to skip
@param   args.skip_type         ROS message types to skip
@param   args.start_time        earliest timestamp of messages to read
@param   args.end_time          latest timestamp of messages to read
@param   args.start_index       message index within topic to start from
@param   args.end_index         message index within topic to stop at
@param   args.unique            emit messages that are unique in topic
@param   args.select_field      message fields to use for uniqueness if not all
@param   args.noselect_field    message fields to skip for uniqueness
@param   args.nth_message       read every Nth message in topic
@param   args.nth_interval      minimum time interval between messages in topic
@param   args.condition         Python expressions that must evaluate as true
                        for message to be processable, see ConditionMixin
@param   args.progress          whether to print progress bar
@param   args.stop_on_error     stop execution on any error like unknown message type
@param   kwargs                 any and all arguments as keyword overrides, case-insensitive

Reimplemented from grepros.inputs.Source.

Definition at line 446 of file inputs.py.

Member Function Documentation

◆ _configure()

def grepros.inputs.BagSource._configure (   self,
  filename = None,
  bag = None 
)
private
Opens bag and populates bag-specific argument state, returns success.

Definition at line 741 of file inputs.py.

◆ _ensure_totals()

def grepros.inputs.BagSource._ensure_totals (   self)
private
Retrieves total message counts if not retrieved.

Definition at line 732 of file inputs.py.

◆ _init_progress()

def grepros.inputs.BagSource._init_progress (   self)
private
Initializes progress bar, if any, for current bag.

Definition at line 721 of file inputs.py.

◆ _produce()

def grepros.inputs.BagSource._produce (   self,
  topics,
  start_time = None 
)
private
Yields messages from current ROS bagfile, as (topic, msg, ROS time, index in topic).

@param   topics  {topic: [typename, ]}

Definition at line 653 of file inputs.py.

◆ _produce_bags()

def grepros.inputs.BagSource._produce_bags (   self)
private
Yields Bag instances from configured arguments.

Definition at line 694 of file inputs.py.

◆ close()

def grepros.inputs.BagSource.close (   self)
Closes current bag, if any.

Reimplemented from grepros.inputs.Source.

Definition at line 559 of file inputs.py.

◆ close_batch()

def grepros.inputs.BagSource.close_batch (   self)
Closes current bag, if any.

Reimplemented from grepros.inputs.Source.

Definition at line 566 of file inputs.py.

◆ format_message_meta()

def grepros.inputs.BagSource.format_message_meta (   self,
  topic,
  msg,
  stamp,
  index = None 
)
Returns message metainfo string.

Reimplemented from grepros.inputs.Source.

Definition at line 580 of file inputs.py.

◆ format_meta()

def grepros.inputs.BagSource.format_meta (   self)
Returns bagfile metainfo string.

Reimplemented from grepros.inputs.Source.

Definition at line 576 of file inputs.py.

◆ get_batch()

def grepros.inputs.BagSource.get_batch (   self)
Returns name of current bagfile, or self if reading stream.

Reimplemented from grepros.inputs.Source.

Definition at line 586 of file inputs.py.

◆ get_message_class()

def grepros.inputs.BagSource.get_message_class (   self,
  typename,
  typehash = None 
)
Returns ROS message type class.

Reimplemented from grepros.inputs.Source.

Definition at line 613 of file inputs.py.

◆ get_message_definition()

def grepros.inputs.BagSource.get_message_definition (   self,
  msg_or_type 
)
Returns ROS message type definition full text, including subtype definitions.

Reimplemented from grepros.inputs.Source.

Definition at line 618 of file inputs.py.

◆ get_message_meta()

def grepros.inputs.BagSource.get_message_meta (   self,
  topic,
  msg,
  stamp,
  index = None 
)
Returns message metainfo data dict.

Reimplemented from grepros.inputs.Source.

Definition at line 604 of file inputs.py.

◆ get_message_type_hash()

def grepros.inputs.BagSource.get_message_type_hash (   self,
  msg_or_type 
)
Returns ROS message type MD5 hash.

Reimplemented from grepros.inputs.Source.

Definition at line 623 of file inputs.py.

◆ get_meta()

def grepros.inputs.BagSource.get_meta (   self)
Returns bagfile metainfo data dict.

Reimplemented from grepros.inputs.Source.

Definition at line 590 of file inputs.py.

◆ is_processable()

def grepros.inputs.BagSource.is_processable (   self,
  topic,
  msg,
  stamp,
  index = None 
)
Returns whether message passes source filters.

Reimplemented from grepros.inputs.Source.

Definition at line 634 of file inputs.py.

◆ notify()

def grepros.inputs.BagSource.notify (   self,
  status 
)
Reports match status of last produced message.

Reimplemented from grepros.inputs.Source.

Definition at line 628 of file inputs.py.

◆ read()

def grepros.inputs.BagSource.read (   self)
Yields messages from ROS bagfiles, as (topic, msg, ROS time).

Reimplemented from grepros.inputs.Source.

Definition at line 506 of file inputs.py.

◆ validate()

def grepros.inputs.BagSource.validate (   self)
Returns whether ROS environment is set and arguments valid, prints error if not.

Reimplemented from grepros.inputs.Source.

Definition at line 538 of file inputs.py.

Member Data Documentation

◆ _args0

grepros.inputs.BagSource._args0
private

Definition at line 495 of file inputs.py.

◆ _bag

grepros.inputs.BagSource._bag
private

Definition at line 501 of file inputs.py.

◆ _bag0

grepros.inputs.BagSource._bag0
private

Definition at line 504 of file inputs.py.

◆ _filename

grepros.inputs.BagSource._filename
private

Definition at line 502 of file inputs.py.

◆ _meta

grepros.inputs.BagSource._meta
private

Definition at line 503 of file inputs.py.

◆ _running

grepros.inputs.BagSource._running
private

Definition at line 500 of file inputs.py.

◆ _status

grepros.inputs.BagSource._status
private

Definition at line 496 of file inputs.py.

◆ _sticky

grepros.inputs.BagSource._sticky
private

Definition at line 497 of file inputs.py.

◆ _topics

grepros.inputs.BagSource._topics
private

Definition at line 795 of file inputs.py.

◆ _totals_ok

grepros.inputs.BagSource._totals_ok
private

Definition at line 498 of file inputs.py.

◆ _types_ok

grepros.inputs.BagSource._types_ok
private

Definition at line 499 of file inputs.py.

◆ args

grepros.inputs.BagSource.args

Definition at line 798 of file inputs.py.

◆ bar

grepros.inputs.BagSource.bar

Definition at line 573 of file inputs.py.

◆ DEFAULT_ARGS

grepros.inputs.BagSource.DEFAULT_ARGS
static
Initial value:
= dict(BAG=(), FILE=(), PATH=(), RECURSE=False, TOPIC=(), TYPE=(),
SKIP_TOPIC=(), SKIP_TYPE=(), START_TIME=None, END_TIME=None,
START_INDEX=None, END_INDEX=None, CONDITION=(), AFTER=0, ORDERBY=None,
DECOMPRESS=False, REINDEX=False, WRITE=(), PROGRESS=False,
STOP_ON_ERROR=False)

Constructor argument defaults.

Definition at line 440 of file inputs.py.

◆ MESSAGE_META_TEMPLATE

string grepros.inputs.BagSource.MESSAGE_META_TEMPLATE = "{topic} {index}/{total} ({type} {dt} {stamp})"
static

Template for message metainfo line.

Definition at line 432 of file inputs.py.

◆ META_TEMPLATE

string grepros.inputs.BagSource.META_TEMPLATE = "\nFile {file} ({size}), {tcount} topics, {mcount:,d} messages\n" \
static

Template for bag metainfo header.

Definition at line 435 of file inputs.py.

◆ valid

grepros.inputs.BagSource.valid

Definition at line 541 of file inputs.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