Classes | Public Types | Public Member Functions | Private Types | Private Member Functions | Static Private Member Functions | Private Attributes | List of all members
tf2_ros::MessageFilter< M > Class Template Reference

Follows the patterns set by the message_filters package to implement a filter which only passes messages through once there is transform data available. More...

#include <message_filter.h>

Inheritance diagram for tf2_ros::MessageFilter< M >:
Inheritance graph
[legend]

Classes

struct  CBQueueCallback
 
struct  MessageInfo
 

Public Types

typedef boost::function< void(const MConstPtr &, FilterFailureReason)> FailureCallback
 
typedef boost::signals2::signal< void(const MConstPtr &, FilterFailureReason)> FailureSignal
 
typedef boost::shared_ptr< M const > MConstPtr
 
typedef ros::MessageEvent< M const > MEvent
 
- Public Types inherited from tf2_ros::MessageFilterBase
typedef std::vector< std::string > V_string
 
- Public Types inherited from message_filters::SimpleFilter< M >
typedef boost::function< void(const MConstPtr &)> Callback
 
typedef boost::function< void(const EventType &)> EventCallback
 
typedef ros::MessageEvent< M const > EventType
 
typedef boost::shared_ptr< M const > MConstPtr
 

Public Member Functions

void add (const MEvent &evt)
 
void add (const MConstPtr &message)
 Manually add a message into this filter. More...
 
void clear ()
 Clear any messages currently in the queue. More...
 
template<class F >
void connectInput (F &f)
 Connect this filter's input to another filter's output. If this filter is already connected, disconnects first. More...
 
virtual uint32_t getQueueSize ()
 
std::string getTargetFramesString ()
 Get the target frames as a string for debugging. More...
 
 MessageFilter (tf2::BufferCore &bc, const std::string &target_frame, uint32_t queue_size, const ros::NodeHandle &nh)
 Constructor. More...
 
template<class F >
 MessageFilter (F &f, tf2::BufferCore &bc, const std::string &target_frame, uint32_t queue_size, const ros::NodeHandle &nh)
 Constructor. More...
 
 MessageFilter (tf2::BufferCore &bc, const std::string &target_frame, uint32_t queue_size, ros::CallbackQueueInterface *cbqueue)
 Constructor. More...
 
template<class F >
 MessageFilter (F &f, tf2::BufferCore &bc, const std::string &target_frame, uint32_t queue_size, ros::CallbackQueueInterface *cbqueue)
 Constructor. More...
 
message_filters::Connection registerFailureCallback (const FailureCallback &callback)
 Register a callback to be called when a message is about to be dropped. More...
 
virtual void setQueueSize (uint32_t new_queue_size)
 
void setTargetFrame (const std::string &target_frame)
 Set the frame you need to be able to transform to before getting a message callback. More...
 
void setTargetFrames (const V_string &target_frames)
 Set the frames you need to be able to transform to before getting a message callback. More...
 
void setTolerance (const ros::Duration &tolerance)
 Set the required tolerance for the notifier to return true. More...
 
 ~MessageFilter ()
 Destructor. More...
 
- Public Member Functions inherited from tf2_ros::MessageFilterBase
virtual ~MessageFilterBase ()
 
- Public Member Functions inherited from message_filters::SimpleFilter< M >
const std::string & getName ()
 
Connection registerCallback (const C &callback)
 
Connection registerCallback (void(T::*callback)(P), T *t)
 
Connection registerCallback (void(*callback)(P))
 
Connection registerCallback (const boost::function< void(P)> &callback)
 
void setName (const std::string &name)
 

Private Types

typedef std::list< MessageInfoL_MessageInfo
 
typedef std::vector< tf2::TransformableRequestHandleV_TransformableRequestHandle
 

Private Member Functions

void checkFailures ()
 
void disconnectFailure (const message_filters::Connection &c)
 
void incomingMessage (const ros::MessageEvent< M const > &evt)
 Callback that happens when we receive a message on the message topic. More...
 
void init ()
 
void messageDropped (const MEvent &evt, FilterFailureReason reason)
 
void messageReady (const MEvent &evt)
 
void signalFailure (const MEvent &evt, FilterFailureReason reason)
 
