Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

I use the following code to use message filters inside a class class SubscribeAndPublish { public: SubscribeAndPublish():sync2(image_sub,image_sub2,500){ image_sub.subscribe(n, "/camera/color/image_raw", 1); image_sub2.subscribe(n, "/camera/aligned_depth_to_color/image_raw", 1); sync2.registerCallback(boost::bind(&SubscribeAndPublish::callback,this, _1, _2)); odom_pub = n.advertise<nav_msgs::odometry>("RGBDodom", 50); } private: ros::NodeHandle n; ros::Publisher odom_pub; message_filters::Subscriber<image> image_sub; message_filters::Subscriber<image> image_sub2; TimeSynchronizer<image, image=""> sync2; };

I use the following code to use message filters inside a class class `

class SubscribeAndPublish { public: SubscribeAndPublish():sync2(image_sub,image_sub2,500){ {

public:

SubscribeAndPublish():sync2(image_sub,image_sub2,500){

image_sub.subscribe(n, "/camera/color/image_raw", 1); 1);

image_sub2.subscribe(n, "/camera/aligned_depth_to_color/image_raw", 1); 1);

sync2.registerCallback(boost::bind(&SubscribeAndPublish::callback,this, _1, _2)); _2));

odom_pub = n.advertise<nav_msgs::odometry>("RGBDodom", 50); } 50);

}

private: ros::NodeHandle n; n;

ros::Publisher odom_pub;
    message_filters::Subscriber<image> 
message_filters::Subscriber<Image> image_sub;
    message_filters::Subscriber<image> 
message_filters::Subscriber<Image> image_sub2;
    TimeSynchronizer<image, image=""> 
TimeSynchronizer<Image, Image> sync2;
};

};`

click to hide/show revision 3
No.3 Revision

I use the following code to use message filters inside a class `class

class SubscribeAndPublish
{

{ public:

public:

SubscribeAndPublish():sync2(image_sub,image_sub2,500){

image_sub.subscribe(n, "/camera/color/image_raw", 1);

1);

image_sub2.subscribe(n, "/camera/aligned_depth_to_color/image_raw", 1);

1);

sync2.registerCallback(boost::bind(&SubscribeAndPublish::callback,this, _1, _2));

_2));

odom_pub = n.advertise<nav_msgs::odometry>("RGBDodom", 50);

n.advertise<nav_msgs::Odometry>("RGBDodom", 50); }

}

private: ros::NodeHandle n;

n;
 ros::Publisher odom_pub;

 message_filters::Subscriber<Image> image_sub;

 message_filters::Subscriber<Image> image_sub2;

 TimeSynchronizer<Image, Image> sync2;
};

};`