message_filter.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2010, Willow Garage, Inc.
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions are met:
7  *
8  * * Redistributions of source code must retain the above copyright
9  * notice, this list of conditions and the following disclaimer.
10  * * Redistributions in binary form must reproduce the above copyright
11  * notice, this list of conditions and the following disclaimer in the
12  * documentation and/or other materials provided with the distribution.
13  * * Neither the name of the Willow Garage, Inc. nor the names of its
14  * contributors may be used to endorse or promote products derived from
15  * this software without specific prior written permission.
16  *
17  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
18  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
21  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
22  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
23  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
24  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
25  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
26  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
27  * POSSIBILITY OF SUCH DAMAGE.
28  */
29 
32 #ifndef TF2_ROS_MESSAGE_FILTER_H
33 #define TF2_ROS_MESSAGE_FILTER_H
34 
35 #include <tf2/buffer_core.h>
36 
37 #include <string>
38 #include <list>
39 #include <vector>
40 #include <boost/function.hpp>
41 #include <boost/bind/bind.hpp>
42 #include <boost/shared_ptr.hpp>
43 #include <boost/thread.hpp>
44 
47 
48 #include <ros/node_handle.h>
50 #include <ros/init.h>
51 
52 #define TF2_ROS_MESSAGEFILTER_DEBUG(fmt, ...) \
53  ROS_DEBUG_NAMED("message_filter", std::string(std::string("MessageFilter [target=%s]: ") + std::string(fmt)).c_str(), getTargetFramesString().c_str(), __VA_ARGS__)
54 
55 #define TF2_ROS_MESSAGEFILTER_WARN(fmt, ...) \
56  ROS_WARN_NAMED("message_filter", std::string(std::string("MessageFilter [target=%s]: ") + std::string(fmt)).c_str(), getTargetFramesString().c_str(), __VA_ARGS__)
57 
58 namespace tf2_ros
59 {
60 
61 namespace filter_failure_reasons
62 {
64 {
71 };
72 }
74 
76 {
77 public:
78  typedef std::vector<std::string> V_string;
79 
80  virtual ~MessageFilterBase(){}
81  virtual void clear() = 0;
82  virtual void setTargetFrame(const std::string& target_frame) = 0;
83  virtual void setTargetFrames(const V_string& target_frames) = 0;
84  virtual void setTolerance(const ros::Duration& tolerance) = 0;
85 };
86 
103 template<class M>
105 {
106 public:
109  typedef boost::function<void(const MConstPtr&, FilterFailureReason)> FailureCallback;
110  typedef boost::signals2::signal<void(const MConstPtr&, FilterFailureReason)> FailureSignal;
111 
112  // If you hit this assert your message does not have a header, or does not have the HasHeader trait defined for it
113  // Actually, we need to check that the message has a header, or that it
114  // has the FrameId and Stamp traits. However I don't know how to do that
115  // so simply commenting out for now.
116  //ROS_STATIC_ASSERT(ros::message_traits::HasHeader<M>::value);
117 
126  MessageFilter(tf2::BufferCore& bc, const std::string& target_frame, uint32_t queue_size, const ros::NodeHandle& nh)
127  : bc_(bc)
128  , queue_size_(queue_size)
129  , callback_queue_(nh.getCallbackQueue())
130  {
131  init();
132 
133  setTargetFrame(target_frame);
134  }
135 
145  template<class F>
146  MessageFilter(F& f, tf2::BufferCore& bc, const std::string& target_frame, uint32_t queue_size, const ros::NodeHandle& nh)
147  : bc_(bc)
148  , queue_size_(queue_size)
149  , callback_queue_(nh.getCallbackQueue())
150  {
151  init();
152 
153  setTargetFrame(target_frame);
154 
155  connectInput(f);
156  }
157 
168  MessageFilter(tf2::BufferCore& bc, const std::string& target_frame, uint32_t queue_size, ros::CallbackQueueInterface* cbqueue)
169  : bc_(bc)
170  , queue_size_(queue_size)
171  , callback_queue_(cbqueue)
172  {
173  init();
174 
175  setTargetFrame(target_frame);
176  }
177 
189  template<class F>
190  MessageFilter(F& f, tf2::BufferCore& bc, const std::string& target_frame, uint32_t queue_size, ros::CallbackQueueInterface* cbqueue)
191  : bc_(bc)
192  , queue_size_(queue_size)
193  , callback_queue_(cbqueue)
194  {
195  init();
196 
197  setTargetFrame(target_frame);
198 
199  connectInput(f);
200  }
201 
205  template<class F>
206  void connectInput(F& f)
207  {
209  message_connection_ = f.registerCallback(&MessageFilter::incomingMessage, this);
210  }
211 
216  {
220 
221  TF2_ROS_MESSAGEFILTER_DEBUG("Successful Transforms: %llu, Discarded due to age: %llu, Transform messages received: %llu, Messages received: %llu, Total dropped: %llu",
222  (long long unsigned int)successful_transform_count_,
223  (long long unsigned int)failed_out_the_back_count_, (long long unsigned int)transform_message_count_,
224  (long long unsigned int)incoming_message_count_, (long long unsigned int)dropped_message_count_);
225 
226  boost::unique_lock<boost::shared_mutex> lock(cbqueue_mutex_); // ensure that no more callback queue calls are active
227  }
228 
232  void setTargetFrame(const std::string& target_frame)
233  {
234  V_string frames;
235  frames.push_back(target_frame);
236  setTargetFrames(frames);
237  }
238 
242  void setTargetFrames(const V_string& target_frames)
243  {
244  boost::mutex::scoped_lock frames_lock(target_frames_mutex_);
245 
246  target_frames_.resize(target_frames.size());
247  std::transform(target_frames.begin(), target_frames.end(), target_frames_.begin(), this->stripSlash);
249 
250  std::stringstream ss;
251  for (V_string::iterator it = target_frames_.begin(); it != target_frames_.end(); ++it)
252  {
253  ss << *it << " ";
254  }
255  target_frames_string_ = ss.str();
256  }
260  std::string getTargetFramesString()
261  {
262  boost::mutex::scoped_lock lock(target_frames_mutex_);
263  return target_frames_string_;
264  };
265 
269  void setTolerance(const ros::Duration& tolerance)
270  {
271  boost::mutex::scoped_lock lock(target_frames_mutex_);
272  time_tolerance_ = tolerance;
274  }
275 
279  void clear()
280  {
282  callback_handle_ = bc_.addTransformableCallback(boost::bind(&MessageFilter::transformable, this, boost::placeholders::_1, boost::placeholders::_2, boost::placeholders::_3, boost::placeholders::_4, boost::placeholders::_5));
283 
284  // acquire after remove/addTransformableCallback to avoid deadlock!
285  boost::unique_lock<boost::shared_mutex> unique_lock(messages_mutex_);
286  messages_.clear();
287  message_count_ = 0;
288 
289  // remove pending callbacks in callback queue as well
290  if (callback_queue_)
291  callback_queue_->removeByID((uint64_t)this);
292 
294  TF2_ROS_MESSAGEFILTER_DEBUG("%s", "Cleared");
295  }
296 
297  void add(const MEvent& evt)
298  {
299  if (target_frames_.empty())
300  {
301  return;
302  }
303 
304  namespace mt = ros::message_traits;
305  const MConstPtr& message = evt.getMessage();
306  std::string frame_id = stripSlash(mt::FrameId<M>::value(*message));
307  ros::Time stamp = mt::TimeStamp<M>::value(*message);
308 
309  if (frame_id.empty())
310  {
312  return;
313  }
314 
315  // iterate through the target frames and add requests for each of them
316  MessageInfo info;
317  info.handles.reserve(expected_success_count_);
318  {
319  V_string target_frames_copy;
320  // Copy target_frames_ to avoid deadlock from #79
321  {
322  boost::mutex::scoped_lock frames_lock(target_frames_mutex_);
323  target_frames_copy = target_frames_;
324  }
325 
326  V_string::iterator it = target_frames_copy.begin();
327  V_string::iterator end = target_frames_copy.end();
328  for (; it != end; ++it)
329  {
330  const std::string& target_frame = *it;
331  tf2::TransformableRequestHandle handle = bc_.addTransformableRequest(callback_handle_, target_frame, frame_id, stamp);
332  if (handle == 0xffffffffffffffffULL) // never transformable
333  {
335  return;
336  }
337  else if (handle == 0)
338  {
339  ++info.success_count;
340  }
341  else
342  {
343  info.handles.push_back(handle);
344  }
345 
346  if (!time_tolerance_.isZero())
347  {
348  handle = bc_.addTransformableRequest(callback_handle_, target_frame, frame_id, stamp + time_tolerance_);
349  if (handle == 0xffffffffffffffffULL) // never transformable
350  {
352  return;
353  }
354  else if (handle == 0)
355  {
356  ++info.success_count;
357  }
358  else
359  {
360  info.handles.push_back(handle);
361  }
362  }
363  }
364  }
365 
366  L_MessageInfo msgs_to_drop;
367 
368  // We can transform already
370  {
371  messageReady(evt);
372  }
373  else
374  {
375  boost::unique_lock<boost::shared_mutex> unique_lock(messages_mutex_);
376  // If this message is about to push us past our queue size, erase the oldest message
377  if (queue_size_ != 0 && message_count_ + 1 > queue_size_)
378  {
379  // move front element from messages_ to msgs_to_drop for later dropping
380  msgs_to_drop.splice(msgs_to_drop.begin(), messages_, messages_.begin());
381  --message_count_;
382  }
383 
384  // Add the message to our list
385  info.event = evt;
386  messages_.push_back(info);
387  ++message_count_;
388  }
389 
390  // Delay dropping of messages until we released messages_mutex_ to avoid deadlocks (#91, #101, #144)
391  for (const MessageInfo &msg : msgs_to_drop)
392  {
394  TF2_ROS_MESSAGEFILTER_DEBUG("Removed oldest message because buffer is full, count now %d (frame_id=%s, stamp=%f)", message_count_,
395  (mt::FrameId<M>::value(*msg.event.getMessage())).c_str(), mt::TimeStamp<M>::value(*msg.event.getMessage()).toSec());
396 
397  for (const auto req : msg.handles)
399 
401  }
402 
403  TF2_ROS_MESSAGEFILTER_DEBUG("Added message in frame %s at time %.3f, count now %d", frame_id.c_str(), stamp.toSec(), message_count_);
404 
406  }
407 
413  void add(const MConstPtr& message)
414  {
415  boost::shared_ptr<std::map<std::string, std::string> > header(new std::map<std::string, std::string>);
416  (*header)["callerid"] = "unknown";
418  ros::Time t(n.sec, n.nsec);
419  add(MEvent(message, header, t));
420  }
421 
427  {
428  boost::mutex::scoped_lock lock(failure_signal_mutex_);
429  return message_filters::Connection(boost::bind(&MessageFilter::disconnectFailure, this, boost::placeholders::_1), failure_signal_.connect(callback));
430  }
431 
432  virtual void setQueueSize( uint32_t new_queue_size )
433  {
434  queue_size_ = new_queue_size;
435  }
436 
437  virtual uint32_t getQueueSize()
438  {
439  return queue_size_;
440  }
441 
442 
443 private:
444 
445  void init()
446  {
447  message_count_ = 0;
456 
457  callback_handle_ = bc_.addTransformableCallback(boost::bind(&MessageFilter::transformable, this, boost::placeholders::_1, boost::placeholders::_2, boost::placeholders::_3, boost::placeholders::_4, boost::placeholders::_5));
458  }
459 
460  void transformable(tf2::TransformableRequestHandle request_handle, const std::string& /* target_frame */, const std::string& /* source_frame */,
461  ros::Time /* time */, tf2::TransformableResult result)
462  {
463  namespace mt = ros::message_traits;
464 
465  boost::upgrade_lock<boost::shared_mutex> read_lock(messages_mutex_);
466 
467  // find the message this request is associated with
468  typename L_MessageInfo::iterator msg_it = messages_.begin();
469  typename L_MessageInfo::iterator msg_end = messages_.end();
470  for (; msg_it != msg_end; ++msg_it)
471  {
472  MessageInfo& info = *msg_it;
473  V_TransformableRequestHandle::const_iterator handle_it = std::find(info.handles.begin(), info.handles.end(), request_handle);
474  if (handle_it != info.handles.end())
475  {
476  // found msg_it
477  ++info.success_count;
478  break;
479  }
480  }
481 
482  if (msg_it == msg_end)
483  {
484  return;
485  }
486 
487  const MessageInfo& info = *msg_it;
489  {
490  return;
491  }
492 
493  bool can_transform = true;
494  const MConstPtr& message = info.event.getMessage();
495  std::string frame_id = stripSlash(mt::FrameId<M>::value(*message));
496  ros::Time stamp = mt::TimeStamp<M>::value(*message);
497 
498  if (result == tf2::TransformAvailable)
499  {
500  boost::mutex::scoped_lock frames_lock(target_frames_mutex_);
501  // make sure we can still perform all the necessary transforms
502  typename V_string::iterator it = target_frames_.begin();
503  typename V_string::iterator end = target_frames_.end();
504  for (; it != end; ++it)
505  {
506  const std::string& target = *it;
507  if (!bc_.canTransform(target, frame_id, stamp))
508  {
509  can_transform = false;
510  break;
511  }
512 
513  if (!time_tolerance_.isZero())
514  {
515  if (!bc_.canTransform(target, frame_id, stamp + time_tolerance_))
516  {
517  can_transform = false;
518  break;
519  }
520  }
521  }
522  }
523  else
524  {
525  can_transform = false;
526  }
527 
528  if (can_transform)
529  {
530  TF2_ROS_MESSAGEFILTER_DEBUG("Message ready in frame %s at time %.3f, count now %d", frame_id.c_str(), stamp.toSec(), message_count_ - 1);
531 
533 
534  messageReady(info.event);
535 
536  }
537  else
538  {
540 
541  TF2_ROS_MESSAGEFILTER_DEBUG("Discarding message in frame %s at time %.3f, count now %d", frame_id.c_str(), stamp.toSec(), message_count_ - 1);
543  }
544 
545  // We will be mutating messages now, require unique lock
546  boost::upgrade_to_unique_lock<boost::shared_mutex> write_lock(read_lock);
547  messages_.erase(msg_it);
548  --message_count_;
549  }
550 
555  {
556  add(evt);
557  }
558 
560  {
562  {
564  }
565 
567  {
569  {
570  return;
571  }
572 
573  double dropped_pct = (double)dropped_message_count_ / (double)(incoming_message_count_ - message_count_);
574  if (dropped_pct > 0.95)
575  {
576  TF2_ROS_MESSAGEFILTER_WARN("Dropped %.2f%% of messages so far. Please turn the [%s.message_notifier] rosconsole logger to DEBUG for more information.", dropped_pct*100, ROSCONSOLE_DEFAULT_NAME);
578 
579  if ((double)failed_out_the_back_count_ / (double)dropped_message_count_ > 0.5)
580  {
581  TF2_ROS_MESSAGEFILTER_WARN(" The majority of dropped messages were due to messages growing older than the TF cache time. The last message's timestamp was: %f, and the last frame_id was: %s", last_out_the_back_stamp_.toSec(), last_out_the_back_frame_.c_str());
582  }
583  }
584  }
585  }
586 
588  {
589  CBQueueCallback(MessageFilter* filter, const MEvent& event, bool success, FilterFailureReason reason)
590  : event_(event)
591  , filter_(filter)
592  , reason_(reason)
593  , success_(success)
594  {}
595 
596 
597  virtual CallResult call()
598  {
599  boost::shared_lock<boost::shared_mutex> lock(filter_->cbqueue_mutex_);
600  if (success_)
601  {
603  }
604  else
605  {
607  }
608 
609  return Success;
610  }
611 
612  private:
616  bool success_;
617  };
618 
619  void messageDropped(const MEvent& evt, FilterFailureReason reason)
620  {
621  if (callback_queue_)
622  {
623  ros::CallbackInterfacePtr cb(new CBQueueCallback(this, evt, false, reason));
624  callback_queue_->addCallback(cb, (uint64_t)this);
625  }
626  else
627  {
628  signalFailure(evt, reason);
629  }
630  }
631 
632  void messageReady(const MEvent& evt)
633  {
634  if (callback_queue_)
635  {
637  callback_queue_->addCallback(cb, (uint64_t)this);
638  }
639  else
640  {
641  this->signalMessage(evt);
642  }
643  }
644 
646  {
647  boost::mutex::scoped_lock lock(failure_signal_mutex_);
648  c.getBoostConnection().disconnect();
649  }
650 
651  void signalFailure(const MEvent& evt, FilterFailureReason reason)
652  {
653  boost::mutex::scoped_lock lock(failure_signal_mutex_);
654  failure_signal_(evt.getMessage(), reason);
655  }
656 
657  static
658  std::string stripSlash(const std::string& in)
659  {
660  if ( !in.empty() && (in[0] == '/'))
661  {
662  std::string out = in;
663  out.erase(0, 1);
664  return out;
665  }
666  return in;
667  }
668 
672  boost::mutex target_frames_mutex_;
673  boost::shared_mutex cbqueue_mutex_;
674  uint32_t queue_size_;
676 
677  typedef std::vector<tf2::TransformableRequestHandle> V_TransformableRequestHandle;
678  struct MessageInfo
679  {
681  : success_count(0)
682  {}
683 
686  uint32_t success_count;
687  };
688  typedef std::list<MessageInfo> L_MessageInfo;
690  uint32_t message_count_;
691  boost::shared_mutex messages_mutex_;
693 
695 
701 
704 
706 
708 
710 
712  boost::mutex failure_signal_mutex_;
713 
715 };
716 
717 } // namespace tf2
718 
719 #endif
tf2_ros::MessageFilter::CBQueueCallback
Definition: message_filter.h:587
simple_filter.h
message_filters::Connection::getBoostConnection
boost::signals2::connection getBoostConnection() const
node_handle.h
tf2_ros::MessageFilter::signalFailure
void signalFailure(const MEvent &evt, FilterFailureReason reason)
Definition: message_filter.h:651
tf2_ros::MessageFilter::bc_
tf2::BufferCore & bc_
The Transformer used to determine if transformation data is available.
Definition: message_filter.h:669
tf2_ros::MessageFilter::last_out_the_back_frame_
std::string last_out_the_back_frame_
Definition: message_filter.h:703
tf2_ros::MessageFilter::MessageFilter
MessageFilter(tf2::BufferCore &bc, const std::string &target_frame, uint32_t queue_size, ros::CallbackQueueInterface *cbqueue)
Constructor.
Definition: message_filter.h:168
tf2_ros::MessageFilter::registerFailureCallback
message_filters::Connection registerFailureCallback(const FailureCallback &callback)
Register a callback to be called when a message is about to be dropped.
Definition: message_filter.h:426
tf2_ros::MessageFilter
Follows the patterns set by the message_filters package to implement a filter which only passes messa...
Definition: message_filter.h:104
message_filters::Connection
tf2_ros::MessageFilter::messageDropped
void messageDropped(const MEvent &evt, FilterFailureReason reason)
Definition: message_filter.h:619
boost::shared_ptr
tf2_ros::MessageFilter::MessageInfo::event
MEvent event
Definition: message_filter.h:684
tf2_ros::MessageFilter::target_frames_
V_string target_frames_
The frames we need to be able to transform to before a message is ready.
Definition: message_filter.h:670
tf2_ros::MessageFilter::callback_queue_
ros::CallbackQueueInterface * callback_queue_
Definition: message_filter.h:714
tf2_ros::MessageFilter::MessageFilter
MessageFilter(F &f, tf2::BufferCore &bc, const std::string &target_frame, uint32_t queue_size, ros::CallbackQueueInterface *cbqueue)
Constructor.
Definition: message_filter.h:190
tf2::BufferCore::addTransformableCallback
TransformableCallbackHandle addTransformableCallback(const TransformableCallback &cb)
tf2_ros::MessageFilter::init
void init()
Definition: message_filter.h:445
tf2_ros::MessageFilter::~MessageFilter
~MessageFilter()
Destructor.
Definition: message_filter.h:215
callback_queue_interface.h
tf2_ros::filter_failure_reasons::FilterFailureReason
FilterFailureReason
Definition: message_filter.h:63
tf2_ros::MessageFilter::callback_handle_
tf2::TransformableCallbackHandle callback_handle_
Definition: message_filter.h:675
tf2_ros::MessageFilter::failure_signal_mutex_
boost::mutex failure_signal_mutex_
Definition: message_filter.h:712
tf2_ros::MessageFilter::MConstPtr
boost::shared_ptr< M const > MConstPtr
Definition: message_filter.h:107
init.h
TimeBase< Time, Duration >::toSec
double toSec() const
tf2_ros::MessageFilter::messages_mutex_
boost::shared_mutex messages_mutex_
The mutex used for locking message list operations.
Definition: message_filter.h:691
tf2_ros::MessageFilter::disconnectFailure
void disconnectFailure(const message_filters::Connection &c)
Definition: message_filter.h:645
tf2_ros::MessageFilter::stripSlash
static std::string stripSlash(const std::string &in)
Definition: message_filter.h:658
tf2_ros::MessageFilter::CBQueueCallback::CBQueueCallback
CBQueueCallback(MessageFilter *filter, const MEvent &event, bool success, FilterFailureReason reason)
Definition: message_filter.h:589
tf2_ros::MessageFilter::CBQueueCallback::event_
MEvent event_
Definition: message_filter.h:613
tf2_ros::MessageFilter::target_frames_mutex_
boost::mutex target_frames_mutex_
A mutex to protect access to the target_frames_ list and target_frames_string.
Definition: message_filter.h:672
tf2_ros::MessageFilter::MessageInfo::success_count
uint32_t success_count
Definition: message_filter.h:686
tf2_ros::MessageFilter::getQueueSize
virtual uint32_t getQueueSize()
Definition: message_filter.h:437
ros::message_traits
ros::CallbackInterface::CallResult
CallResult
f
f
TF2_ROS_MESSAGEFILTER_WARN
#define TF2_ROS_MESSAGEFILTER_WARN(fmt,...)
Definition: message_filter.h:55
tf2_ros::MessageFilter::MessageFilter
MessageFilter(tf2::BufferCore &bc, const std::string &target_frame, uint32_t queue_size, const ros::NodeHandle &nh)
Constructor.
Definition: message_filter.h:126
tf2_ros::MessageFilter::failure_signal_
FailureSignal failure_signal_
Definition: message_filter.h:711
message_filters::SimpleFilter
tf2_ros::MessageFilter::MessageInfo::handles
V_TransformableRequestHandle handles
Definition: message_filter.h:685
tf2_ros::MessageFilter::queue_size_
uint32_t queue_size_
The maximum number of messages we queue up.
Definition: message_filter.h:674
tf2_ros::MessageFilter::transformable
void transformable(tf2::TransformableRequestHandle request_handle, const std::string &, const std::string &, ros::Time, tf2::TransformableResult result)
Definition: message_filter.h:460
tf2_ros::MessageFilter::incomingMessage
void incomingMessage(const ros::MessageEvent< M const > &evt)
Callback that happens when we receive a message on the message topic.
Definition: message_filter.h:554
tf2_ros::MessageFilter::FailureSignal
boost::signals2::signal< void(const MConstPtr &, FilterFailureReason)> FailureSignal
Definition: message_filter.h:110
tf2_ros::MessageFilter::clear
void clear()
Clear any messages currently in the queue.
Definition: message_filter.h:279
tf2_ros
Definition: buffer.h:42
TimeBase< WallTime, WallDuration >::isZero
bool isZero() const
tf2_ros::MessageFilterBase
Definition: message_filter.h:75
tf2_ros::MessageFilter::messages_
L_MessageInfo messages_
Definition: message_filter.h:689
ros::WallTime::now
static WallTime now()
tf2_ros::MessageFilter::last_out_the_back_stamp_
ros::Time last_out_the_back_stamp_
Definition: message_filter.h:702
tf2_ros::MessageFilter::checkFailures
void checkFailures()
Definition: message_filter.h:559
tf2::TransformableRequestHandle
uint64_t TransformableRequestHandle
tf2_ros::MessageFilter::getTargetFramesString
std::string getTargetFramesString()
Get the target frames as a string for debugging.
Definition: message_filter.h:260
tf2_ros::filter_failure_reasons::EmptyFrameID
@ EmptyFrameID
The frame_id on the message is empty.
Definition: message_filter.h:70
TF2_ROS_MESSAGEFILTER_DEBUG
#define TF2_ROS_MESSAGEFILTER_DEBUG(fmt,...)
Definition: message_filter.h:52
tf2_ros::MessageFilter::setTolerance
void setTolerance(const ros::Duration &tolerance)
Set the required tolerance for the notifier to return true.
Definition: message_filter.h:269
tf2_ros::MessageFilter::CBQueueCallback::filter_
MessageFilter * filter_
Definition: message_filter.h:614
tf2_ros::filter_failure_reasons::Unknown
@ Unknown
The message buffer overflowed, and this message was pushed off the back of the queue,...
Definition: message_filter.h:66
tf2_ros::MessageFilter::expected_success_count_
uint32_t expected_success_count_
Definition: message_filter.h:692
ros::CallbackQueueInterface::removeByID
virtual void removeByID(uint64_t owner_id)=0
tf2_ros::MessageFilterBase::setTolerance
virtual void setTolerance(const ros::Duration &tolerance)=0
tf2_ros::MessageFilterBase::clear
virtual void clear()=0
tf2_ros::FilterFailureReason
filter_failure_reasons::FilterFailureReason FilterFailureReason
Definition: message_filter.h:73
tf2::BufferCore::canTransform
bool canTransform(const std::string &target_frame, const ros::Time &target_time, const std::string &source_frame, const ros::Time &source_time, const std::string &fixed_frame, std::string *error_msg=NULL) const
tf2_ros::MessageFilter::setTargetFrame
void setTargetFrame(const std::string &target_frame)
Set the frame you need to be able to transform to before getting a message callback.
Definition: message_filter.h:232
buffer_core.h
ros::CallbackInterface
tf2_ros::MessageFilter::cbqueue_mutex_
boost::shared_mutex cbqueue_mutex_
A mutex protecting calls from callback queues.
Definition: message_filter.h:673
tf2::BufferCore::cancelTransformableRequest
void cancelTransformableRequest(TransformableRequestHandle handle)
tf2_ros::filter_failure_reasons::OutTheBack
@ OutTheBack
The timestamp on the message is more than the cache length earlier than the newest data in the transf...
Definition: message_filter.h:68
ros::WallTime
tf2_ros::MessageFilter::setQueueSize
virtual void setQueueSize(uint32_t new_queue_size)
Definition: message_filter.h:432
tf2_ros::MessageFilter::CBQueueCallback::reason_
FilterFailureReason reason_
Definition: message_filter.h:615
ros::CallbackInterface::Success
Success
TimeBase< WallTime, WallDuration >::sec
uint32_t sec
tf2_ros::MessageFilter::MEvent
ros::MessageEvent< M const > MEvent
Definition: message_filter.h:108
TimeBase< WallTime, WallDuration >::nsec
uint32_t nsec
ros::CallbackQueueInterface::addCallback
virtual void addCallback(const CallbackInterfacePtr &callback, uint64_t owner_id=0)=0
tf2_ros::MessageFilter::L_MessageInfo
std::list< MessageInfo > L_MessageInfo
Definition: message_filter.h:688
tf2_ros::MessageFilter::setTargetFrames
void setTargetFrames(const V_string &target_frames)
Set the frames you need to be able to transform to before getting a message callback.
Definition: message_filter.h:242
tf2_ros::MessageFilter::connectInput
void connectInput(F &f)
Connect this filter's input to another filter's output. If this filter is already connected,...
Definition: message_filter.h:206
tf2_ros::MessageFilter::warned_about_empty_frame_id_
bool warned_about_empty_frame_id_
Definition: message_filter.h:694
tf2_ros::MessageFilter::CBQueueCallback::success_
bool success_
Definition: message_filter.h:616
connection.h
tf2_ros::MessageFilterBase::V_string
std::vector< std::string > V_string
Definition: message_filter.h:78
tf2_ros::MessageFilter::message_count_
uint32_t message_count_
The number of messages in the list. Used because <container>.size() may have linear cost.
Definition: message_filter.h:690
tf2_ros::MessageFilter::dropped_message_count_
uint64_t dropped_message_count_
Definition: message_filter.h:700
tf2_ros::MessageFilter::MessageFilter
MessageFilter(F &f, tf2::BufferCore &bc, const std::string &target_frame, uint32_t queue_size, const ros::NodeHandle &nh)
Constructor.
Definition: message_filter.h:146
ros::Time
tf2_ros::MessageFilter::V_TransformableRequestHandle
std::vector< tf2::TransformableRequestHandle > V_TransformableRequestHandle
Definition: message_filter.h:677
tf2::BufferCore
tf2_ros::MessageFilter::next_failure_warning_
ros::WallTime next_failure_warning_
Definition: message_filter.h:705
tf2::BufferCore::addTransformableRequest
TransformableRequestHandle addTransformableRequest(TransformableCallbackHandle handle, const std::string &target_frame, const std::string &source_frame, ros::Time time)
tf2_ros::MessageFilter::MessageInfo
Definition: message_filter.h:678
tf2_ros::MessageFilterBase::~MessageFilterBase
virtual ~MessageFilterBase()
Definition: message_filter.h:80
tf2_ros::MessageFilter::add
void add(const MConstPtr &message)
Manually add a message into this filter.
Definition: message_filter.h:413
tf2_ros::MessageFilter::successful_transform_count_
uint64_t successful_transform_count_
Definition: message_filter.h:696
tf2_ros::MessageFilter::message_connection_
message_filters::Connection message_connection_
Definition: message_filter.h:709
V_string
std::vector< std::string > V_string
ros::MessageEvent::getMessage
boost::shared_ptr< M > getMessage() const
ROSCONSOLE_DEFAULT_NAME
#define ROSCONSOLE_DEFAULT_NAME
tf2::BufferCore::removeTransformableCallback
void removeTransformableCallback(TransformableCallbackHandle handle)
ros::WallDuration
header
const std::string header
tf2_ros::MessageFilter::transform_message_count_
uint64_t transform_message_count_
Definition: message_filter.h:698
tf2_ros::MessageFilter::messageReady
void messageReady(const MEvent &evt)
Definition: message_filter.h:632
message_filters::SimpleFilter::signalMessage
void signalMessage(const MConstPtr &msg)
tf2_ros::MessageFilterBase::setTargetFrame
virtual void setTargetFrame(const std::string &target_frame)=0
tf2_ros::MessageFilter::target_frames_string_
std::string target_frames_string_
Definition: message_filter.h:671
ros::Duration
tf2::TransformableResult
TransformableResult
tf2_ros::MessageFilter::MessageInfo::MessageInfo
MessageInfo()
Definition: message_filter.h:680
tf2_ros::MessageFilter::add
void add(const MEvent &evt)
Definition: message_filter.h:297
ros::CallbackQueueInterface
DurationBase< Duration >::isZero
bool isZero() const
tf2_ros::MessageFilter::time_tolerance_
ros::Duration time_tolerance_
Provide additional tolerance on time for messages which are stamped but can have associated duration.
Definition: message_filter.h:707
tf2_ros::MessageFilterBase::setTargetFrames
virtual void setTargetFrames(const V_string &target_frames)=0
tf2_ros::MessageFilter::incoming_message_count_
uint64_t incoming_message_count_
Definition: message_filter.h:699
ros::NodeHandle
ros::MessageEvent
tf2::TransformableCallbackHandle
uint32_t TransformableCallbackHandle
tf2::TransformAvailable
TransformAvailable
tf2_ros::MessageFilter::failed_out_the_back_count_
uint64_t failed_out_the_back_count_
Definition: message_filter.h:697
tf2_ros::MessageFilter::FailureCallback
boost::function< void(const MConstPtr &, FilterFailureReason)> FailureCallback
Definition: message_filter.h:109
message_filters::Connection::disconnect
void disconnect()
tf2_ros::MessageFilter::CBQueueCallback::call
virtual CallResult call()
Definition: message_filter.h:597


tf2_ros
Author(s): Eitan Marder-Eppstein, Wim Meeussen
autogenerated on Sun May 4 2025 02:16:35