A class for synchronizing incoming topics. More...
#include <topic_synchronizer.h>
Classes | |
class | CallbackFunctor |
Public Member Functions | |
void | reset () |
template<typename T > | |
TopicSynchronizer (void(T::*fp)(), T *obj) | |
TopicSynchronizer (void(*fp)()) | |
void | update (const ros::Time &time) |
Public Attributes | |
const boost::function< void(const boost::shared_ptr< M const > &)> | synchronize (void(T::*fp)(const boost::shared_ptr< M const > &), T *obj) |
Private Attributes | |
boost::function< void()> | callback_ |
int | count_ |
int | expected_count_ |
boost::mutex | mutex_ |
ros::Time | time_ |
A class for synchronizing incoming topics.
The Topic Synchronizerc ismpassed a function pointer at construction to be called every time all of your topics have arrived.
Example of usage:
TopicSynchronizer sync(&MyClass::syncCallback, this);
ros::Subscriber left_image_sub_ = nh_.subscribe("stereo/left/image_rect", 1, sync.synchronize(&MyClass::leftImageCallback, this)); ros::Subscriber right_image_sub_ = nh_.subscribe("stereo/right/image_rect", 1, sync.synchronize(&MyClass::rightImageCallback, this)); ros::Subscriber disparity_sub_ = nh_.subscribe("stereo/disparity", 1, sync.synchronize(&MyClass::disparityImageCallback, this)); ros::Subscriber cloud_sub_ = nh_.subscribe("stereo/cloud", 1, sync.synchronize(&MyClass::cloudCallback, this));
Definition at line 61 of file topic_synchronizer.h.
TopicSynchronizer::TopicSynchronizer | ( | void(T::*)() | fp, |
T * | obj | ||
) | [inline] |
Definition at line 72 of file topic_synchronizer.h.
TopicSynchronizer::TopicSynchronizer | ( | void(*)() | fp | ) | [inline] |
Definition at line 77 of file topic_synchronizer.h.
void TopicSynchronizer::reset | ( | ) | [inline] |
Definition at line 137 of file topic_synchronizer.h.
void TopicSynchronizer::update | ( | const ros::Time & | time | ) | [inline] |
Definition at line 143 of file topic_synchronizer.h.
boost::function<void ()> TopicSynchronizer::callback_ [private] |
Definition at line 66 of file topic_synchronizer.h.
int TopicSynchronizer::count_ [private] |
Definition at line 64 of file topic_synchronizer.h.
int TopicSynchronizer::expected_count_ [private] |
Definition at line 63 of file topic_synchronizer.h.
boost::mutex TopicSynchronizer::mutex_ [private] |
Definition at line 67 of file topic_synchronizer.h.
const boost::function< void(const boost::shared_ptr< M const > &)> TopicSynchronizer::synchronize [inline] |
Definition at line 103 of file topic_synchronizer.h.
ros::Time TopicSynchronizer::time_ [private] |
Definition at line 65 of file topic_synchronizer.h.