Bag serialize messages to and from a single file on disk using the bag format.
Method | __enter__ |
Undocumented |
Method | __exit__ |
Undocumented |
Method | __init__ |
Open a bag file. The mode can be 'r', 'w', or 'a' for reading (default), writing or appending. The file will be created if it doesn't exist when opened for writing or appending; it will be truncated when opened for writing... |
Method | __iter__ |
Undocumented |
Method | __str__ |
Undocumented |
Method | close |
Close the bag file. Closing an already closed bag does nothing. |
Method | flush |
Write the open chunk to disk so subsequent reads will read all messages. @raise ValueError: if bag is closed |
Method | get |
Returns information about the compression of the bag @return: generator of CompressionTuple(compression, uncompressed, compressed) describing the |
Method | get |
Returns the end time of the bag. @return: a timestamp of the end of the bag @rtype: float, timestamp in seconds, includes fractions of a second |
Method | get |
Returns the number of messages in the bag. Can be filtered by Topic @param topic_filters: One or more topics to filter by @type topic_filters: Could be either a single str or a list of str. @return: The number of messages in the bag, optionally filtered by topic @rtype: int... |
Method | get |
Returns the start time of the bag. @return: a timestamp of the start of the bag @rtype: float, timestamp in seconds, includes fractions of a second |
Method | get |
Coallates info about the type and topics in the bag. |
Method | read |
Read messages from the bag, optionally filtered by topic, timestamp and connection details. @param topics: list of topics or a single topic. if an empty list is given all topics will be read [optional] @type topics: list(str) or str @param start_time: earliest timestamp of message to return [optional] @type start_time: U{genpy... |
Method | reindex |
Reindexes the bag file. Yields position of each chunk for progress. |
Method | set |
Undocumented |
Method | write |
Write a message to the bag. @param topic: name of topic @type topic: str @param msg: message to add to bag, or tuple (if raw) @type msg: Message or tuple of raw message data @param t: ROS time of message publication, if None specified, use current time [optional] @type t: U{genpy... |
Class Variable | chunk |
Undocumented |
Class Variable | compression |
Undocumented |
Property | filename |
Get the filename. |
Property | mode |
Get the mode. |
Property | options |
Get the options. |
Property | size |
Get the size in bytes. |
Property | version |
Get the version. |
Method | _clear |
Undocumented |
Method | _close |
Undocumented |
Method | _create |
@raise ROSBagException: if the bag version is unsupported |
Method | _get |
Undocumented |
Method | _get |
Get the chunk threshold to use for writing. |
Method | _get |
Get the compression method to use for writing. |
Method | _get |
Yield the connections, optionally filtering by topic and/or connection information. |
Method | _get |
Yield index entries on the given connections in the given time range. |
Method | _get |
Yield index entries on the given connections in the given time range in reverse order. |
Method | _get |
Return the first index entry on/before the given time on the given connections |
Method | _get |
Return the first index entry after the given time on the given connections |
Method | _get |
Get the indexes for the given connections. |
Method | _get |
Undocumented |
Method | _is |
Undocumented |
Method | _open |
Undocumented |
Method | _open |
Undocumented |
Method | _open |
Undocumented |
Method | _open |
Undocumented |
Method | _read |
Read the message from the given position in the file. |
Method | _read |
@raise ROSBagException: if the file is empty, or the version line can't be parsed |
Method | _set |
Set the chunk threshold to use for writing. |
Method | _set |
Set the compression method to use for writing. |
Method | _set |
Undocumented |
Method | _start |
Undocumented |
Method | _start |
Undocumented |
Method | _start |
Undocumented |
Method | _stop |
Undocumented |
Method | _stop |
Undocumented |
Method | _write |
Undocumented |
Method | _write |
Undocumented |
Method | _write |
Undocumented |
Method | _write |
Undocumented |
Method | _write |
Undocumented |
Method | _write |
Undocumented |
Instance Variable | _buffer |
Undocumented |
Instance Variable | _chunk |
Undocumented |
Instance Variable | _chunk |
Undocumented |
Instance Variable | _chunk |
Undocumented |
Instance Variable | _chunk |
Undocumented |
Instance Variable | _chunks |
Undocumented |
Instance Variable | _compression |
Undocumented |
Instance Variable | _connection |
Undocumented |
Instance Variable | _connection |
Undocumented |
Instance Variable | _connection |
Undocumented |
Instance Variable | _connections |
Undocumented |
Instance Variable | _curr |
Undocumented |
Instance Variable | _curr |
Undocumented |
Instance Variable | _curr |
Undocumented |
Instance Variable | _curr |
Undocumented |
Instance Variable | _encryptor |
Undocumented |
Instance Variable | _file |
Undocumented |
Instance Variable | _file |
Undocumented |
Instance Variable | _filename |
Undocumented |
Instance Variable | _index |
Undocumented |
Instance Variable | _mode |
Undocumented |
Instance Variable | _output |
Undocumented |
Instance Variable | _reader |
Undocumented |
Instance Variable | _skip |
Undocumented |
Instance Variable | _topic |
Undocumented |
Instance Variable | _version |
Undocumented |
Property | _has |
Undocumented |
Property | _uncompressed |
Undocumented |
Open a bag file. The mode can be 'r', 'w', or 'a' for reading (default), writing or appending. The file will be created if it doesn't exist when opened for writing or appending; it will be truncated when opened for writing. Simultaneous reading and writing is allowed when in writing or appending mode. @param f: filename of bag to open or a stream to read from @type f: str or file @param mode: mode, either 'r', 'w', or 'a' @type mode: str @param compression: compression mode, see U{rosbag.Compression} for valid modes @type compression: str @param chunk_threshold: minimum number of uncompressed bytes per chunk @type chunk_threshold: int @param allow_unindexed: if True, allow opening unindexed bags @type allow_unindexed: bool @param options: the bag options (currently: compression and chunk_threshold) @type options: dict @param skip_index: if True, don't read the connection index records on open [2.0+] @type skip_index: bool @raise ValueError: if any argument is invalid @raise ROSBagException: if an error occurs opening file @raise ROSBagFormatException: if bag format is corrupted
Write the open chunk to disk so subsequent reads will read all messages. @raise ValueError: if bag is closed
Returns information about the compression of the bag @return: generator of CompressionTuple(compression, uncompressed, compressed) describing the
type of compression used, size of the uncompressed data in Bytes, size of the compressed data in Bytes. If no compression is used then uncompressed and compressed data will be equal.
@rtype: generator of CompressionTuple of (str, int, int)
Returns the end time of the bag. @return: a timestamp of the end of the bag @rtype: float, timestamp in seconds, includes fractions of a second
Returns the number of messages in the bag. Can be filtered by Topic @param topic_filters: One or more topics to filter by @type topic_filters: Could be either a single str or a list of str. @return: The number of messages in the bag, optionally filtered by topic @rtype: int
Returns the start time of the bag. @return: a timestamp of the start of the bag @rtype: float, timestamp in seconds, includes fractions of a second
Coallates info about the type and topics in the bag.
Note, it would be nice to filter by type as well, but there appear to be some limitations in the current architecture that prevent that from working when more than one message type is written on the same topic.
@param topic_filters: specify one or more topic to filter by. @type topic_filters: either a single str or a list of str. @return: generator of TypesAndTopicsTuple(types{key:type name, val: md5hash},
- topics{type: msg type (Ex. "std_msgs/String"),
- message_count: the number of messages of the particular type, connections: the number of connections, frequency: the data frequency, key: type name, val: md5hash}) describing the types of messages present
and information about the topics
- @rtype: TypesAndTopicsTuple(dict(str, str),
- TopicTuple(str, int, int, float, str, str))
Read messages from the bag, optionally filtered by topic, timestamp and connection details. @param topics: list of topics or a single topic. if an empty list is given all topics will be read [optional] @type topics: list(str) or str @param start_time: earliest timestamp of message to return [optional] @type start_time: U{genpy.Time} @param end_time: latest timestamp of message to return [optional] @type end_time: U{genpy.Time} @param connection_filter: function to filter connections to include [optional] @type connection_filter: function taking (topic, datatype, md5sum, msg_def, header) and returning bool @param raw: if True, then generate tuples of (datatype, (data, md5sum, position), pytype) @type raw: bool @return: generator of BagMessage(topic, message, timestamp) namedtuples for each message in the bag file @rtype: generator of tuples of (str, U{genpy.Message}, U{genpy.Time}) [not raw] or (str, (str, str, str, tuple, class), U{genpy.Time}) [raw]
Write a message to the bag. @param topic: name of topic @type topic: str @param msg: message to add to bag, or tuple (if raw) @type msg: Message or tuple of raw message data @param t: ROS time of message publication, if None specified, use current time [optional] @type t: U{genpy.Time} @param raw: if True, msg is in raw format, i.e. (msg_type, serialized_bytes, md5sum, pytype) @type raw: bool @raise ValueError: if arguments are invalid or bag is closed