rosros 0.2.5
Simple unified interface to ROS1 / ROS2 Python API
|
ROS2 bag interface, partially mimicking rosbag.Bag. More...
Public Member Functions | |
__init__ (self, filename, mode="a", *_, **__) | |
__enter__ (self) | |
Context manager entry. | |
__exit__ (self, exc_type, exc_value, traceback) | |
Context manager exit, closes bag. | |
__iter__ (self) | |
Iterates over all messages in the bag. | |
__str__ (self) | |
Returns informative text for bag, with a full overview of topics and types. | |
close (self) | |
Closes the bag file. | |
flush (self) | |
Does nothing (ROS1 API conformity stand-in). | |
get_end_time (self) | |
Returns the end time of the bag, as UNIX timestamp. | |
get_message_class (self, typename, typehash=None) | |
Returns ROS2 message type class. | |
get_message_count (self, topic_filters=None) | |
Returns the number of messages in the bag. | |
get_message_definition (self, msg_or_type) | |
Returns ROS2 message type definition full text, including subtype definitions. | |
get_message_type_hash (self, msg_or_type) | |
Returns ROS2 message type MD5 hash. | |
get_qoses (self, topic, typename) | |
Returns topic Quality-of-Service profiles as a list of dicts, or None if not available. | |
get_start_time (self) | |
Returns the start time of the bag, as UNIX timestamp. | |
get_topic_info (self, counts=False) | |
Returns topic and message type metainfo as {(topic, typename, typehash): count}. | |
get_type_and_topic_info (self, topic_filters=None) | |
Returns thorough metainfo on topic and message types. | |
read_messages (self, topics=None, start_time=None, end_time=None, raw=False, *_, **__) | |
Yields messages from the bag in chronological order. | |
write (self, topic, msg, t=None, raw=False, qoses=None, **__) | |
Writes a message to the bag. | |
Public Attributes | |
filename | |
Bagfile path. | |
Static Public Attributes | |
BagMessage = collections.namedtuple("BagMessage", "topic message timestamp") | |
Returned from read_messages() as (topic name, ROS message, rclpy.Time). | |
str | CREATE_SQL |
ROS2 bag SQLite schema. | |
str | EXTENSION = ".db3" |
Default extension for bag files. | |
TopicTuple | |
Returned from get_type_and_topic_info() as (typename, message count, connection count, median frequency). | |
TypesAndTopicsTuple = collections.namedtuple("TypesAndTopicsTuple", ["msg_types", "topics"]) | |
Returned from get_type_and_topic_info() as ({typename: typehash}, {topic name: TopicTuple}). | |
Protected Member Functions | |
_has_table (self, name) | |
Returns whether specified table exists in database. | |
Protected Attributes | |
_counts | |
_db | |
_dbtopics | |
_mode | |
_qoses | |
_types | |
Properties | |
mode = property | |
Returns file open mode. | |
size = property | |
Returns current file size in bytes (including journaling files). | |
rosros.ros2.Bag.__init__ | ( | self, | |
filename, | |||
mode = "a" , |
|||
* | _, | ||
** | __ | ||
) |
rosros.ros2.Bag.__exit__ | ( | self, | |
exc_type, | |||
exc_value, | |||
traceback | |||
) |
rosros.ros2.Bag.__iter__ | ( | self | ) |
rosros.ros2.Bag.__str__ | ( | self | ) |
|
protected |
rosros.ros2.Bag.flush | ( | self | ) |
rosros.ros2.Bag.get_end_time | ( | self | ) |
rosros.ros2.Bag.get_message_class | ( | self, | |
typename, | |||
typehash = None |
|||
) |
rosros.ros2.Bag.get_message_count | ( | self, | |
topic_filters = None |
|||
) |
rosros.ros2.Bag.get_message_definition | ( | self, | |
msg_or_type | |||
) |
rosros.ros2.Bag.get_message_type_hash | ( | self, | |
msg_or_type | |||
) |
rosros.ros2.Bag.get_qoses | ( | self, | |
topic, | |||
typename | |||
) |
rosros.ros2.Bag.get_start_time | ( | self | ) |
rosros.ros2.Bag.get_topic_info | ( | self, | |
counts = False |
|||
) |
rosros.ros2.Bag.get_type_and_topic_info | ( | self, | |
topic_filters = None |
|||
) |
Returns thorough metainfo on topic and message types.
topic_filters | list of topics or a single topic to filter by, if at all |
rosros.ros2.Bag.read_messages | ( | self, | |
topics = None , |
|||
start_time = None , |
|||
end_time = None , |
|||
raw = False , |
|||
* | _, | ||
** | __ | ||
) |
Yields messages from the bag in chronological order.
topics | list of topics or a single topic to filter by, if at all |
start_time | earliest timestamp of message to return, as `rclpy.Time` or convertible (int/float/duration/datetime/decimal/builtin_interfaces.Time)
|
end_time | latest timestamp of message to return, as `rclpy.Time` or convertible (int/float/duration/datetime/decimal/builtin_interfaces.Time)
|
raw | if True, then returned messages are tuples of (typename, bytes, typehash, typeclass)
|
rosros.ros2.Bag.write | ( | self, | |
topic, | |||
msg, | |||
t = None , |
|||
raw = False , |
|||
qoses = None , |
|||
** | __ | ||
) |
Writes a message to the bag.
topic | name of topic |
msg | ROS2 message |
t | message timestamp if not using current wall time, as `rclpy.Time` or convertible (int/float/duration/datetime/decimal/builtin_interfaces.Time)
|
raw | if true, msg is expected as a tuple starting with (typename, bytes, typehash, )
|
qoses | list of Quality-of-Service profile dictionaries for topic, if any; inserted to topics-table only if first message for topic in bag |
|
static |
|
static |
ROS2 bag SQLite schema.
|
static |
|
static |
|
static |
|
static |
|
static |