grepros 1.2.2
grep for ROS bag files and live topics
Loading...
Searching...
No Matches
CsvSink Class Reference

Writes messages to CSV files, each topic to a separate file. More...

Inheritance diagram for CsvSink:
Inheritance graph

Public Member Functions

 __init__ (self, args=None, **kwargs)
 
 close (self)
 Closes output file(s), if any.
 
 emit (self, topic, msg, stamp=None, match=None, index=None)
 Writes message to output file.
 
 validate (self)
 Returns whether arguments and overwrite option are valid, and file base is writable.
 
- Public Member Functions inherited from Sink
 __init__ (self, args=None, **kwargs)
 
 __enter__ (self)
 Context manager entry.
 
 __exit__ (self, exc_type, exc_value, traceback)
 Context manager exit, closes sink.
 
 autodetect (cls, target)
 Returns true if target is recognizable as output for this sink class.
 
 bind (self, source)
 Attaches source to sink.
 
 close (self)
 Shuts down output, closing any files or connections.
 
 configure (self, args=None, **kwargs)
 Updates sink configuration.
 
 emit (self, topic, msg, stamp=None, match=None, index=None)
 Outputs ROS message.
 
 emit_meta (self)
 Outputs source metainfo like bag header as debug stream, if not already emitted.
 
 flush (self)
 Writes out any pending data to disk.
 
 is_highlighting (self)
 Returns whether this sink requires highlighted matches.
 
 thread_excepthook (self, text, exc)
 Handles exception, used by background threads.
 
 validate (self)
 Returns whether sink prerequisites are met (like ROS environment set if LiveSink).
 

Public Attributes

 close
 
 valid
 
- Public Attributes inherited from Sink
 args
 
 source
 inputs.Source instance bound to this sink
 
 valid
 Result of validate()
 

Static Public Attributes

 DEFAULT_ARGS = dict(EMIT_FIELD=(), META=False, NOEMIT_FIELD=(), WRITE_OPTIONS={}, VERBOSE=False)
 Constructor argument defaults.
 
tuple FILE_EXTENSIONS = (".csv", )
 Auto-detection file extensions.
 
- 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", )
 

Detailed Description

Writes messages to CSV files, each topic to a separate file.

Definition at line 29 of file csv.py.

Constructor & Destructor Documentation

◆ __init__()

__init__ (   self,
  args = None,
**  kwargs 
)
Parameters
argsarguments as namespace or dictionary, case-insensitive; or a single path as the base name of CSV files to write
args.emit_fieldmessage fields to emit in output if not all
args.noemit_fieldmessage fields to skip in output
args.writebase name of CSV files to write, will add topic name like "name.__my__topic.csv" for "/my/topic", will add counter like "name.__my__topic.2.csv" if exists
args.write_options{"overwrite": whether to overwrite existing files (default false)}
args.metawhether to emit metainfo
args.verbosewhether to emit debug information
kwargsany and all arguments as keyword overrides, case-insensitive

Reimplemented from Sink.

Definition at line 53 of file csv.py.

Member Function Documentation

◆ close()

close (   self)

Closes output file(s), if any.

Reimplemented from Sink.

Definition at line 95 of file csv.py.

◆ emit()

emit (   self,
  topic,
  msg,
  stamp = None,
  match = None,
  index = None 
)

Writes message to output file.

Reimplemented from Sink.

Definition at line 69 of file csv.py.

◆ validate()

validate (   self)

Returns whether arguments and overwrite option are valid, and file base is writable.

Reimplemented from Sink.

Definition at line 79 of file csv.py.

Member Data Documentation

◆ close

close

Definition at line 67 of file csv.py.

◆ DEFAULT_ARGS

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

Constructor argument defaults.

Definition at line 36 of file csv.py.

◆ FILE_EXTENSIONS

tuple FILE_EXTENSIONS = (".csv", )
static

Auto-detection file extensions.

Definition at line 33 of file csv.py.

◆ valid

valid

Definition at line 90 of file csv.py.


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