Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

How to use TimeSynchronizer filter inside nodelet?


I started using ROS (indigo on Ubuntu 14.04) and I want convert my node (which running well and using TimeSynchronizer for two topics synchronized by timestamp that call manta_callback function) to nodelet. But after initialising my nodelet, TimeSynchronizer doesn't synchronize input topics & doesn't call manta_callback(). How can I debug TimeSynchronizer under nodelet or should I check another solution e.g. NodeletMUX for synchronize two topics under nodelet? Sources:

header file:

namespace detect_control_nodelet {

class MarkerDetectControl : public nodelet::Nodelet
        virtual void onInit();
    void manta_callback(const sensor_msgs::ImageConstPtr & image_msg,  ar_track_alvar_msgs_ext::AlvarMarkerExtConstPtr  arMarkerCorners);       



src file:

namespace detect_control_nodelet 
   void MarkerDetectControl::onInit()
    NODELET_DEBUG("Initializing nodelet..."); 
    ros::NodeHandle n("~");

   ros::NodeHandle nh = getNodeHandle();
   ros::NodeHandle& private_nh = getPrivateNodeHandle();
   ROS_INFO("In onInit()");     

message_filters::Subscriber<Image> image_sub(private_nh, "camera/image_raw", 1);
message_filters::Subscriber<ar_track_alvar_msgs_ext::AlvarMarkerExt> info_sub(private_nh, "ar_corners_marker",1);
TimeSynchronizer<Image, ar_track_alvar_msgs_ext::AlvarMarkerExt> sync(image_sub, info_sub, 50);
sync.registerCallback(boost::bind(&MarkerDetectControl::manta_callback,this,_1, _2));}


void MarkerDetectControl::manta_callback(const sensor_msgs::ImageConstPtr & image_msg, ar_track_alvar_msgs_ext::AlvarMarkerExtConstPtr arMarkerCorners) {
ROS_INFO("In function manta_callback");