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

Classes

class  SourceMessage
 Returned from read() as (topic name, ROS message, ROS timestamp object). More...
 

Public Member Functions

def __enter__ (self)
 
def __exit__ (self, exc_type, exc_value, traceback)
 
def __init__ (self, args=None, **kwargs)
 
def __iter__ (self)
 
def bind (self, sink)
 
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 thread_excepthook (self, text, exc)
 
def validate (self)
 

Public Attributes

 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} ({type} {dt} {stamp})"
 Template for message metainfo line. More...
 

Private Member Functions

def _parse_patterns (self)
 

Private Attributes

 _counts
 
 _hashes
 
 _patterns
 
 _processables
 
 _topics
 

Detailed Description

Message producer base class.

Definition at line 34 of file inputs.py.

Constructor & Destructor Documentation

◆ __init__()

def grepros.inputs.Source.__init__ (   self,
  args = None,
**  kwargs 
)
@param   args                   arguments as namespace or dictionary, case-insensitive
@param   args.start_time        earliest timestamp of messages to read
@param   args.end_time          latest timestamp of messages to read
@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   kwargs                 any and all arguments as keyword overrides, case-insensitive

Reimplemented in grepros.inputs.AppSource, grepros.inputs.TopicSource, and grepros.inputs.BagSource.

Definition at line 47 of file inputs.py.

Member Function Documentation

◆ __enter__()

def grepros.inputs.Source.__enter__ (   self)
Context manager entry.

Definition at line 86 of file inputs.py.

◆ __exit__()

def grepros.inputs.Source.__exit__ (   self,
  exc_type,
  exc_value,
  traceback 
)
Context manager exit, closes source.

Definition at line 90 of file inputs.py.

◆ __iter__()

def grepros.inputs.Source.__iter__ (   self)
Yields messages from source, as (topic, msg, ROS time).

Definition at line 82 of file inputs.py.

◆ _parse_patterns()

def grepros.inputs.Source._parse_patterns (   self)
private
Parses pattern arguments into re.Patterns.

Definition at line 188 of file inputs.py.

◆ bind()

def grepros.inputs.Source.bind (   self,
  sink 
)
Attaches sink to source

Reimplemented in grepros.inputs.TopicSource.

Definition at line 97 of file inputs.py.

◆ close()

def grepros.inputs.Source.close (   self)
Shuts down input, closing any files or connections.

Reimplemented in grepros.inputs.AppSource, grepros.inputs.TopicSource, and grepros.inputs.BagSource.

Definition at line 106 of file inputs.py.

◆ close_batch()

def grepros.inputs.Source.close_batch (   self)
Shuts down input batch if any (like bagfile), else all input.

Reimplemented in grepros.inputs.BagSource.

Definition at line 118 of file inputs.py.

◆ format_message_meta()

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

Reimplemented in grepros.inputs.BagSource.

Definition at line 126 of file inputs.py.

◆ format_meta()

def grepros.inputs.Source.format_meta (   self)
Returns source metainfo string.

Reimplemented in grepros.inputs.TopicSource, and grepros.inputs.BagSource.

Definition at line 122 of file inputs.py.

◆ get_batch()

def grepros.inputs.Source.get_batch (   self)
Returns source batch identifier if any (like bagfile name if BagSource).

Reimplemented in grepros.inputs.BagSource.

Definition at line 132 of file inputs.py.

◆ get_message_class()

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

Reimplemented in grepros.inputs.TopicSource, and grepros.inputs.BagSource.

Definition at line 146 of file inputs.py.

◆ get_message_definition()

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

Reimplemented in grepros.inputs.TopicSource, and grepros.inputs.BagSource.

Definition at line 150 of file inputs.py.

◆ get_message_meta()

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

Reimplemented in grepros.inputs.TopicSource, and grepros.inputs.BagSource.

Definition at line 139 of file inputs.py.

◆ get_message_type_hash()

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

Reimplemented in grepros.inputs.TopicSource, and grepros.inputs.BagSource.

Definition at line 154 of file inputs.py.

◆ get_meta()

def grepros.inputs.Source.get_meta (   self)
Returns source metainfo data dict.

Reimplemented in grepros.inputs.TopicSource, and grepros.inputs.BagSource.

Definition at line 135 of file inputs.py.

◆ is_processable()

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

Reimplemented in grepros.inputs.AppSource, grepros.inputs.TopicSource, and grepros.inputs.BagSource.

Definition at line 158 of file inputs.py.

◆ notify()

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

Reimplemented in grepros.inputs.BagSource.

Definition at line 181 of file inputs.py.

◆ read()

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

Reimplemented in grepros.inputs.AppSource, grepros.inputs.TopicSource, and grepros.inputs.BagSource.

Definition at line 94 of file inputs.py.

◆ thread_excepthook()

def grepros.inputs.Source.thread_excepthook (   self,
  text,
  exc 
)
Handles exception, used by background threads.

Definition at line 184 of file inputs.py.

◆ validate()

def grepros.inputs.Source.validate (   self)
Returns whether source prerequisites are met (like ROS environment for TopicSource).

Reimplemented in grepros.inputs.TopicSource, and grepros.inputs.BagSource.

Definition at line 101 of file inputs.py.

Member Data Documentation

◆ _counts

grepros.inputs.Source._counts
private

Definition at line 63 of file inputs.py.

◆ _hashes

grepros.inputs.Source._hashes
private

Definition at line 65 of file inputs.py.

◆ _patterns

grepros.inputs.Source._patterns
private

Definition at line 60 of file inputs.py.

◆ _processables

grepros.inputs.Source._processables
private

Definition at line 66 of file inputs.py.

◆ _topics

grepros.inputs.Source._topics
private

Definition at line 62 of file inputs.py.

◆ args

grepros.inputs.Source.args

Definition at line 68 of file inputs.py.

◆ bar

grepros.inputs.Source.bar

ProgressBar instance, if any.

Definition at line 74 of file inputs.py.

◆ DEFAULT_ARGS

grepros.inputs.Source.DEFAULT_ARGS
static
Initial value:
= dict(START_TIME=None, END_TIME=None, UNIQUE=False, SELECT_FIELD=(),
NOSELECT_FIELD=(), NTH_MESSAGE=1, NTH_INTERVAL=0)

Constructor argument defaults.

Definition at line 44 of file inputs.py.

◆ MESSAGE_META_TEMPLATE

string grepros.inputs.Source.MESSAGE_META_TEMPLATE = "{topic} #{index} ({type} {dt} {stamp})"
static

Template for message metainfo line.

Definition at line 41 of file inputs.py.

◆ preprocess

grepros.inputs.Source.preprocess

Apply all filter arguments when reading, not only topic and type.

Definition at line 78 of file inputs.py.

◆ sink

grepros.inputs.Source.sink

outputs.Sink instance bound to this source

Definition at line 70 of file inputs.py.

◆ topics

grepros.inputs.Source.topics

All topics in source, as {(topic, typenane, typehash): total message count or None}.

Definition at line 72 of file inputs.py.

◆ valid

grepros.inputs.Source.valid

Result of validate()

Definition at line 76 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