Martin,
The message_filters::Subscriber takes constructor arguments for the subscription and does not accept assignment from a generic subscription object. Then you have to register the callback. See http://www.ros.org/wiki/message_filters
Tully
PS if you want to call a class method as your callback you will also need to pass the object as well as the method. This should be helpful for that http://www.ros.org/wiki/roscpp_tutorials/Tutorials/UsingClassMethodsAsCallbacks it's not the same interface but follows the same conventions.
Hi,
I am a ROS newbie and I was trying to compile the following code:
class CloudToPCDFile{
public:
ros::NodeHandle n_;
message_filters::Subscriber<sensor_msgs::PointCloud> laser_sub_;
CloudToPCDFile(ros::NodeHandle n) :
n_(n)
{
laser_sub_=n_.subscribe("/ptu_46/assembled_cloud", 100, scanCallback);
}
void scanCallback (const sensor_msgs::PointCloudConstPtr& scan_in)
{
//Dummy
}
};
int main(int argc, char** argv)
{
ros::init(argc, argv, "cloud_to_pcd_file");
ros::NodeHandle n;
CloudToPCDFile lstopc(n);
ros::spin();
return 0;
}
however, I unfortunately get the following error:
error: no matching function for call to ‘ros::NodeHandle::subscribe(const
char [24], int, <unresolved overloaded function type>)’
any idea what I could be doing wrong?
many thanks!
--
View this message in context: http://ros-users.122217.n3.nabble.com/no-matching-function-for-call-to-ros-NodeHandle-subscribe-tp1727890p1727890.html
Sent from the ROS-Users mailing list archive at Nabble.com.
_______________________________________________
ros-users mailing list
ros-users@code.ros.org
https://code.ros.org/mailman/listinfo/ros-users