void transformable (tf2::TransformableRequestHandle request_handle, const std::string &target_frame, const std::string &source_frame, ros::Time time, tf2::TransformableResult result)
 

Static Private Member Functions

static std::string stripSlash (const std::string &in)
 

Private Attributes

tf2::BufferCorebc_
 The Transformer used to determine if transformation data is available. More...
 
tf2::TransformableCallbackHandle callback_handle_
 
ros::CallbackQueueInterfacecallback_queue_
 
uint64_t dropped_message_count_
 
uint32_t expected_success_count_
 
uint64_t failed_out_the_back_count_
 
FailureSignal failure_signal_
 
boost::mutex failure_signal_mutex_
 
uint64_t incoming_message_count_
 
std::string last_out_the_back_frame_
 
ros::Time last_out_the_back_stamp_
 
message_filters::Connection message_connection_
 
uint32_t message_count_
 The number of messages in the list. Used because <container>.size() may have linear cost. More...
 
L_MessageInfo messages_
 
boost::shared_mutex messages_mutex_
 The mutex used for locking message list operations. More...
 
ros::WallTime next_failure_warning_
 
uint32_t queue_size_
 The maximum number of messages we queue up. More...
 
uint64_t successful_transform_count_
 
V_string target_frames_
 The frames we need to be able to transform to before a message is ready. More...
 
boost::mutex target_frames_mutex_
 A mutex to protect access to the target_frames_ list and target_frames_string. More...
 
std::string target_frames_string_
 
ros::Duration time_tolerance_
 Provide additional tolerance on time for messages which are stamped but can have associated duration. More...
 
uint64_t transform_message_count_
 
bool warned_about_empty_frame_id_
 

Additional Inherited Members

- Protected Member Functions inherited from message_filters::SimpleFilter< M >
void signalMessage (const MConstPtr &msg)
 
void signalMessage (const ros::MessageEvent< M const > &event)
 

Detailed Description

template<class M>
class tf2_ros::MessageFilter< M >

Follows the patterns set by the message_filters package to implement a filter which only passes messages through once there is transform data available.

The callbacks used in this class are of the same form as those used by roscpp's message callbacks.

MessageFilter is templated on a message type.

Example Usage

If you want to hook a MessageFilter into a ROS topic:

message_filters::Subscriber<MessageType> sub(node_handle_, "topic", 10);
tf::MessageFilter<MessageType> tf_filter(sub, tf_listener_, "/map", 10);
tf_filter.registerCallback(&MyClass::myCallback, this);

Definition at line 104 of file message_filter.h.

Member Typedef Documentation

◆ FailureCallback

template<class M>
typedef boost::function<void(const MConstPtr&, FilterFailureReason)> tf2_ros::MessageFilter< M >::FailureCallback

Definition at line 109 of file message_filter.h.

◆ FailureSignal

template<class M>
typedef boost::signals2::signal<void(const MConstPtr&, FilterFailureReason)> tf2_ros::MessageFilter< M >::FailureSignal

Definition at line 110 of file message_filter.h.

◆ L_MessageInfo

template<class M>
typedef std::list<MessageInfo> tf2_ros::MessageFilter< M >::L_MessageInfo
private

Definition at line 685 of file message_filter.h.

◆ MConstPtr

template<class M>
typedef boost::shared_ptr<M const> tf2_ros::MessageFilter< M >::MConstPtr

Definition at line 107 of file message_filter.h.

◆ MEvent

template<class M>
typedef ros::MessageEvent<M const> tf2_ros::MessageFilter< M >::MEvent

Definition at line 108 of file message_filter.h.

◆ V_TransformableRequestHandle

template<class M>
typedef std::vector<tf2::TransformableRequestHandle> tf2_ros::MessageFilter< M >::V_TransformableRequestHandle
private

Definition at line 674 of file message_filter.h.

Constructor & Destructor Documentation

◆ MessageFilter() [1/4]

template<class M>
tf2_ros::MessageFilter< M >::MessageFilter ( tf2::BufferCore bc,
const std::string &  target_frame,
uint32_t  queue_size,
const ros::NodeHandle nh 
)
inline

Constructor.

