message_filters.delta_filter module
- class message_filters.delta_filter.CachedComparisonHandler
Bases:
ComparisonHandlerImplements cached messages comparison field by field.
- Class:
CachedComparisonHandler implements messages comparison field by field.
A successor to this class should implement
do_fields_fitmethod. If any of the fields provided to thedo_fields_fitmethod do satisfy a comparison conditions the message is accepted. That means that the message is stored in the_message_cacheand themessage_fitsmethod returnsTrue.- do_fields_fit(field_a: Any, field_b: Any) bool
- message_fits(message: rclpy.type_support.MsgT) bool
- class message_filters.delta_filter.ComparisonFilter(comparison_handler: CachedComparisonHandler, message_filter: SimpleFilter | None = None)
Bases:
SimpleFilterROS 2 Comparison filter.
Given a stream of messages, the message is passed down to the next filter if
comparison_handlermessage_fitsmethod returnsTruefor that message.Construct ComparisonFilter.
- Parameters:
comparison_handler – An instance of the CachedComparisonHandler class. Is expected implement a
message_fitsmethod. Ifmessage_fitsreturnsTruefor a provided message, that message is considered valid and is passed to a next filter if any.message_filter – An instance of the
SimpleFilter. The input filter to connect to
- add(message: rclpy.type_support.MsgT)
- connectInput(message_filter)
- message_fits(message: rclpy.type_support.MsgT)
- class message_filters.delta_filter.ComparisonHandler
Bases:
ABC- do_fields_fit(field_a: Any, field_b: Any) bool
- message_fits(message: rclpy.type_support.MsgT) bool
- class message_filters.delta_filter.DeltaCompare(field_getters: Callable[[rclpy.type_support.MsgT], Any])
Bases:
CachedComparisonHandlerImplements delta comparison.
If any of the fields, acquired by any of the
field_gettersdo differ between previously cached and current message, the current message is accepted.Construct DeltaCompare.
- Parameters:
field_getters – A list of callable objects that are expected to retrieve a value of a basic type from a message field for comparison. Any of the
field_gettersis applied to the cached and to the current message. The returned values are compared. If any of these values differ between cached and current message, the current message is accepted.
- do_fields_fit(val_a, val_b) bool
- class message_filters.delta_filter.DeltaFilter(field_getters: list[Callable[[rclpy.type_support.MsgT], Any]], message_filter: SimpleFilter | None = None)
Bases:
ComparisonFilterROS 2 Delta filter.
Given a stream of messages, the message is passed down to the next filter if any of the message fields, that may be acquired by
field_gettershave changed compared to the previously accepted message.Construct a DeltaFilter.
- Parameters:
field_getters – A list of callable objects each of which returns a field value. When message is processed, every field getter is applied to it and to the previously accepted message. If any of the fields have changed between currently processed message and previous value, the message is accepted, stored to the
message_cacheand passed to a next message filter if any.message_filter – A message filter to connect this filter to as a follow up.
- class message_filters.delta_filter.PathDeltaFilter(field_path_list: list[str], message_filter: SimpleFilter | None = None)
Bases:
DeltaFilterROS 2 Path Delta Filter.
Given a stream of messages, the message is passed down to the next filter if any of the message fields, that may be found at any
field_pathof thefield_path_listhave changed compared to the previously accepted message.Construct a DeltaFilter.
- Parameters:
field_path_list – A list of field paths to access fields by. A field path is expected to be a dot-separated string. Eg:
a.b.c.dwheredis a field ofc,cis a field ofbe.t.c.message_filter – A message filter to connect this filter to as a follow up.
- get_field_by_path(message: rclpy.type_support.MsgT, field_path: str)