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

Classes

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

Public Member Functions

 __init__ (self, args=None, **kwargs)
 
 __enter__ (self)
 
 __exit__ (self, exc_type, exc_value, traceback)
 
 __iter__ (self)
 
 bind (self, sink)
 
 close (self)
 
 close_batch (self)
 
 configure (self, args=None, **kwargs)
 
 configure_progress (self, **kwargs)
 
 format_message_meta (self, topic, msg, stamp, index=None)
 
 format_meta (self)
 
 get_batch (self)
 
 get_message_class (self, typename, typehash=None)
 
 get_message_definition (self, msg_or_type)
 
 get_message_meta (self, topic, msg, stamp, index=None)
 
 get_message_type_hash (self, msg_or_type)
 
 get_meta (self)
 
 init_progress (self)
 
 is_processable (self, topic, msg, stamp, index=None)
 
 notify (self, status)
 
 read (self)
 
 thread_excepthook (self, text, exc)
 
 update_progress (self, count, running=True)
 
 validate (self)
 

Public Attributes

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

Static Public Attributes

 DEFAULT_ARGS
 Constructor argument defaults.
 
str MESSAGE_META_TEMPLATE = "{topic} #{index} ({type} {dt} {stamp})"
 Template for message metainfo line.
 

Detailed Description

Message producer base class.

Definition at line 35 of file inputs.py.

Constructor & Destructor Documentation

◆ __init__()

__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.start_index       message index within topic to start from
@param   args.end_index         message index within topic to stop at
@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, starting from first
@param   args.nth_interval      minimum time interval between messages in topic,
                                as seconds or ROS duration
@param   args.progress          whether to print progress bar
@param   kwargs                 any and all arguments as keyword overrides, case-insensitive

Reimplemented in BagSource, LiveSource, and AppSource.

Definition at line 49 of file inputs.py.

Member Function Documentation

◆ __enter__()

__enter__ (   self)
Context manager entry.

Definition at line 96 of file inputs.py.

◆ __exit__()

__exit__ (   self,
  exc_type,
  exc_value,
  traceback 
)
Context manager exit, closes source.

Definition at line 100 of file inputs.py.

◆ __iter__()

__iter__ (   self)
Yields messages from source, as (topic, msg, ROS time).

Definition at line 92 of file inputs.py.

◆ bind()

bind (   self,
  sink 
)
Attaches sink to source

Reimplemented in LiveSource.

Definition at line 107 of file inputs.py.

◆ close()

close (   self)
Shuts down input, closing any files or connections.

Reimplemented in BagSource, LiveSource, and AppSource.

Definition at line 128 of file inputs.py.

◆ close_batch()

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

Reimplemented in BagSource.

Definition at line 141 of file inputs.py.

◆ configure()

configure (   self,
  args = None,
**  kwargs 
)
Updates source configuration.

@param   args    arguments as namespace or dictionary, case-insensitive
@param   kwargs  any and all arguments as keyword overrides, case-insensitive

Reimplemented in BagSource.

Definition at line 111 of file inputs.py.

◆ configure_progress()

configure_progress (   self,
**  kwargs 
)
Configures progress bar options, updates current bar if any.

Definition at line 220 of file inputs.py.

◆ format_message_meta()

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

Reimplemented in BagSource.

Definition at line 149 of file inputs.py.

◆ format_meta()

format_meta (   self)
Returns source metainfo string.

Reimplemented in BagSource, and LiveSource.

Definition at line 145 of file inputs.py.

◆ get_batch()

get_batch (   self)
Returns source batch identifier if any (like bagfile name if BagSource).

Reimplemented in BagSource.

Definition at line 155 of file inputs.py.

◆ get_message_class()

get_message_class (   self,
  typename,
  typehash = None 
)
Returns message type class.

Reimplemented in BagSource, and LiveSource.

Definition at line 169 of file inputs.py.

◆ get_message_definition()

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

Reimplemented in BagSource, and LiveSource.

Definition at line 173 of file inputs.py.

◆ get_message_meta()

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

Reimplemented in BagSource, and LiveSource.

Definition at line 162 of file inputs.py.

◆ get_message_type_hash()

get_message_type_hash (   self,
  msg_or_type 
)
Returns ROS message type MD5 hash.

Reimplemented in BagSource, and LiveSource.

Definition at line 177 of file inputs.py.

◆ get_meta()

get_meta (   self)
Returns source metainfo data dict.

Reimplemented in BagSource, and LiveSource.

Definition at line 158 of file inputs.py.

◆ init_progress()

init_progress (   self)
Initializes progress bar, if any.

Reimplemented in BagSource, and LiveSource.

Definition at line 232 of file inputs.py.

◆ is_processable()

is_processable (   self,
  topic,
  msg,
  stamp,
  index = None 
)
Returns whether message passes source filters; registers status.

Reimplemented in BagSource, LiveSource, and AppSource.

Definition at line 181 of file inputs.py.

◆ notify()

notify (   self,
  status 
)
Reports match status of last produced message.

Reimplemented in BagSource.

Definition at line 214 of file inputs.py.

◆ read()

read (   self)
Yields messages from source, as (topic, msg, ROS time).

Reimplemented in BagSource, LiveSource, and AppSource.

Definition at line 104 of file inputs.py.

◆ thread_excepthook()

thread_excepthook (   self,
  text,
  exc 
)
Handles exception, used by background threads.

Definition at line 247 of file inputs.py.

◆ update_progress()

update_progress (   self,
  count,
  running = True 
)
Updates progress bar, if any, with source processed count, pauses bar if not running.

Reimplemented in LiveSource.

Definition at line 238 of file inputs.py.

◆ validate()

validate (   self)
Returns whether arguments are valid and source prerequisites are met.

Reimplemented in BagSource, LiveSource, and AppSource.

Definition at line 121 of file inputs.py.

Member Data Documentation

◆ args

args

Definition at line 78 of file inputs.py.

◆ bar

bar

ProgressBar instance, if any.

Definition at line 84 of file inputs.py.

◆ DEFAULT_ARGS

DEFAULT_ARGS
static
Initial value:
= dict(START_TIME=None, END_TIME=None, START_INDEX=None, END_INDEX=None,
UNIQUE=False, SELECT_FIELD=(), NOSELECT_FIELD=(),
NTH_MESSAGE=1, NTH_INTERVAL=0, PROGRESS=False)

Constructor argument defaults.

Definition at line 45 of file inputs.py.

◆ MESSAGE_META_TEMPLATE

str MESSAGE_META_TEMPLATE = "{topic} #{index} ({type} {dt} {stamp})"
static

Template for message metainfo line.

Definition at line 42 of file inputs.py.

◆ preprocess

preprocess

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

Definition at line 88 of file inputs.py.

◆ sink

sink

outputs.Sink instance bound to this source

Definition at line 80 of file inputs.py.

◆ topics

topics

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

Definition at line 82 of file inputs.py.

◆ valid

valid

Result of validate()

Definition at line 86 of file inputs.py.


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