Parameters
bcThe tf2::BufferCore this filter should use
target_frameThe frame this filter should attempt to transform to. To use multiple frames, pass an empty string here and use the setTargetFrames() function.
queue_sizeThe number of messages to queue up before throwing away old ones. 0 means infinite (dangerous).
nhThe NodeHandle whose callback queue we should add callbacks to

Definition at line 126 of file message_filter.h.

◆ MessageFilter() [2/4]

template<class M>
template<class F >
tf2_ros::MessageFilter< M >::MessageFilter ( F &  f,
tf2::BufferCore bc,
const std::string &  target_frame,
uint32_t  queue_size,
const ros::NodeHandle nh 
)
inline

Constructor.

Parameters
fThe filter to connect this filter's input to. Often will be a message_filters::Subscriber.
bcThe tf2::BufferCore this filter should use
target_frameThe frame this filter should attempt to transform to. To use multiple frames, pass an empty string here and use the setTargetFrames() function.
queue_sizeThe number of messages to queue up before throwing away old ones. 0 means infinite (dangerous).
nhThe NodeHandle whose callback queue we should add callbacks to

Definition at line 146 of file message_filter.h.

◆ MessageFilter() [3/4]

template<class M>
tf2_ros::MessageFilter< M >::MessageFilter ( tf2::BufferCore bc,
const std::string &  target_frame,
uint32_t  queue_size,
ros::CallbackQueueInterface cbqueue 
)
inline

Constructor.

Parameters
bcThe tf2::BufferCore this filter should use
target_frameThe frame this filter should attempt to transform to. To use multiple frames, pass an empty string here and use the setTargetFrames() function.
queue_sizeThe number of messages to queue up before throwing away old ones. 0 means infinite (dangerous).
cbqueueThe callback queue to add callbacks to. If NULL, callbacks will happen from whatever thread either a) add() is called, which will generally be when the previous filter in the chain outputs a message, or b) tf2::BufferCore::setTransform() is called

Definition at line 168 of file message_filter.h.

◆ MessageFilter() [4/4]

template<class M>
template<class F >
tf2_ros::MessageFilter< M >::MessageFilter ( F &  f,
tf2::BufferCore bc,
const std::string &  target_frame,
uint32_t  queue_size,
ros::CallbackQueueInterface cbqueue 
)
inline

Constructor.

Parameters
fThe filter to connect this filter's input to. Often will be a message_filters::Subscriber.
bcThe tf2::BufferCore this filter should use
target_frameThe frame this filter should attempt to transform to. To use multiple frames, pass an empty string here and use the setTargetFrames() function.
queue_sizeThe number of messages to queue up before throwing away old ones. 0 means infinite (dangerous).
cbqueueThe callback queue to add callbacks to. If NULL, callbacks will happen from whatever thread either a) add() is called, which will generally be when the previous filter in the chain outputs a message, or b) tf2::BufferCore::setTransform() is called

Definition at line 190 of file message_filter.h.

◆ ~MessageFilter()

template<class M>
tf2_ros::MessageFilter< M >::~MessageFilter ( )
inline

Destructor.

Definition at line 215 of file message_filter.h.

Member Function Documentation

◆ add() [1/2]

template<class M>
void tf2_ros::MessageFilter< M >::add ( const MEvent evt)
inline

Definition at line 297 of file message_filter.h.

◆ add() [2/2]

template<class M>
void tf2_ros::MessageFilter< M >::add ( const MConstPtr message)
inline

Manually add a message into this filter.

Note
If the message (or any other messages in the queue) are immediately transformable this will immediately call through to the output callback, possibly multiple times

Definition at line 412 of file message_filter.h.

◆ checkFailures()

template<class M>
void tf2_ros::MessageFilter< M >::checkFailures ( )
inlineprivate

Definition at line 558 of file message_filter.h.

◆ clear()

template<class M>
void tf2_ros::MessageFilter< M >::clear ( )
inlinevirtual

Clear any messages currently in the queue.

Implements tf2_ros::MessageFilterBase.

Definition at line 278 of file message_filter.h.

◆ connectInput()

template<class M>
template<class F >
void tf2_ros::MessageFilter< M >::connectInput ( F &  f)
inline

Connect this filter's input to another filter's output. If this filter is already connected, disconnects first.

Definition at line 206 of file message_filter.h.

