Template Class ComparisonFilter

Inheritance Relationships

Base Type

Class Documentation

template<typename MessageType, template<typename HandlerMessageType> typename HandlerType>
class ComparisonFilter : public message_filters::SimpleFilter<MessageType>

ROS 2 Comparison filter.

Given a stream of messages, the message is passed down to the next filter if ‘comparison_handler’ ‘message_fits’ method returns ‘true’ for that message.

Param HandlerType<HandlerMessageType>:

[template] Specification of the CachedComparisonHandler successor class. Is expected implement a message_fits method. If message_fits returns True for a provided message, that message is considered valid and is passed to a next filter if any.

Public Types

typedef std::shared_ptr<MessageType const> MConstPtr
typedef MessageEvent<MessageType const> EventType
typedef std::function<MFieldType(const MConstPtr&)> FieldGetterFunctionType

Public Functions

template<typename FilterType>
inline explicit ComparisonFilter(FilterType &filter, std::forward_list<FieldGetterFunctionType> field_getters)

Initialize ComparisonFilter.

Parameters:
  • filter – An instance of the ‘SimpleFilter’ successor class. The input filter to connect to.

  • 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_getters’ is 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.

virtual ~ComparisonFilter() = default
template<typename FilterType>
inline void connectInput(FilterType &filter)
inline void add(const EventType &evt)