message_filters package
Module contents
Message Filter Objects
- class message_filters.ApproximateTimeSynchronizer(fs, queue_size, slop, allow_headerless=False)
Bases:
TimeSynchronizerApproximately synchronizes messages by their timestamps.
ApproximateTimeSynchronizersynchronizes incoming message filters by the timestamps contained in their messages’ headers. The API is the same as TimeSynchronizer except for an extra slop parameter in the constructor that defines the delay (in seconds) with which messages can be synchronized. Theallow_headerlessoption specifies whether to allow storing headerless messages with current ROS time instead of timestamp. You should avoid this as much as you can, since the delays are unpredictable.- add(msg, my_queue, my_queue_index=None)
- class message_filters.Cache(f, cache_size=1, allow_headerless=False)
Bases:
SimpleFilterStores a time history of messages.
Given a stream of messages, the most recent
cache_sizemessages are cached in a ring buffer, from which time intervals of the cache can then be retrieved by the client. Theallow_headerlessoption specifies whether to allow storing headerless messages with current ROS time instead of timestamp. You should avoid this as much as you can, since the delays are unpredictable.- add(msg)
- connectInput(f)
- getElemAfterTime(stamp)
Return the oldest element after or equal the passed time stamp.
- getElemBeforeTime(stamp)
Return the newest element before or equal the passed time stamp.
- getInterval(from_stamp, to_stamp)
Query the current cache content between from_stamp to to_stamp.
- getLast()
- getLastestTime()
Return the newest recorded timestamp.
- getOldestTime()
Return the oldest recorded timestamp.
- class message_filters.Chain(message_filter=None)
Bases:
SimpleFilterChains a dynamic number of simple filters together.
Allows retrieval of filters by index after they are added.
The Chain filter provides a container for simple filters. It allows you to store an N-long set of filters inside a single structure, making it much easier to manage them.
Adding filters to the chain is done by adding shared_ptrs of them to the filter. They are automatically connected to each other and the output of the last filter in the chain is forwarded to the callback you’ve registered with Chain::registerCallback.
- class FilterInfo(message_filter: <built-in function any>, connection_callback_index: int)
Bases:
object- connection_callback_index: int
- message_filter: any
- add(message)
- addFilter(message_filter)
- connectInput(message_filter)
- getFilter(index: int)
- class message_filters.SimpleFilter
Bases:
object- registerCallback(cb, *args)
Register a callback function cb to be called when this filter has output. The filter calls the function
cbwith a filter-dependent list of arguments,followed by the call-supplied argumentsargs.
- signalMessage(*msg)
- class message_filters.Subscriber(*args, **kwargs)
Bases:
SimpleFilterROS2 subscription filter,Identical arguments as
rclpy.Subscriber.This class acts as a highest-level filter, simply passing messages from a ROS2 subscription through to the filters which have connected to it.
- callback(msg)
- getTopic()
- class message_filters.TimeSynchronizer(fs, queue_size)
Bases:
SimpleFilterSynchronizes messages by their timestamps.
TimeSynchronizersynchronizes incoming message filters by the timestamps contained in their messages’ headers. TimeSynchronizer listens on multiple input message filtersfs, and invokes the callback when it has a collection of messages with matching timestamps.The signature of the callback function is:
def callback(msg1, … msgN):
where N is the number of input message filters, and each message is the output of the corresponding filter in
fs. The requiredqueue sizeparameter specifies how many sets of messages it should store from each input filter (by timestamp) while waiting for messages to arrive and complete their “set”.- add(msg, my_queue, my_queue_index=None)
- connectInput(fs)