◆ disconnectFailure()

template<class M>
void tf2_ros::MessageFilter< M >::disconnectFailure ( const message_filters::Connection c)
inlineprivate

Definition at line 643 of file message_filter.h.

◆ getQueueSize()

template<class M>
virtual uint32_t tf2_ros::MessageFilter< M >::getQueueSize ( )
inlinevirtual

Definition at line 436 of file message_filter.h.

◆ getTargetFramesString()

template<class M>
std::string tf2_ros::MessageFilter< M >::getTargetFramesString ( )
inline

Get the target frames as a string for debugging.

Definition at line 259 of file message_filter.h.

◆ incomingMessage()

template<class M>
void tf2_ros::MessageFilter< M >::incomingMessage ( const ros::MessageEvent< M const > &  evt)
inlineprivate

Callback that happens when we receive a message on the message topic.

Definition at line 553 of file message_filter.h.

◆ init()

template<class M>
void tf2_ros::MessageFilter< M >::init ( )
inlineprivate

Definition at line 444 of file message_filter.h.

◆ messageDropped()

template<class M>
void tf2_ros::MessageFilter< M >::messageDropped ( const MEvent evt,
FilterFailureReason  reason 
)
inlineprivate

Definition at line 617 of file message_filter.h.

◆ messageReady()

template<class M>
void tf2_ros::MessageFilter< M >::messageReady ( const MEvent evt)
inlineprivate

Definition at line 630 of file message_filter.h.

◆ registerFailureCallback()

template<class M>
message_filters::Connection tf2_ros::MessageFilter< M >::registerFailureCallback ( const FailureCallback callback)
inline

Register a callback to be called when a message is about to be dropped.

Parameters
callbackThe callback to call

Definition at line 425 of file message_filter.h.

◆ setQueueSize()

template<class M>
virtual void tf2_ros::MessageFilter< M >::setQueueSize ( uint32_t  new_queue_size)
inlinevirtual

Definition at line 431 of file message_filter.h.

◆ setTargetFrame()

template<class M>
void tf2_ros::MessageFilter< M >::setTargetFrame ( const std::string &  target_frame)
inlinevirtual

Set the frame you need to be able to transform to before getting a message callback.

Implements tf2_ros::MessageFilterBase.

Definition at line 231 of file message_filter.h.

◆ setTargetFrames()

template<class M>
void tf2_ros::MessageFilter< M >::setTargetFrames ( const V_string target_frames)
inlinevirtual

Set the frames you need to be able to transform to before getting a message callback.

Implements tf2_ros::MessageFilterBase.

Definition at line 241 of file message_filter.h.

◆ setTolerance()

template<class M>
void tf2_ros::MessageFilter< M >::setTolerance ( const ros::Duration tolerance)
inlinevirtual

Set the required tolerance for the notifier to return true.

Implements tf2_ros::MessageFilterBase.

Definition at line 268 of file message_filter.h.

◆ signalFailure()

template<class M>
void tf2_ros::MessageFilter< M >::signalFailure ( const MEvent evt,
FilterFailureReason  reason 
)
inlineprivate

Definition at line 649 of file message_filter.h.

◆ stripSlash()

template<class M>
static std::string tf2_ros::MessageFilter< M >::stripSlash ( const std::string &  in)
inlinestaticprivate

Definition at line 656 of file message_filter.h.

◆ transformable()

template<class M>
void tf2_ros::MessageFilter< M >::transformable ( tf2::TransformableRequestHandle  request_handle,
const std::string &  target_frame,
const std::string &  source_frame,
ros::Time  time,
tf2::TransformableResult  result 
)
inlineprivate

Definition at line 459 of file message_filter.h.

Member Data Documentation

◆ bc_

template<class M>
tf2::BufferCore& tf2_ros::MessageFilter< M >::bc_
private

The Transformer used to determine if transformation data is available.

Definition at line 667 of file message_filter.h.

◆ callback_handle_

template<class M>
tf2::TransformableCallbackHandle tf2_ros::MessageFilter< M >::callback_handle_
private

Definition at line 672 of file message_filter.h.

◆ callback_queue_

template<class M>
ros::CallbackQueueInterface* tf2_ros::MessageFilter< M >::callback_queue_
private

