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

Public Member Functions

 __init__ (self, args=None, **kwargs)
 
 autodetect (cls, target)
 
 close (self)
 
 close_output (self)
 
 emit (self, topic, msg, stamp=None, match=None, index=None)
 
 size (self)
 
 validate (self)
 
- Public Member Functions inherited from Sink
 __enter__ (self)
 
 __exit__ (self, exc_type, exc_value, traceback)
 
 bind (self, source)
 
 configure (self, args=None, **kwargs)
 
 emit_meta (self)
 
 flush (self)
 
 is_highlighting (self)
 
 thread_excepthook (self, text, exc)
 
- Public Member Functions inherited from RolloverSinkMixin
 ensure_rollover (self, topic, msg, stamp)
 
 format_output_meta (self)
 
 get_write_options (cls, label)
 
 make_filename (self)
 

Public Attributes

 close
 
 filename
 
 valid
 
- Public Attributes inherited from Sink
 args
 
 source
 inputs.Source instance bound to this sink
 
 valid
 Result of validate()
 
- Public Attributes inherited from RolloverSinkMixin
 filename
 Current output file path.
 

Static Public Attributes

 DEFAULT_ARGS = dict(META=False, WRITE_OPTIONS={}, VERBOSE=False)
 Constructor argument defaults.
 
- Static Public Attributes inherited from Sink
 DEFAULT_ARGS = dict(META=False)
 Constructor argument defaults.
 
tuple FILE_EXTENSIONS = ()
 Auto-detection file extensions for subclasses, as (".ext", )
 
- Static Public Attributes inherited from RolloverSinkMixin
 DEFAULT_ARGS = dict(WRITE=None, WRITE_OPTIONS={}, VERBOSE=False)
 Constructor argument defaults.
 
str FILE_META_TEMPLATE = "{name} ({size})"
 
str MULTI_META_TEMPLATE = "\n- {name} ({size}, {mcount}, {tcount})"
 
list OPTIONS_TEMPLATES
 Command-line help templates for rollover options, as [(name, text with s label placeholder)].
 
str START_META_TEMPLATE = "{mcount} in {tcount} to "
 

Detailed Description

Writes messages to bagfile.

Definition at line 626 of file outputs.py.

Constructor & Destructor Documentation

◆ __init__()

__init__ (   self,
  args = None,
**  kwargs 
)
@param   args                 arguments as namespace or dictionary, case-insensitive;
                              or a single path as the ROS bagfile to write,
                              or a stream or {@link grepros.api.Bag Bag} instance to write to
@param   args.write           name of ROS bagfile to create or append to,
                              or a stream to write to
@param   args.write_options   {"overwrite": whether to overwrite existing file
                                            (default false),
                               "rollover-size": bytes limit for individual output files,
                               "rollover-count": message limit for individual output files,
                               "rollover-duration": time span limit for individual output files,
                                                    as ROS duration or convertible seconds,
                               "rollover-template": output filename template, supporting
                                                    strftime format codes like "%H-%M-%S"
                                                    and "%(index)s" as output file index}
@param   args.meta            whether to emit metainfo
@param   args.verbose         whether to emit debug information
@param   kwargs               any and all arguments as keyword overrides, case-insensitive

Reimplemented from Sink.

Definition at line 632 of file outputs.py.

Member Function Documentation

◆ autodetect()

autodetect (   cls,
  target 
)
Returns true if target is recognizable as a ROS bag.

Reimplemented from Sink.

Definition at line 759 of file outputs.py.

◆ close()

close (   self)
Closes output bag, if any, emits metainfo.

Reimplemented from Sink.

Definition at line 706 of file outputs.py.

◆ close_output()

close_output (   self)
Closes output bag, if any.

Reimplemented from RolloverSinkMixin.

Definition at line 714 of file outputs.py.

◆ emit()

emit (   self,
  topic,
  msg,
  stamp = None,
  match = None,
  index = None 
)
Writes message to output bagfile.

Reimplemented from Sink.

Definition at line 667 of file outputs.py.

◆ size()

size (   self)
Returns current file size in bytes, or None if size lookup failed.

Reimplemented from RolloverSinkMixin.

Definition at line 720 of file outputs.py.

◆ validate()

validate (   self)
Returns whether write options are valid and ROS environment set, emits error if not.

Reimplemented from Sink.

Definition at line 681 of file outputs.py.

Member Data Documentation

◆ close

close

Definition at line 665 of file outputs.py.

◆ DEFAULT_ARGS

DEFAULT_ARGS = dict(META=False, WRITE_OPTIONS={}, VERBOSE=False)
static

Constructor argument defaults.

Definition at line 630 of file outputs.py.

◆ filename

filename

Definition at line 722 of file outputs.py.

◆ valid

valid

Definition at line 703 of file outputs.py.


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