Definition at line 711 of file message_filter.h.

◆ dropped_message_count_

template<class M>
uint64_t tf2_ros::MessageFilter< M >::dropped_message_count_
private

Definition at line 697 of file message_filter.h.

◆ expected_success_count_

template<class M>
uint32_t tf2_ros::MessageFilter< M >::expected_success_count_
private

Definition at line 689 of file message_filter.h.

◆ failed_out_the_back_count_

template<class M>
uint64_t tf2_ros::MessageFilter< M >::failed_out_the_back_count_
private

Definition at line 694 of file message_filter.h.

◆ failure_signal_

template<class M>
FailureSignal tf2_ros::MessageFilter< M >::failure_signal_
private

Definition at line 708 of file message_filter.h.

◆ failure_signal_mutex_

template<class M>
boost::mutex tf2_ros::MessageFilter< M >::failure_signal_mutex_
private

Definition at line 709 of file message_filter.h.

◆ incoming_message_count_

template<class M>
uint64_t tf2_ros::MessageFilter< M >::incoming_message_count_
private

Definition at line 696 of file message_filter.h.

◆ last_out_the_back_frame_

template<class M>
std::string tf2_ros::MessageFilter< M >::last_out_the_back_frame_
private

Definition at line 700 of file message_filter.h.

◆ last_out_the_back_stamp_

template<class M>
ros::Time tf2_ros::MessageFilter< M >::last_out_the_back_stamp_
private

Definition at line 699 of file message_filter.h.

◆ message_connection_

template<class M>
message_filters::Connection tf2_ros::MessageFilter< M >::message_connection_
private

Definition at line 706 of file message_filter.h.

◆ message_count_

template<class M>
uint32_t tf2_ros::MessageFilter< M >::message_count_
private

The number of messages in the list. Used because <container>.size() may have linear cost.

Definition at line 687 of file message_filter.h.

◆ messages_

template<class M>
L_MessageInfo tf2_ros::MessageFilter< M >::messages_
private

Definition at line 686 of file message_filter.h.

◆ messages_mutex_

template<class M>
boost::shared_mutex tf2_ros::MessageFilter< M >::messages_mutex_
private

The mutex used for locking message list operations.

Definition at line 688 of file message_filter.h.

◆ next_failure_warning_

template<class M>
ros::WallTime tf2_ros::MessageFilter< M >::next_failure_warning_
private

Definition at line 702 of file message_filter.h.

◆ queue_size_

template<class M>
uint32_t tf2_ros::MessageFilter< M >::queue_size_
private

The maximum number of messages we queue up.

Definition at line 671 of file message_filter.h.

◆ successful_transform_count_

template<class M>
uint64_t tf2_ros::MessageFilter< M >::successful_transform_count_
private

Definition at line 693 of file message_filter.h.

◆ target_frames_

template<class M>
V_string tf2_ros::MessageFilter< M >::target_frames_
private

The frames we need to be able to transform to before a message is ready.

Definition at line 668 of file message_filter.h.

◆ target_frames_mutex_

template<class M>
boost::mutex tf2_ros::MessageFilter< M >::target_frames_mutex_
private

A mutex to protect access to the target_frames_ list and target_frames_string.

Definition at line 670 of file message_filter.h.

◆ target_frames_string_

template<class M>
std::string tf2_ros::MessageFilter< M >::target_frames_string_
private

Definition at line 669 of file message_filter.h.

◆ time_tolerance_

template<class M>
ros::Duration tf2_ros::MessageFilter< M >::time_tolerance_
private

Provide additional tolerance on time for messages which are stamped but can have associated duration.

Definition at line 704 of file message_filter.h.

◆ transform_message_count_

template<class M>
uint64_t tf2_ros::MessageFilter< M >::transform_message_count_
private

Definition at line 695 of file message_filter.h.

◆ warned_about_empty_frame_id_

template<class M>
bool tf2_ros::MessageFilter< M >::warned_about_empty_frame_id_
private

Definition at line 691 of file message_filter.h.


The documentation for this class was generated from the following file:


tf2_ros
Author(s): Eitan Marder-Eppstein, Wim Meeussen
autogenerated on Tue Oct 15 2019 03:13:10